aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbusbind.c
diff options
context:
space:
mode:
authorMichael Albinus2010-10-08 13:40:23 +0200
committerMichael Albinus2010-10-08 13:40:23 +0200
commit2e828c79a3907ce76d96517b8a878398c6cecb0a (patch)
tree50c2385644da952f149ce014cb85e3e417d85973 /src/dbusbind.c
parent47a814f53002be4ca5448e1956e8aaad5345bc27 (diff)
downloademacs-2e828c79a3907ce76d96517b8a878398c6cecb0a.tar.gz
emacs-2e828c79a3907ce76d96517b8a878398c6cecb0a.zip
* dbusbind.c (xd_get_dispatch_status): Return a Lisp_Object.
(xd_pending_messages): Catch xd_get_dispatch_status calls.
Diffstat (limited to 'src/dbusbind.c')
-rw-r--r--src/dbusbind.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 460cf52364e..60697c8a4e9 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -1571,7 +1571,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */)
1571 1571
1572/* Check, whether there is pending input in the message queue of the 1572/* Check, whether there is pending input in the message queue of the
1573 D-Bus BUS. BUS is a Lisp symbol, either :system or :session. */ 1573 D-Bus BUS. BUS is a Lisp symbol, either :system or :session. */
1574int 1574static Lisp_Object
1575xd_get_dispatch_status (bus) 1575xd_get_dispatch_status (bus)
1576 Lisp_Object bus; 1576 Lisp_Object bus;
1577{ 1577{
@@ -1587,23 +1587,34 @@ xd_get_dispatch_status (bus)
1587 return 1587 return
1588 (dbus_connection_get_dispatch_status (connection) 1588 (dbus_connection_get_dispatch_status (connection)
1589 == DBUS_DISPATCH_DATA_REMAINS) 1589 == DBUS_DISPATCH_DATA_REMAINS)
1590 ? TRUE : FALSE; 1590 ? Qt : Qnil;
1591} 1591}
1592 1592
1593/* Check for queued incoming messages from the system and session buses. */ 1593/* Check for queued incoming messages from the system and session buses. */
1594int 1594int
1595xd_pending_messages () 1595xd_pending_messages ()
1596{ 1596{
1597 int ret = FALSE;
1598 xd_in_read_queued_messages = 1;
1597 1599
1598 /* Vdbus_registered_objects_table will be initialized as hash table 1600 /* Vdbus_registered_objects_table will be initialized as hash table
1599 in dbus.el. When this package isn't loaded yet, it doesn't make 1601 in dbus.el. When this package isn't loaded yet, it doesn't make
1600 sense to handle D-Bus messages. */ 1602 sense to handle D-Bus messages. */
1601 return (HASH_TABLE_P (Vdbus_registered_objects_table) 1603 if (HASH_TABLE_P (Vdbus_registered_objects_table))
1602 ? (xd_get_dispatch_status (QCdbus_system_bus) 1604 {
1603 || ((getenv ("DBUS_SESSION_BUS_ADDRESS") != NULL) 1605 ret = (!NILP (internal_catch (Qdbus_error, xd_get_dispatch_status,
1604 ? xd_get_dispatch_status (QCdbus_session_bus) 1606 QCdbus_system_bus)));
1605 : FALSE)) 1607 if (ret) goto theend;
1606 : FALSE); 1608
1609 ret = ((getenv ("DBUS_SESSION_BUS_ADDRESS") != NULL) &&
1610 (!NILP (internal_catch (Qdbus_error, xd_get_dispatch_status,
1611 QCdbus_session_bus))));
1612 }
1613
1614 /* Return. */
1615 theend:
1616 xd_in_read_queued_messages = 0;
1617 return ret;
1607} 1618}
1608 1619
1609/* Read queued incoming message of the D-Bus BUS. BUS is a Lisp 1620/* Read queued incoming message of the D-Bus BUS. BUS is a Lisp