aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Albinus2011-01-04 12:11:43 +0100
committerMichael Albinus2011-01-04 12:11:43 +0100
commit6ed843e5b8491893034ef76319eaabc9f485cf70 (patch)
tree190be352d95489764aeb0be544e529104039ac9e /src
parent6388924af0960495b2aedc637544b532cabd44a7 (diff)
downloademacs-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/ChangeLog5
-rw-r--r--src/dbusbind.c48
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 @@
12011-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
12011-01-04 Glenn Morris <rgm@gnu.org> 62011-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
4This file is part of GNU Emacs. 4This 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
1985DEFUN ("dbus-register-method", Fdbus_register_method, Sdbus_register_method, 1985DEFUN ("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
1989BUS is either a Lisp symbol, `:system' or `:session', or a string 1989BUS is either a Lisp symbol, `:system' or `:session', or a string
1990denoting the bus address. 1990denoting the bus address.
1991 1991
1992SERVICE is the D-Bus service name of the D-Bus object METHOD is 1992SERVICE is the D-Bus service name of the D-Bus object METHOD is
1993registered for. It must be a known name. 1993registered for. It must be a known name (See discussion of
1994 1994DONT-REGISTER-SERVICE below).
1995PATH is the D-Bus object path SERVICE is registered. INTERFACE is the 1995
1996interface offered by SERVICE. It must provide METHOD. HANDLER is a 1996PATH is the D-Bus object path SERVICE is registered (See discussion of
1997Lisp function to be called when a method call is received. It must 1997DONT-REGISTER-SERVICE below). INTERFACE is the interface offered by
1998accept the input arguments of METHOD. The return value of HANDLER is 1998SERVICE. It must provide METHOD. HANDLER is a Lisp function to be
1999used for composing the returning D-Bus message. */) 1999called 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) 2000arguments of METHOD. The return value of HANDLER is used for
2001composing the returning D-Bus message.
2002
2003When DONT-REGISTER-SERVICE is non-nil, the known name SERVICE is not
2004registered. This means that other D-Bus clients have no way of
2005noticing the newly registered method. When interfaces are constructed
2006incrementally by adding single methods or properties at a time,
2007DONT-REGISTER-SERVICE can be use to prevent other clients from
2008discovering 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}