Mercurial > emacs
comparison src/dbusbind.c @ 104285:4eb010135586
* dbusbind.c (xd_get_dispatch_status, xd_pending_messages): New functions.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Sat, 15 Aug 2009 18:27:58 +0000 |
parents | 50effbe728da |
children | a98c5e3801f8 |
comparison
equal
deleted
inserted
replaced
104284:6a1ccc3fe7f8 | 104285:4eb010135586 |
---|---|
1412 | 1412 |
1413 /* Return. */ | 1413 /* Return. */ |
1414 return Qt; | 1414 return Qt; |
1415 } | 1415 } |
1416 | 1416 |
1417 /* Check, whether there is pending input in the message queue of the | |
1418 D-Bus BUS. BUS is a Lisp symbol, either :system or :session. */ | |
1419 int | |
1420 xd_get_dispatch_status (bus) | |
1421 Lisp_Object bus; | |
1422 { | |
1423 DBusConnection *connection; | |
1424 | |
1425 /* Open a connection to the bus. */ | |
1426 connection = xd_initialize (bus); | |
1427 | |
1428 /* Non blocking read of the next available message. */ | |
1429 dbus_connection_read_write (connection, 0); | |
1430 | |
1431 /* Return. */ | |
1432 return | |
1433 (dbus_connection_get_dispatch_status (connection) | |
1434 == DBUS_DISPATCH_DATA_REMAINS) | |
1435 ? TRUE : FALSE; | |
1436 } | |
1437 | |
1438 /* Check for queued incoming messages from the system and session buses. */ | |
1439 int | |
1440 xd_pending_messages () | |
1441 { | |
1442 | |
1443 /* Vdbus_registered_functions_table will be initialized as hash | |
1444 table in dbus.el. When this package isn't loaded yet, it doesn't | |
1445 make sense to handle D-Bus messages. */ | |
1446 return (HASH_TABLE_P (Vdbus_registered_functions_table) | |
1447 ? ((xd_get_dispatch_status (QCdbus_system_bus) | |
1448 || (xd_get_dispatch_status (QCdbus_session_bus)))) | |
1449 : FALSE); | |
1450 } | |
1451 | |
1417 /* Read queued incoming message of the D-Bus BUS. BUS is a Lisp | 1452 /* Read queued incoming message of the D-Bus BUS. BUS is a Lisp |
1418 symbol, either :system or :session. */ | 1453 symbol, either :system or :session. */ |
1419 static Lisp_Object | 1454 static Lisp_Object |
1420 xd_read_message (bus) | 1455 xd_read_message (bus) |
1421 Lisp_Object bus; | 1456 Lisp_Object bus; |