diff options
| author | Michael Albinus | 2011-01-04 11:57:24 +0100 |
|---|---|---|
| committer | Michael Albinus | 2011-01-04 11:57:24 +0100 |
| commit | 6388924af0960495b2aedc637544b532cabd44a7 (patch) | |
| tree | e00fac3c60bbb43d8f22a69a968d5cdf14f94610 | |
| parent | c3e4b003c22fc5c343d0d1736f43405aeec650e6 (diff) | |
| download | emacs-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/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/net/dbus.el | 43 |
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 @@ | |||
| 1 | 2011-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 | |||
| 1 | 2011-01-04 Andreas Schwab <schwab@linux-m68k.org> | 6 | 2011-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 | ||
| 874 | BUS is either a Lisp symbol, `:system' or `:session', or a string | 875 | BUS is either a Lisp symbol, `:system' or `:session', or a string |
| 875 | denoting the bus address. | 876 | denoting the bus address. |
| 876 | 877 | ||
| 877 | SERVICE is the D-Bus service name of the D-Bus. It must be a | 878 | SERVICE is the D-Bus service name of the D-Bus. It must be a |
| 878 | known name. | 879 | known name (See discussion of DONT-REGISTER-SERVICE below). |
| 879 | 880 | ||
| 880 | PATH is the D-Bus object path SERVICE is registered. INTERFACE | 881 | PATH is the D-Bus object path SERVICE is registered (See |
| 881 | is the name of the interface used at PATH, PROPERTY is the name | 882 | discussion of DONT-REGISTER-SERVICE below). INTERFACE is the |
| 882 | of the property of INTERFACE. ACCESS indicates, whether the | 883 | name of the interface used at PATH, PROPERTY is the name of the |
| 883 | property can be changed by other services via D-Bus. It must be | 884 | property of INTERFACE. ACCESS indicates, whether the property |
| 884 | either the symbol `:read' or `:readwrite'. VALUE is the initial | 885 | can be changed by other services via D-Bus. It must be either |
| 885 | value of the property, it can be of any valid type (see | 886 | the symbol `:read' or `:readwrite'. VALUE is the initial value |
| 887 | of the property, it can be of any valid type (see | ||
| 886 | `dbus-call-method' for details). | 888 | `dbus-call-method' for details). |
| 887 | 889 | ||
| 888 | If PROPERTY already exists on PATH, it will be overwritten. For | 890 | If PROPERTY already exists on PATH, it will be overwritten. For |
| @@ -894,12 +896,20 @@ The interface \"org.freedesktop.DBus.Properties\" is added to | |||
| 894 | PATH, including a default handler for the \"Get\", \"GetAll\" and | 896 | PATH, 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, |
| 896 | the signal \"PropertiesChanged\" is sent when the property is | 898 | the signal \"PropertiesChanged\" is sent when the property is |
| 897 | changed by `dbus-set-property'." | 899 | changed by `dbus-set-property'. |
| 900 | |||
| 901 | When DONT-REGISTER-SERVICE is non-nil, the known name SERVICE is | ||
| 902 | not registered. This means that other D-Bus clients have no way | ||
| 903 | of noticing the newly registered property. When interfaces are | ||
| 904 | constructed incrementally by adding single methods or properties | ||
| 905 | at a time, DONT-REGISTER-SERVICE can be used to prevent other | ||
| 906 | clients 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 |