aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbusbind.c
diff options
context:
space:
mode:
authorMichael Albinus2009-08-15 18:27:58 +0000
committerMichael Albinus2009-08-15 18:27:58 +0000
commitf573d5886c10d1312e77c6d7e8bee35b15840d85 (patch)
treea7beec794bc33c0a3d4fb34b4bdd3db615712e6e /src/dbusbind.c
parent17310faf6be67fd1ed79180d328783555d754f15 (diff)
downloademacs-f573d5886c10d1312e77c6d7e8bee35b15840d85.tar.gz
emacs-f573d5886c10d1312e77c6d7e8bee35b15840d85.zip
* dbusbind.c (xd_get_dispatch_status, xd_pending_messages): New functions.
Diffstat (limited to 'src/dbusbind.c')
-rw-r--r--src/dbusbind.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 8100c754399..aa4efa7ca33 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -1414,6 +1414,41 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */)
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. */
1419int
1420xd_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. */
1439int
1440xd_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. */
1419static Lisp_Object 1454static Lisp_Object