comparison lisp/net/dbus.el @ 104355:7d92d0b5edc6

* net/dbus.el (top): Apply `dbus-init-bus' for the :session bus only if it is running already.
author Michael Albinus <michael.albinus@gmx.de>
date Wed, 19 Aug 2009 07:08:57 +0000
parents 709480950021
children 0626d17129e9
comparison
equal deleted inserted replaced
104354:7d0f4f179b3d 104355:7d92d0b5edc6
38 (declare-function dbus-method-return-internal "dbusbind.c") 38 (declare-function dbus-method-return-internal "dbusbind.c")
39 (declare-function dbus-method-error-internal "dbusbind.c") 39 (declare-function dbus-method-error-internal "dbusbind.c")
40 (declare-function dbus-register-signal "dbusbind.c") 40 (declare-function dbus-register-signal "dbusbind.c")
41 (defvar dbus-debug) 41 (defvar dbus-debug)
42 (defvar dbus-registered-functions-table) 42 (defvar dbus-registered-functions-table)
43
44 ;; Initialize :system and :session buses. This adds their file
45 ;; descriptors to input_wait_mask, in order to detect incoming
46 ;; messages immediately.
47 ;; We must avoid to call the function twice for a bus, because the
48 ;; DBusWatch will be removed then.
49 (when (and (featurep 'dbusbind) (not (featurep 'dbus)))
50 (dbus-init-bus :system)
51 (dbus-init-bus :session))
52 43
53 ;; Pacify byte compiler. 44 ;; Pacify byte compiler.
54 (eval-when-compile 45 (eval-when-compile
55 (require 'cl)) 46 (require 'cl))
56 47
839 (add-to-list 830 (add-to-list
840 'result 831 'result
841 (cons property (dbus-get-property bus service path interface property)) 832 (cons property (dbus-get-property bus service path interface property))
842 'append))))) 833 'append)))))
843 834
835 ;; Initialize :system and :session buses. This adds their file
836 ;; descriptors to input_wait_mask, in order to detect incoming
837 ;; messages immediately.
838 (dbus-ignore-errors
839 (dbus-init-bus :system)
840 (when (getenv "DBUS_SESSION_BUS_ADDRESS")
841 (dbus-init-bus :session)))
842
844 (provide 'dbus) 843 (provide 'dbus)
845 844
846 ;; arch-tag: a47caf84-9162-4811-90cc-5d388e37b9bd 845 ;; arch-tag: a47caf84-9162-4811-90cc-5d388e37b9bd
847 ;;; dbus.el ends here 846 ;;; dbus.el ends here