diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2010-10-08 13:40:23 +0200 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2010-10-08 13:40:23 +0200 |
commit | 6f23cac528aeb7f0e6d1115048cbbede3b323926 (patch) | |
tree | 2a2e5e03ccb64efc89ced81a4e07dc4d65c2bd67 /src | |
parent | f9a579519116ffde3a4ba63008861c60a68a45dc (diff) | |
download | emacs-6f23cac528aeb7f0e6d1115048cbbede3b323926.tar.gz |
* dbusbind.c (xd_get_dispatch_status): Return a Lisp_Object.
(xd_pending_messages): Catch xd_get_dispatch_status calls.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/dbusbind.c | 27 |
2 files changed, 24 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index eb6b016f287..61b4bc19ffb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-10-08 Michael Albinus <michael.albinus@gmx.de> + + * dbusbind.c (xd_get_dispatch_status): Return a Lisp_Object. + (xd_pending_messages): Catch xd_get_dispatch_status calls. + 2010-10-08 Kenichi Handa <handa@m17n.org> * coding.c (complement_process_encoding_system): Fix previous change. 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) */) /* Check, whether there is pending input in the message queue of the D-Bus BUS. BUS is a Lisp symbol, either :system or :session. */ -int +static Lisp_Object xd_get_dispatch_status (bus) Lisp_Object bus; { @@ -1587,23 +1587,34 @@ xd_get_dispatch_status (bus) return (dbus_connection_get_dispatch_status (connection) == DBUS_DISPATCH_DATA_REMAINS) - ? TRUE : FALSE; + ? Qt : Qnil; } /* Check for queued incoming messages from the system and session buses. */ int xd_pending_messages () { + int ret = FALSE; + xd_in_read_queued_messages = 1; /* Vdbus_registered_objects_table will be initialized as hash table in dbus.el. When this package isn't loaded yet, it doesn't make sense to handle D-Bus messages. */ - return (HASH_TABLE_P (Vdbus_registered_objects_table) - ? (xd_get_dispatch_status (QCdbus_system_bus) - || ((getenv ("DBUS_SESSION_BUS_ADDRESS") != NULL) - ? xd_get_dispatch_status (QCdbus_session_bus) - : FALSE)) - : FALSE); + if (HASH_TABLE_P (Vdbus_registered_objects_table)) + { + ret = (!NILP (internal_catch (Qdbus_error, xd_get_dispatch_status, + QCdbus_system_bus))); + if (ret) goto theend; + + ret = ((getenv ("DBUS_SESSION_BUS_ADDRESS") != NULL) && + (!NILP (internal_catch (Qdbus_error, xd_get_dispatch_status, + QCdbus_session_bus)))); + } + + /* Return. */ + theend: + xd_in_read_queued_messages = 0; + return ret; } /* Read queued incoming message of the D-Bus BUS. BUS is a Lisp |