aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2011-01-04 11:57:24 +0100
committerMichael Albinus2011-01-04 11:57:24 +0100
commit6388924af0960495b2aedc637544b532cabd44a7 (patch)
treee00fac3c60bbb43d8f22a69a968d5cdf14f94610
parentc3e4b003c22fc5c343d0d1736f43405aeec650e6 (diff)
downloademacs-6388924af0960495b2aedc637544b532cabd44a7.tar.gz
emacs-6388924af0960495b2aedc637544b532cabd44a7.zip
* net/dbus.el (dbus-register-property): Added optional parameter
dont-register-service. Updated docstring accordingly.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/net/dbus.el43
2 files changed, 33 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b41711e26db..6c4473d94b7 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12011-01-04 Jan Moringen <jan.moringen@uni-bielefeld.de>
2
3 * net/dbus.el (dbus-register-property): Added optional parameter
4 dont-register-service. Updated docstring accordingly.
5
12011-01-04 Andreas Schwab <schwab@linux-m68k.org> 62011-01-04 Andreas Schwab <schwab@linux-m68k.org>
2 7
3 * textmodes/rst.el (rst-compile-pdf-preview) 8 * textmodes/rst.el (rst-compile-pdf-preview)
diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el
index c9adec5d7b8..7903644029e 100644
--- a/lisp/net/dbus.el
+++ b/lisp/net/dbus.el
@@ -1,6 +1,6 @@
1;;; dbus.el --- Elisp bindings for D-Bus. 1;;; dbus.el --- Elisp bindings for D-Bus.
2 2
3;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 3;; Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
4 4
5;; Author: Michael Albinus <michael.albinus@gmx.de> 5;; Author: Michael Albinus <michael.albinus@gmx.de>
6;; Keywords: comm, hardware 6;; Keywords: comm, hardware
@@ -868,21 +868,23 @@ name of the property, and its value. If there are no properties,
868 (add-to-list 'result (cons (car dict) (caadr dict)) 'append))))) 868 (add-to-list 'result (cons (car dict) (caadr dict)) 'append)))))
869 869
870(defun dbus-register-property 870(defun dbus-register-property
871 (bus service path interface property access value &optional emits-signal) 871 (bus service path interface property access value
872 &optional emits-signal dont-register-service)
872 "Register property PROPERTY on the D-Bus BUS. 873 "Register property PROPERTY on the D-Bus BUS.
873 874
874BUS is either a Lisp symbol, `:system' or `:session', or a string 875BUS is either a Lisp symbol, `:system' or `:session', or a string
875denoting the bus address. 876denoting the bus address.
876 877
877SERVICE is the D-Bus service name of the D-Bus. It must be a 878SERVICE is the D-Bus service name of the D-Bus. It must be a
878known name. 879known name (See discussion of DONT-REGISTER-SERVICE below).
879 880
880PATH is the D-Bus object path SERVICE is registered. INTERFACE 881PATH is the D-Bus object path SERVICE is registered (See
881is the name of the interface used at PATH, PROPERTY is the name 882discussion of DONT-REGISTER-SERVICE below). INTERFACE is the
882of the property of INTERFACE. ACCESS indicates, whether the 883name of the interface used at PATH, PROPERTY is the name of the
883property can be changed by other services via D-Bus. It must be 884property of INTERFACE. ACCESS indicates, whether the property
884either the symbol `:read' or `:readwrite'. VALUE is the initial 885can be changed by other services via D-Bus. It must be either
885value of the property, it can be of any valid type (see 886the symbol `:read' or `:readwrite'. VALUE is the initial value
887of the property, it can be of any valid type (see
886`dbus-call-method' for details). 888`dbus-call-method' for details).
887 889
888If PROPERTY already exists on PATH, it will be overwritten. For 890If PROPERTY already exists on PATH, it will be overwritten. For
@@ -894,12 +896,20 @@ The interface \"org.freedesktop.DBus.Properties\" is added to
894PATH, including a default handler for the \"Get\", \"GetAll\" and 896PATH, including a default handler for the \"Get\", \"GetAll\" and
895\"Set\" methods of this interface. When EMITS-SIGNAL is non-nil, 897\"Set\" methods of this interface. When EMITS-SIGNAL is non-nil,
896the signal \"PropertiesChanged\" is sent when the property is 898the signal \"PropertiesChanged\" is sent when the property is
897changed by `dbus-set-property'." 899changed by `dbus-set-property'.
900
901When DONT-REGISTER-SERVICE is non-nil, the known name SERVICE is
902not registered. This means that other D-Bus clients have no way
903of noticing the newly registered property. When interfaces are
904constructed incrementally by adding single methods or properties
905at a time, DONT-REGISTER-SERVICE can be used to prevent other
906clients from discovering the still incomplete interface."
898 (unless (member access '(:read :readwrite)) 907 (unless (member access '(:read :readwrite))
899 (signal 'dbus-error (list "Access type invalid" access))) 908 (signal 'dbus-error (list "Access type invalid" access)))
900 909
901 ;; Register SERVICE. 910 ;; Register SERVICE.
902 (unless (member service (dbus-list-names bus)) 911 (unless (or dont-register-service
912 (member service (dbus-list-names bus)))
903 (dbus-call-method 913 (dbus-call-method
904 bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus 914 bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
905 "RequestName" service 0)) 915 "RequestName" service 0))
@@ -907,11 +917,14 @@ changed by `dbus-set-property'."
907 ;; Add the handler. We use `dbus-service-emacs' as service name, in 917 ;; Add the handler. We use `dbus-service-emacs' as service name, in
908 ;; order to let unregister SERVICE despite of this default handler. 918 ;; order to let unregister SERVICE despite of this default handler.
909 (dbus-register-method 919 (dbus-register-method
910 bus service path dbus-interface-properties "Get" 'dbus-property-handler) 920 bus service path dbus-interface-properties "Get" 'dbus-property-handler
921 dont-register-service)
911 (dbus-register-method 922 (dbus-register-method
912 bus service path dbus-interface-properties "GetAll" 'dbus-property-handler) 923 bus service path dbus-interface-properties "GetAll" 'dbus-property-handler
924 dont-register-service)
913 (dbus-register-method 925 (dbus-register-method
914 bus service path dbus-interface-properties "Set" 'dbus-property-handler) 926 bus service path dbus-interface-properties "Set" 'dbus-property-handler
927 dont-register-service)
915 928
916 ;; Send the PropertiesChanged signal. 929 ;; Send the PropertiesChanged signal.
917 (when emits-signal 930 (when emits-signal