changeset 112181:af71852e09a2

* net/dbus.el (dbus-unregister-service): Translate returned integer into a symbol. (dbus-register-property): Use `dbus-register-service' to do the name registration.
author Michael Albinus <michael.albinus@gmx.de>
date Mon, 10 Jan 2011 10:46:19 +0100
parents a48c0a71829b
children e79369283aa1
files lisp/ChangeLog lisp/net/dbus.el
diffstat 2 files changed, 26 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Jan 10 10:40:20 2011 +0100
+++ b/lisp/ChangeLog	Mon Jan 10 10:46:19 2011 +0100
@@ -1,3 +1,10 @@
+2011-01-10  Jan Moringen  <jan.moringen@uni-bielefeld.de>
+
+	* net/dbus.el (dbus-unregister-service): Translate returned
+	integer into a symbol.
+	(dbus-register-property): Use `dbus-register-service' to do the
+	name registration.
+
 2011-01-09  Chong Yidong  <cyd@stupidchicken.com>
 
 	* progmodes/idlw-help.el (idlwave-help-link): Inherit from link
--- a/lisp/net/dbus.el	Mon Jan 10 10:40:20 2011 +0100
+++ b/lisp/net/dbus.el	Mon Jan 10 10:46:19 2011 +0100
@@ -193,9 +193,14 @@
 	       (puthash key (delete elt value) dbus-registered-objects-table)
 	     (remhash key dbus-registered-objects-table))))))
    dbus-registered-objects-table)
-  (dbus-call-method
-   bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
-   "ReleaseName" service))
+  (let ((reply (dbus-call-method
+		bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
+		"ReleaseName" service)))
+    (case reply
+      (1 :released)
+      (2 :non-existent)
+      (3 :not-owner)
+      (t (signal 'dbus-error "Could not unregister service")))))
 
 (defun dbus-call-method-non-blocking-handler (&rest args)
   "Handler for reply messages of asynchronous D-Bus message calls.
@@ -914,17 +919,20 @@
      bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
      "RequestName" service 0))
 
-  ;; Add the handler.  We use `dbus-service-emacs' as service name, in
-  ;; order to let unregister SERVICE despite of this default handler.
+  ;; Add handlers for the three property-related methods.
   (dbus-register-method
-   bus service path dbus-interface-properties "Get" 'dbus-property-handler
-   dont-register-service)
+   bus service path dbus-interface-properties "Get"
+   'dbus-property-handler t)
   (dbus-register-method
-   bus service path dbus-interface-properties "GetAll" 'dbus-property-handler
-   dont-register-service)
+   bus service path dbus-interface-properties "GetAll" 
+   'dbus-property-handler t)
   (dbus-register-method
-   bus service path dbus-interface-properties "Set" 'dbus-property-handler
-   dont-register-service)
+   bus service path dbus-interface-properties "Set" 
+   'dbus-property-handler t)
+
+  ;; Register the name SERVICE with BUS.
+  (unless dont-register-service
+    (dbus-register-service bus service))
 
   ;; Send the PropertiesChanged signal.
   (when emits-signal