diff options
| author | Michael Albinus | 2011-01-04 12:11:43 +0100 |
|---|---|---|
| committer | Michael Albinus | 2011-01-04 12:11:43 +0100 |
| commit | 6ed843e5b8491893034ef76319eaabc9f485cf70 (patch) | |
| tree | 190be352d95489764aeb0be544e529104039ac9e /src | |
| parent | 6388924af0960495b2aedc637544b532cabd44a7 (diff) | |
| download | emacs-6ed843e5b8491893034ef76319eaabc9f485cf70.tar.gz emacs-6ed843e5b8491893034ef76319eaabc9f485cf70.zip | |
* dbusbind.c (Fdbus_register_method): Added optional parameter
dont_register_service. Updated docstring accordingly.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/dbusbind.c | 48 |
2 files changed, 36 insertions, 17 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d97f59273cf..d2ad0afc7cd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-01-04 Jan Moringen <jan.moringen@uni-bielefeld.de> | ||
| 2 | |||
| 3 | * dbusbind.c (Fdbus_register_method): Added optional parameter | ||
| 4 | dont_register_service. Updated docstring accordingly. | ||
| 5 | |||
| 1 | 2011-01-04 Glenn Morris <rgm@gnu.org> | 6 | 2011-01-04 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * emacs.c (emacs_copyright): Update short copyright year to 2011. | 8 | * emacs.c (emacs_copyright): Update short copyright year to 2011. |
diff --git a/src/dbusbind.c b/src/dbusbind.c index 6ab976b58da..4ef962d1507 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Elisp bindings for D-Bus. | 1 | /* Elisp bindings for D-Bus. |
| 2 | Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | 2 | Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
| @@ -1983,21 +1983,32 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG | |||
| 1983 | } | 1983 | } |
| 1984 | 1984 | ||
| 1985 | DEFUN ("dbus-register-method", Fdbus_register_method, Sdbus_register_method, | 1985 | DEFUN ("dbus-register-method", Fdbus_register_method, Sdbus_register_method, |
| 1986 | 6, 6, 0, | 1986 | 6, 7, 0, |
| 1987 | doc: /* Register for method METHOD on the D-Bus BUS. | 1987 | doc: /* Register for method METHOD on the D-Bus BUS. |
| 1988 | 1988 | ||
| 1989 | BUS is either a Lisp symbol, `:system' or `:session', or a string | 1989 | BUS is either a Lisp symbol, `:system' or `:session', or a string |
| 1990 | denoting the bus address. | 1990 | denoting the bus address. |
| 1991 | 1991 | ||
| 1992 | SERVICE is the D-Bus service name of the D-Bus object METHOD is | 1992 | SERVICE is the D-Bus service name of the D-Bus object METHOD is |
| 1993 | registered for. It must be a known name. | 1993 | registered for. It must be a known name (See discussion of |
| 1994 | 1994 | DONT-REGISTER-SERVICE below). | |
| 1995 | PATH is the D-Bus object path SERVICE is registered. INTERFACE is the | 1995 | |
| 1996 | interface offered by SERVICE. It must provide METHOD. HANDLER is a | 1996 | PATH is the D-Bus object path SERVICE is registered (See discussion of |
| 1997 | Lisp function to be called when a method call is received. It must | 1997 | DONT-REGISTER-SERVICE below). INTERFACE is the interface offered by |
| 1998 | accept the input arguments of METHOD. The return value of HANDLER is | 1998 | SERVICE. It must provide METHOD. HANDLER is a Lisp function to be |
| 1999 | used for composing the returning D-Bus message. */) | 1999 | called when a method call is received. It must accept the input |
| 2000 | (Lisp_Object bus, Lisp_Object service, Lisp_Object path, Lisp_Object interface, Lisp_Object method, Lisp_Object handler) | 2000 | arguments of METHOD. The return value of HANDLER is used for |
| 2001 | composing the returning D-Bus message. | ||
| 2002 | |||
| 2003 | When DONT-REGISTER-SERVICE is non-nil, the known name SERVICE is not | ||
| 2004 | registered. This means that other D-Bus clients have no way of | ||
| 2005 | noticing the newly registered method. When interfaces are constructed | ||
| 2006 | incrementally by adding single methods or properties at a time, | ||
| 2007 | DONT-REGISTER-SERVICE can be use to prevent other clients from | ||
| 2008 | discovering the still incomplete interface.*/) | ||
| 2009 | (Lisp_Object bus, Lisp_Object service, Lisp_Object path, | ||
| 2010 | Lisp_Object interface, Lisp_Object method, Lisp_Object handler, | ||
| 2011 | Lisp_Object dont_register_service) | ||
| 2001 | { | 2012 | { |
| 2002 | Lisp_Object key, key1, value; | 2013 | Lisp_Object key, key1, value; |
| 2003 | DBusConnection *connection; | 2014 | DBusConnection *connection; |
| @@ -2019,10 +2030,16 @@ used for composing the returning D-Bus message. */) | |||
| 2019 | 2030 | ||
| 2020 | /* Request the known name from the bus. We can ignore the result, | 2031 | /* Request the known name from the bus. We can ignore the result, |
| 2021 | it is set to -1 if there is an error - kind of redundancy. */ | 2032 | it is set to -1 if there is an error - kind of redundancy. */ |
| 2022 | dbus_error_init (&derror); | 2033 | if (NILP (dont_register_service)) |
| 2023 | result = dbus_bus_request_name (connection, SDATA (service), 0, &derror); | 2034 | { |
| 2024 | if (dbus_error_is_set (&derror)) | 2035 | dbus_error_init (&derror); |
| 2025 | XD_ERROR (derror); | 2036 | result = dbus_bus_request_name (connection, SDATA (service), 0, &derror); |
| 2037 | if (dbus_error_is_set (&derror)) | ||
| 2038 | XD_ERROR (derror); | ||
| 2039 | |||
| 2040 | /* Cleanup. */ | ||
| 2041 | dbus_error_free (&derror); | ||
| 2042 | } | ||
| 2026 | 2043 | ||
| 2027 | /* Create a hash table entry. We use nil for the unique name, | 2044 | /* Create a hash table entry. We use nil for the unique name, |
| 2028 | because the method might be called from anybody. */ | 2045 | because the method might be called from anybody. */ |
| @@ -2033,9 +2050,6 @@ used for composing the returning D-Bus message. */) | |||
| 2033 | if (NILP (Fmember (key1, value))) | 2050 | if (NILP (Fmember (key1, value))) |
| 2034 | Fputhash (key, Fcons (key1, value), Vdbus_registered_objects_table); | 2051 | Fputhash (key, Fcons (key1, value), Vdbus_registered_objects_table); |
| 2035 | 2052 | ||
| 2036 | /* Cleanup. */ | ||
| 2037 | dbus_error_free (&derror); | ||
| 2038 | |||
| 2039 | /* Return object. */ | 2053 | /* Return object. */ |
| 2040 | return list2 (key, list3 (service, path, handler)); | 2054 | return list2 (key, list3 (service, path, handler)); |
| 2041 | } | 2055 | } |