* DBus methods without name grabbing
@ 2011-01-02 21:06 Jan Moringen
2011-01-03 12:55 ` Michael Albinus
0 siblings, 1 reply; 13+ messages in thread
From: Jan Moringen @ 2011-01-02 21:06 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1072 bytes --]
Hi,
recently I ran into the following DBus-related problem: In order to
write a telepathy client [1], it is required to provide a certain
DBus-Interface under a special well-known name. Some telepathy component
seems to start calling methods immediately after the well-known name is
taken. Since the interface consists of multiple methods/properties, it
cannot be ensured that the interface is completely available when the
name is taken and the first calls are made using Emacs' current
DBus-interface. This is due to the fact that the function
`dbus-register-method' immediately takes the name.
To allow Emacs to work with this kind of DBus-interfaces, I suggest the
changes implemented in the attached patch. I don't known the Emacs C
code well very well, so it probably needs revision.
An example for which this change is necessary can be found in the
function `telepathy-client-register' in the attached file client.el from
my telepathy bindings.
Do you think this patch could be applied?
Kind regards,
Jan
[1] http://telepathy.freedesktop.org/spec/Client.html
[-- Attachment #2: dbus-dont-request-name.diff --]
[-- Type: text/x-patch, Size: 3732 bytes --]
=== modified file 'lisp/net/dbus.el'
--- lisp/net/dbus.el 2010-08-30 13:03:05 +0000
+++ lisp/net/dbus.el 2010-10-03 02:25:51 +0000
@@ -868,7 +868,8 @@
(add-to-list 'result (cons (car dict) (caadr dict)) 'append)))))
(defun dbus-register-property
- (bus service path interface property access value &optional emits-signal)
+ (bus service path interface property access value
+ &optional emits-signal dont-request-name)
"Register property PROPERTY on the D-Bus BUS.
BUS is either a Lisp symbol, `:system' or `:session', or a string
@@ -899,7 +900,8 @@
(signal 'dbus-error (list "Access type invalid" access)))
;; Register SERVICE.
- (unless (member service (dbus-list-names bus))
+ (unless (or dont-request-name
+ (member service (dbus-list-names bus)))
(dbus-call-method
bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
"RequestName" service 0))
@@ -907,11 +909,14 @@
;; Add the handler. We use `dbus-service-emacs' as service name, in
;; order to let unregister SERVICE despite of this default handler.
(dbus-register-method
- bus service path dbus-interface-properties "Get" 'dbus-property-handler)
+ bus service path dbus-interface-properties "Get" 'dbus-property-handler
+ dont-request-name)
(dbus-register-method
- bus service path dbus-interface-properties "GetAll" 'dbus-property-handler)
+ bus service path dbus-interface-properties "GetAll" 'dbus-property-handler
+ dont-request-name)
(dbus-register-method
- bus service path dbus-interface-properties "Set" 'dbus-property-handler)
+ bus service path dbus-interface-properties "Set" 'dbus-property-handler
+ dont-request-name)
;; Send the PropertiesChanged signal.
(when emits-signal
=== modified file 'src/dbusbind.c'
--- src/dbusbind.c 2010-10-01 13:56:33 +0000
+++ src/dbusbind.c 2010-10-03 02:17:34 +0000
@@ -1947,7 +1947,7 @@
}
DEFUN ("dbus-register-method", Fdbus_register_method, Sdbus_register_method,
- 6, 6, 0,
+ 6, 7, 0,
doc: /* Register for method METHOD on the D-Bus BUS.
BUS is either a Lisp symbol, `:system' or `:session', or a string
@@ -1961,7 +1961,7 @@
Lisp function to be called when a method call is received. It must
accept the input arguments of METHOD. The return value of HANDLER is
used for composing the returning D-Bus message. */)
- (Lisp_Object bus, Lisp_Object service, Lisp_Object path, Lisp_Object interface, Lisp_Object method, Lisp_Object handler)
+ (Lisp_Object bus, Lisp_Object service, Lisp_Object path, Lisp_Object interface, Lisp_Object method, Lisp_Object handler, Lisp_Object dont_request_name)
{
Lisp_Object key, key1, value;
DBusConnection *connection;
@@ -1983,10 +1983,16 @@
/* Request the known name from the bus. We can ignore the result,
it is set to -1 if there is an error - kind of redundancy. */
- dbus_error_init (&derror);
- result = dbus_bus_request_name (connection, SDATA (service), 0, &derror);
- if (dbus_error_is_set (&derror))
- XD_ERROR (derror);
+ if (!dont_request_name || NILP (dont_request_name))
+ {
+ dbus_error_init (&derror);
+ result = dbus_bus_request_name (connection, SDATA (service), 0, &derror);
+ if (dbus_error_is_set (&derror))
+ XD_ERROR (derror);
+
+ /* Cleanup. */
+ dbus_error_free (&derror);
+ }
/* Create a hash table entry. We use nil for the unique name,
because the method might be called from anybody. */
@@ -1997,9 +2003,6 @@
if (NILP (Fmember (key1, value)))
Fputhash (key, Fcons (key1, value), Vdbus_registered_objects_table);
- /* Cleanup. */
- dbus_error_free (&derror);
-
/* Return object. */
return list2 (key, list3 (service, path, handler));
}
[-- Attachment #3: client.el --]
[-- Type: text/x-emacs-lisp, Size: 8494 bytes --]
;;; client.el ---
;;
;; Copyright (C) 2010, 2011 Jan Moringen
;;
;; Author: Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
;; Keywords: telepathy, communication, instant messaging
;;
;; This Program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This Program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses>.
\f
;;; Commentary:
;;
\f
;;; History:
;;
;; 0.1 - Initial version
\f
;;; Code:
;;
(require 'dbus)
(require 'telepathy/util)
\f
;;;
;;
(defconst telepathy-client-introspection-data
"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"
\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">
<node name=\"/org/freedesktop/Telepathy/Client/%s\">
<interface name=\"org.freedesktop.DBus.Introspectable\">
<method name=\"Introspect\">
<arg name=\"data\" direction=\"out\" type=\"s\"/>
</method>
</interface>
<interface name=\"org.freedesktop.DBus.Properties\">
<method name=\"Get\">
<arg name=\"interface\" direction=\"in\" type=\"s\"/>
<arg name=\"propname\" direction=\"in\" type=\"s\"/>
<arg name=\"value\" direction=\"out\" type=\"v\"/>
</method>
<method name=\"Set\">
<arg name=\"interface\" direction=\"in\" type=\"s\"/>
<arg name=\"propname\" direction=\"in\" type=\"s\"/>
<arg name=\"value\" direction=\"in\" type=\"v\"/>
</method>
<method name=\"GetAll\">
<arg name=\"interface\" direction=\"in\" type=\"s\"/>
<arg name=\"props\" direction=\"out\" type=\"a{sv}\"/>
</method>
</interface>
<interface name=\"org.freedesktop.Telepathy.Client.Handler\">
<method name=\"HandleChannels\">
<arg name=\"Account\" type=\"o\" direction=\"in\"/>
<arg name=\"Connection\" type=\"o\" direction=\"in\"/>
<arg name=\"Channels\" type=\"a(oa{sv})\" direction=\"in\"/>
<arg name=\"Requests_Satisfied\" type=\"ao\" direction=\"in\"/>
<arg name=\"User_Action_Time\" type=\"t\" direction=\"in\"/>
<arg name=\"Handler_Info\" type=\"a{sv}\" direction=\"in\"/>
</method>
</interface>
</node>"
"")
\f
;;;
;;
(defvar telepathy-client-handlers (make-hash-table :test 'equal)
"")
(defun telepathy-client-handler-services ()
""
(let ((result))
(maphash (lambda (key value) (push key result))
telepathy-client-handlers)
result))
(defun telepathy-client-add-handler (service handler &optional client)
""
(unless client
(setq client "Emacs"))
(unless (zerop (hash-table-count telepathy-client-handlers))
(telepathy-client-unregister client))
(puthash service handler telepathy-client-handlers)
(telepathy-client-register client))
(defun telepathy-client-remove-handler (service &optional client)
""
(unless client
(setq client "Emacs"))
(unless (zerop (hash-table-count telepathy-client-handlers))
(telepathy-client-unregister client))
(remhash service telepathy-client-handlers)
(unless (zerop (hash-table-count telepathy-client-handlers))
(telepathy-client-register client)))
\f
;;;
;;
(defun telepath-client-channel-handler (account connection-path channels &rest args)
""
(dolist (channel-data channels)
(let* ((connection (telepathy-make-remote-proxy-from-path
:session connection-path))
;; Analyze the properties of the channel.
(channel-properties (second channel-data))
(contact-handle (telepathy-prop-get
telepathy-key-target-handle channel-properties))
(contact (telepathy-make-contact
connection contact-handle))
(service (telepathy-prop-get
telepathy-key-service channel-properties))
(handler (gethash service telepathy-client-handlers))
;; Obtain object path of channel object.
(channel-path (first channel-data))
(channel-service (let ((bla (telepathy-path->service channel-path)))
(substring bla 0 (position ?. bla :from-end t))))
(channel-object (dbus-proxy-make-remote-proxy
:session channel-service channel-path
nil 'telepathy-tube))) ;; TODO could be a different kind of channel
(oset channel-object :contact contact)
(message "Channel")
(message " Path %s" channel-path)
(message " Service %s" service)
(message " Contact %s" contact)
(funcall handler channel-object)))
:ignore)
(defun telepathy-client-register (name)
""
;; Create a DBus object to handle tube requests.
(let ((service (format "org.freedesktop.Telepathy.Client.%s" name))
(path (format "/org/freedesktop/Telepathy/Client/%s" name)))
;; Install introspection information.
(lexical-let ((introspection-data
(format telepathy-client-introspection-data name)))
(dbus-register-method
:session service path
"org.freedesktop.DBus.Introspectable"
"Introspect"
(lambda (&rest args) introspection-data)
t)) ;; don't request the name, yet
;; Register all properties belonging to the handler object.
(dolist (name-and-value `(("HandlerChannelFilter"
,(mapcar
#'telepathy-client-make-channel-filter
(telepathy-client-handler-services)))
("BypassApproval" t) ;; TODO was nil
("Capabilities" (:array :signature "as"))
("HandledChannels" (:array :signature "ao"))))
(destructuring-bind (name value) name-and-value
(dbus-register-property
:session service path
"org.freedesktop.Telepathy.Client.Handler"
name :read value nil t))) ;; don't request the name, yet
;; TODO store the dbus objects for unregistering?
(dbus-register-method
:session service path
"org.freedesktop.Telepathy.Client.Handler"
"HandleChannels" #'telepath-client-channel-handler
t) ;; don't request the name, yet
(dbus-register-property
:session service path
"org.freedesktop.Telepathy.Client"
"Interfaces"
:read
'("org.freedesktop.Telepathy.Client.Handler")
nil t) ;; don't request the name, yet
;; Now that everything is in place, request the name.
(dbus-call-method
:session dbus-service-dbus dbus-path-dbus dbus-interface-dbus
"RequestName" service 0)))
;; (/org/freedesktop/Telepathy/Connection/gabble/jabber/scymtym_2dtest_40jabber_2eorg_2fbe153d1c/StreamTubeChannel_2_1273735221
;; ((org.freedesktop.Telepathy.Channel.InitiatorID
;; (scymtym@jabber.org))
;; (org.freedesktop.Telepathy.Channel.TargetHandleType
;; (1))
;; (org.freedesktop.Telepathy.Channel.TargetHandle
;; (2))
;; (org.freedesktop.Telepathy.Channel.TargetID
;; (scymtym@jabber.org))
;; (org.freedesktop.Telepathy.Channel.Requested
;; (nil))
;; (org.freedesktop.Telepathy.Channel.Type.StreamTube.SupportedSocketTypes
;; (((0 (0 3)) (2 (0 1)) (3 (0 1)))))
;; (org.freedesktop.Telepathy.Channel.Type.StreamTube.Service
;; (org.gnu.emacs.rudel.announce))
;; (org.freedesktop.Telepathy.Channel.Interface.Tube.Parameters
;; (nil))
;; (org.freedesktop.Telepathy.Channel.ChannelType
;; (org.freedesktop.Telepathy.Channel.Type.StreamTube))
;; (org.freedesktop.Telepathy.Channel.InitiatorHandle
;; (2))
;; (org.freedesktop.Telepathy.Channel.Interfaces
;; ((org.freedesktop.Telepathy.Channel.Interface.Tube)))))
(defun telepathy-client-unregister (name)
""
(dbus-unregister-service
:session
(format "org.freedesktop.Telepathy.Client.%s" name)))
\f
;;; Helper functions
;;
(defun telepathy-client-make-channel-filter (service)
""
`((:dict-entry
"org.freedesktop.Telepathy.Channel.ChannelType"
(:variant :string "org.freedesktop.Telepathy.Channel.Type.StreamTube"))
(:dict-entry
"org.freedesktop.Telepathy.Channel.TargetHandleType"
(:variant :uint32 1))
(:dict-entry
"org.freedesktop.Telepathy.Channel.Requested"
(:variant :boolean nil))
(:dict-entry
"org.freedesktop.Telepathy.Channel.Type.StreamTube.Service"
(:variant :string ,service))
))
(provide 'telepathy/client)
;;; client.el ends here
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: DBus methods without name grabbing
2011-01-02 21:06 DBus methods without name grabbing Jan Moringen
@ 2011-01-03 12:55 ` Michael Albinus
2011-01-04 2:42 ` Jan Moringen
0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2011-01-03 12:55 UTC (permalink / raw)
To: Jan Moringen; +Cc: emacs-devel
Jan Moringen <jan.moringen@uni-bielefeld.de> writes:
> Hi,
Hi Jan,
> recently I ran into the following DBus-related problem: In order to
> write a telepathy client [1], it is required to provide a certain
> DBus-Interface under a special well-known name. Some telepathy component
> seems to start calling methods immediately after the well-known name is
> taken. Since the interface consists of multiple methods/properties, it
> cannot be ensured that the interface is completely available when the
> name is taken and the first calls are made using Emacs' current
> DBus-interface. This is due to the fact that the function
> `dbus-register-method' immediately takes the name.
In general, I agree with your proposal. I have some few comments:
- The optional parameter in `dbus-register-method' and
`dbus-register-property' shall be called `dont-register-service'. This
would fit the dbus terminology we use so far.
- We might introduce a new function `dbus-register-service' (in dbusbind.c).
It could offer optional argument flags, a list of the supported flags
of "org.freedesktop.DBus.RequestName"
(DBUS_NAME_FLAG_ALLOW_REPLACEMENT, DBUS_NAME_FLAG_REPLACE_EXISTING,
DBUS_NAME_FLAG_DO_NOT_QUEUE). This function shall be called in
`dbus-register-method' and `dbus-register-property' when
`dont-register-service' is nil. Btw, the function
`dbus-unregister-service' exists already ...
- It would be great, if you could add also changed doc strings, changed
dbus.texi, ChangeLog and etc/NEWS entries.
> To allow Emacs to work with this kind of DBus-interfaces, I suggest the
> changes implemented in the attached patch. I don't known the Emacs C
> code well very well, so it probably needs revision.
>
> === modified file 'src/dbusbind.c'
> --- src/dbusbind.c 2010-10-01 13:56:33 +0000
> +++ src/dbusbind.c 2010-10-03 02:17:34 +0000
> @@ -1983,10 +1983,16 @@
>
> /* Request the known name from the bus. We can ignore the result,
> it is set to -1 if there is an error - kind of redundancy. */
> - dbus_error_init (&derror);
> - result = dbus_bus_request_name (connection, SDATA (service), 0, &derror);
> - if (dbus_error_is_set (&derror))
> - XD_ERROR (derror);
> + if (!dont_request_name || NILP (dont_request_name))
dont_request_name is a Lisp object, it is nil when not used in the
call. You shall use
if (NILP (dont_request_name))
Best regards, Michael.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: DBus methods without name grabbing
2011-01-03 12:55 ` Michael Albinus
@ 2011-01-04 2:42 ` Jan Moringen
2011-01-04 10:10 ` Michael Albinus
0 siblings, 1 reply; 13+ messages in thread
From: Jan Moringen @ 2011-01-04 2:42 UTC (permalink / raw)
To: Michael Albinus; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1837 bytes --]
Hi Michael,
thanks for the helpful reply.
An updated patch is attached.
There seems to be some oddities concerning the ChangeLog, I don't know
where these come from.
> In general, I agree with your proposal. I have some few comments:
>
> - The optional parameter in `dbus-register-method' and
> `dbus-register-property' shall be called `dont-register-service'. This
> would fit the dbus terminology we use so far.
Done.
> - We might introduce a new function `dbus-register-service' (in dbusbind.c).
> It could offer optional argument flags, a list of the supported flags
> of "org.freedesktop.DBus.RequestName"
> (DBUS_NAME_FLAG_ALLOW_REPLACEMENT, DBUS_NAME_FLAG_REPLACE_EXISTING,
> DBUS_NAME_FLAG_DO_NOT_QUEUE). This function shall be called in
> `dbus-register-method' and `dbus-register-property' when
> `dont-register-service' is nil. Btw, the function
> `dbus-unregister-service' exists already ...
I would rather tackle this change in a separate patch later.
> - It would be great, if you could add also changed doc strings, changed
> dbus.texi, ChangeLog and etc/NEWS entries.
Done.
> > === modified file 'src/dbusbind.c'
> > --- src/dbusbind.c 2010-10-01 13:56:33 +0000
> > +++ src/dbusbind.c 2010-10-03 02:17:34 +0000
> > @@ -1983,10 +1983,16 @@
> >
> > /* Request the known name from the bus. We can ignore the result,
> > it is set to -1 if there is an error - kind of redundancy. */
> > - dbus_error_init (&derror);
> > - result = dbus_bus_request_name (connection, SDATA (service), 0, &derror);
> > - if (dbus_error_is_set (&derror))
> > - XD_ERROR (derror);
> > + if (!dont_request_name || NILP (dont_request_name))
>
> dont_request_name is a Lisp object, it is nil when not used in the
> call. You shall use
>
> if (NILP (dont_request_name))
Done.
Kind regards,
Jan
[-- Attachment #2: dbus-dont-register-service.patch --]
[-- Type: text/x-patch, Size: 16782 bytes --]
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: jan.moringen@uni-bielefeld.de-20110104023841-\
# k6faivnl513kq9ng
# target_branch: bzr://bzr.savannah.gnu.org/emacs/trunk/
# testament_sha1: f899596030b46b47165b0dff53cb9e67f28ceaff
# timestamp: 2011-01-04 03:40:18 +0100
# base_revision_id: yamaoka@jpl.org-20110104022415-mkhshvn1pqc40zw6
#
# Begin patch
=== modified file 'doc/misc/dbus.texi'
--- doc/misc/dbus.texi 2010-11-10 08:41:53 +0000
+++ doc/misc/dbus.texi 2011-01-04 02:38:41 +0000
@@ -1264,7 +1264,7 @@
string.
@end deffn
-@defun dbus-register-method bus service path interface method handler
+@defun dbus-register-method bus service path interface method handler dont-register-service
With this function, an application registers @var{method} on the D-Bus
@var{bus}.
@@ -1272,10 +1272,11 @@
@code{:session}.
@var{service} is the D-Bus service name of the D-Bus object
-@var{method} is registered for. It must be a known name.
+@var{method} is registered for. It must be a known name (See
+discussion of @var{dont-register-service} below).
-@var{path} is the D-Bus object path @var{service} is
-registered.
+@var{path} is the D-Bus object path @var{service} is registered (See
+discussion of @var{dont-register-service} below).
@var{interface} is the interface offered by @var{service}. It must
provide @var{method}.
@@ -1294,6 +1295,13 @@
In case @var{handler} shall return a reply message with an empty
argument list, @var{handler} must return the symbol @code{:ignore}.
+When @var{dont-register-service} is non-nil, the known name
+@var{service} is not registered. This means that other D-Bus clients
+have no way of noticing the newly registered method. When interfaces
+are constructed incrementally by adding single methods or properties
+at a time, @var{dont-register-service} can be use to prevent other
+clients from discovering the still incomplete interface.
+
The default D-Bus timeout when waiting for a message reply is 25
seconds. This value could be even smaller, depending on the calling
client. Therefore, @var{handler} shall not last longer than
=== modified file 'etc/NEWS'
--- etc/NEWS 2011-01-03 01:18:33 +0000
+++ etc/NEWS 2011-01-04 02:38:41 +0000
@@ -1,6 +1,6 @@
GNU Emacs NEWS -- history of user-visible changes.
-Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
See the end of the file for license conditions.
Please send Emacs bug reports to bug-gnu-emacs@gnu.org.
@@ -556,7 +556,7 @@
*** It is possible now, to access alternative buses than the default
system or session bus.
-
+*** dbus-register-{method,property} do not necessarily register names anymore
** Tramp
*** There exists a new inline access method "ksu" (kerberized su).
@@ -713,8 +713,8 @@
*** If Emacs is compiled with libxml2 support (which is the default),
two new Emacs Lisp-level functions are defined:
-`libxml-parse-html-region' (which will parse "real world" HTML)
-and `libxml-parse-xml-region' (which parses XML). Both return an
+`xml-parse-html-string-internal' (which will parse "real world" HTML)
+and `xml-parse-string-internal' (which parses XML). Both return an
Emacs Lisp parse tree.
FIXME: These should be front-ended by xml.el.
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog 2011-01-03 20:50:05 +0000
+++ lisp/ChangeLog 2011-01-04 02:38:41 +0000
@@ -1,3 +1,8 @@
+2011-01-04 Jan Moringen <jan.moringen@uni-bielefeld.de>
+
+ * net/dbus.el (dbus-register-property): Added optional parameter
+ dont-register-service. Updated docstring accordingly.
+
2011-01-02 Eli Zaretskii <eliz@gnu.org>
* term/w32-win.el (dynamic-library-alist): Set up correctly for
@@ -114,13 +119,6 @@
* mail/mail-utils.el (mail-mbox-from): Handle From: headers with
multiple addresses. (Bug#7760)
-2011-01-01 Ken Manheimer <ken.manheimer@gmail.com>
-
- allout.el (allout-auto-fill): Do not infinitely recurse - use
- do-auto-fill if everything points back to allout-auto-fill.
- (allout-mode-deactivate-hook): Declare obsolete, in favor of
- standard-formed minor-mode deactivate hook, allout-mode-off-hook.
-
2010-12-31 Michael Albinus <michael.albinus@gmx.de>
* net/tramp-sh.el (tramp-methods): Add recursive options to "scpc"
@@ -190,21 +188,6 @@
pretty-printed, so that it is mergeable by line-based text merging,
as suggested by Iain Dalton <iain.dalton {_AT_} gmail.com>.
-2010-12-28 Ken Manheimer <ken.manheimer@gmail.com>
-
- allout.el (allout-v18/19-file-var-hack): Obsolete, remove.
- (allout-mode): Argument "toggle" => "force".
- Refine the docstring.
- Remove special provisions for reactivation, besides the 'force'
- argument.
- Consolidate layout provisions coce directly into the activation
- condition branch, now that we've removed those provisions.
- (allout-unload-function): Explicitly activate the mode before
- deactivating, if it's initially deactivated.
- (allout-set-buffer-multibyte): Properly prevent byte-compiler
- warnings for version of function used only where
- set-buffer-multibyte is unavailable.
-
2010-12-28 Chong Yidong <cyd@stupidchicken.com>
* tool-bar.el (tool-bar-setup): Remove :enable conditions, which
=== modified file 'lisp/net/dbus.el'
--- lisp/net/dbus.el 2010-11-03 03:49:04 +0000
+++ lisp/net/dbus.el 2011-01-04 02:38:41 +0000
@@ -868,21 +868,23 @@
(add-to-list 'result (cons (car dict) (caadr dict)) 'append)))))
(defun dbus-register-property
- (bus service path interface property access value &optional emits-signal)
+ (bus service path interface property access value
+ &optional emits-signal dont-register-service)
"Register property PROPERTY on the D-Bus BUS.
BUS is either a Lisp symbol, `:system' or `:session', or a string
denoting the bus address.
SERVICE is the D-Bus service name of the D-Bus. It must be a
-known name.
+known name (See discussion of DONT-REGISTER-SERVICE below).
-PATH is the D-Bus object path SERVICE is registered. INTERFACE
-is the name of the interface used at PATH, PROPERTY is the name
-of the property of INTERFACE. ACCESS indicates, whether the
-property can be changed by other services via D-Bus. It must be
-either the symbol `:read' or `:readwrite'. VALUE is the initial
-value of the property, it can be of any valid type (see
+PATH is the D-Bus object path SERVICE is registered (See
+discussion of DONT-REGISTER-SERVICE below). INTERFACE is the
+name of the interface used at PATH, PROPERTY is the name of the
+property of INTERFACE. ACCESS indicates, whether the property
+can be changed by other services via D-Bus. It must be either
+the symbol `:read' or `:readwrite'. VALUE is the initial value
+of the property, it can be of any valid type (see
`dbus-call-method' for details).
If PROPERTY already exists on PATH, it will be overwritten. For
@@ -894,12 +896,20 @@
PATH, including a default handler for the \"Get\", \"GetAll\" and
\"Set\" methods of this interface. When EMITS-SIGNAL is non-nil,
the signal \"PropertiesChanged\" is sent when the property is
-changed by `dbus-set-property'."
+changed by `dbus-set-property'.
+
+When DONT-REGISTER-SERVICE is non-nil, the known name SERVICE is
+not registered. This means that other D-Bus clients have no way
+of noticing the newly registered property. When interfaces are
+constructed incrementally by adding single methods or properties
+at a time, DONT-REGISTER-SERVICE can be use to prevent other
+clients from discovering the still incomplete interface."
(unless (member access '(:read :readwrite))
(signal 'dbus-error (list "Access type invalid" access)))
;; Register SERVICE.
- (unless (member service (dbus-list-names bus))
+ (unless (or dont-register-service
+ (member service (dbus-list-names bus)))
(dbus-call-method
bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
"RequestName" service 0))
@@ -907,11 +917,14 @@
;; Add the handler. We use `dbus-service-emacs' as service name, in
;; order to let unregister SERVICE despite of this default handler.
(dbus-register-method
- bus service path dbus-interface-properties "Get" 'dbus-property-handler)
- (dbus-register-method
- bus service path dbus-interface-properties "GetAll" 'dbus-property-handler)
- (dbus-register-method
- bus service path dbus-interface-properties "Set" 'dbus-property-handler)
+ bus service path dbus-interface-properties "Get" 'dbus-property-handler
+ dont-register-service)
+ (dbus-register-method
+ bus service path dbus-interface-properties "GetAll" 'dbus-property-handler
+ dont-register-service)
+ (dbus-register-method
+ bus service path dbus-interface-properties "Set" 'dbus-property-handler
+ dont-register-service)
;; Send the PropertiesChanged signal.
(when emits-signal
=== modified file 'src/ChangeLog'
--- src/ChangeLog 2011-01-03 19:35:59 +0000
+++ src/ChangeLog 2011-01-04 02:38:41 +0000
@@ -1,7 +1,7 @@
-2011-01-03 Eli Zaretskii <eliz@gnu.org>
+2011-01-04 Jan Moringen <jan.moringen@uni-bielefeld.de>
- * image.c (png_jmpbuf): Remove definition.
- (my_png_error, png_load): Don't use png_jmpbuf.
+ * dbusbind.c (dbus-register-method): Added optional parameter
+ dont-register-service. Updated docstring accordingly.
2011-01-02 Eli Zaretskii <eliz@gnu.org>
=== modified file 'src/dbusbind.c'
--- src/dbusbind.c 2010-11-10 09:08:05 +0000
+++ src/dbusbind.c 2011-01-04 02:38:41 +0000
@@ -1983,21 +1983,30 @@
}
DEFUN ("dbus-register-method", Fdbus_register_method, Sdbus_register_method,
- 6, 6, 0,
+ 6, 7, 0,
doc: /* Register for method METHOD on the D-Bus BUS.
BUS is either a Lisp symbol, `:system' or `:session', or a string
denoting the bus address.
SERVICE is the D-Bus service name of the D-Bus object METHOD is
-registered for. It must be a known name.
-
-PATH is the D-Bus object path SERVICE is registered. INTERFACE is the
-interface offered by SERVICE. It must provide METHOD. HANDLER is a
-Lisp function to be called when a method call is received. It must
-accept the input arguments of METHOD. The return value of HANDLER is
-used for composing the returning D-Bus message. */)
- (Lisp_Object bus, Lisp_Object service, Lisp_Object path, Lisp_Object interface, Lisp_Object method, Lisp_Object handler)
+registered for. It must be a known name (See discussion of
+DONT-REGISTER-SERVICE below).
+
+PATH is the D-Bus object path SERVICE is registered (See discussion of
+DONT-REGISTER-SERVICE below). INTERFACE is the interface offered by
+SERVICE. It must provide METHOD. HANDLER is a Lisp function to be
+called when a method call is received. It must accept the input
+arguments of METHOD. The return value of HANDLER is used for
+composing the returning D-Bus message.
+
+When DONT-REGISTER-SERVICE is non-nil, the known name SERVICE is not
+registered. This means that other D-Bus clients have no way of
+noticing the newly registered method. When interfaces are constructed
+incrementally by adding single methods or properties at a time,
+DONT-REGISTER-SERVICE can be use to prevent other clients from
+discovering the still incomplete interface.*/)
+ (Lisp_Object bus, Lisp_Object service, Lisp_Object path, Lisp_Object interface, Lisp_Object method, Lisp_Object handler, Lisp_Object dont_register_service)
{
Lisp_Object key, key1, value;
DBusConnection *connection;
@@ -2019,10 +2028,16 @@
/* Request the known name from the bus. We can ignore the result,
it is set to -1 if there is an error - kind of redundancy. */
- dbus_error_init (&derror);
- result = dbus_bus_request_name (connection, SDATA (service), 0, &derror);
- if (dbus_error_is_set (&derror))
- XD_ERROR (derror);
+ if (NILP (dont_register_service))
+ {
+ dbus_error_init (&derror);
+ result = dbus_bus_request_name (connection, SDATA (service), 0, &derror);
+ if (dbus_error_is_set (&derror))
+ XD_ERROR (derror);
+
+ /* Cleanup. */
+ dbus_error_free (&derror);
+ }
/* Create a hash table entry. We use nil for the unique name,
because the method might be called from anybody. */
@@ -2033,9 +2048,6 @@
if (NILP (Fmember (key1, value)))
Fputhash (key, Fcons (key1, value), Vdbus_registered_objects_table);
- /* Cleanup. */
- dbus_error_free (&derror);
-
/* Return object. */
return list2 (key, list3 (service, path, handler));
}
# Begin bundle
IyBCYXphYXIgcmV2a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f+LuSKcKEhTJ/5Ng
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: DBus methods without name grabbing
2011-01-04 2:42 ` Jan Moringen
@ 2011-01-04 10:10 ` Michael Albinus
2011-01-04 10:29 ` Jan Moringen
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Michael Albinus @ 2011-01-04 10:10 UTC (permalink / raw)
To: Jan Moringen; +Cc: emacs-devel
Jan Moringen <jan.moringen@uni-bielefeld.de> writes:
> Hi Michael,
Hi Jan,
> An updated patch is attached.
Looks OK to me. Do you have commit rights, or shall I commit it for you?
>> - We might introduce a new function `dbus-register-service' (in dbusbind.c).
>> It could offer optional argument flags, a list of the supported flags
>> of "org.freedesktop.DBus.RequestName"
>> (DBUS_NAME_FLAG_ALLOW_REPLACEMENT, DBUS_NAME_FLAG_REPLACE_EXISTING,
>> DBUS_NAME_FLAG_DO_NOT_QUEUE). This function shall be called in
>> `dbus-register-method' and `dbus-register-property' when
>> `dont-register-service' is nil. Btw, the function
>> `dbus-unregister-service' exists already ...
>
> I would rather tackle this change in a separate patch later.
OK, I'll do it next days (except you want to do it yourself :-)
> Kind regards,
> Jan
Best regards, Michael.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: DBus methods without name grabbing
2011-01-04 10:10 ` Michael Albinus
@ 2011-01-04 10:29 ` Jan Moringen
2011-01-04 13:09 ` Michael Albinus
2011-01-05 4:17 ` Jan Moringen
[not found] ` <1294201048.2508.1.camel@gunhead>
2 siblings, 1 reply; 13+ messages in thread
From: Jan Moringen @ 2011-01-04 10:29 UTC (permalink / raw)
To: Michael Albinus; +Cc: emacs-devel, Jan Moringen
On Tue, 2011-01-04 at 11:10 +0100, Michael Albinus wrote:
> Jan Moringen <jan.moringen@uni-bielefeld.de> writes:
>
> > Hi Michael,
>
> Hi Jan,
>
> > An updated patch is attached.
>
> Looks OK to me. Do you have commit rights, or shall I commit it for you?
No and yes, please.
> >> - We might introduce a new function `dbus-register-service' (in dbusbind.c).
> >> It could offer optional argument flags, a list of the supported flags
> >> of "org.freedesktop.DBus.RequestName"
> >> (DBUS_NAME_FLAG_ALLOW_REPLACEMENT, DBUS_NAME_FLAG_REPLACE_EXISTING,
> >> DBUS_NAME_FLAG_DO_NOT_QUEUE). This function shall be called in
> >> `dbus-register-method' and `dbus-register-property' when
> >> `dont-register-service' is nil. Btw, the function
> >> `dbus-unregister-service' exists already ...
> >
> > I would rather tackle this change in a separate patch later.
>
> OK, I'll do it next days (except you want to do it yourself :-)
I would do it, but I don't know when I will get to it.
Kind regards,
Jan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: DBus methods without name grabbing
2011-01-04 10:29 ` Jan Moringen
@ 2011-01-04 13:09 ` Michael Albinus
0 siblings, 0 replies; 13+ messages in thread
From: Michael Albinus @ 2011-01-04 13:09 UTC (permalink / raw)
To: Jan Moringen; +Cc: emacs-devel, Jan Moringen
Jan Moringen <jmoringen@uni-bielefeld.de> writes:
Hi Jan,
>> Looks OK to me. Do you have commit rights, or shall I commit it for you?
>
> No and yes, please.
Done, with some minor tweakings.
>> > I would rather tackle this change in a separate patch later.
>>
>> OK, I'll do it next days (except you want to do it yourself :-)
>
> I would do it, but I don't know when I will get to it.
So I let it to you. That endorses my laziness ...
> Kind regards,
> Jan
Best regards, Michael.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: DBus methods without name grabbing
2011-01-04 10:10 ` Michael Albinus
2011-01-04 10:29 ` Jan Moringen
@ 2011-01-05 4:17 ` Jan Moringen
2011-01-05 11:45 ` Michael Albinus
[not found] ` <1294201048.2508.1.camel@gunhead>
2 siblings, 1 reply; 13+ messages in thread
From: Jan Moringen @ 2011-01-05 4:17 UTC (permalink / raw)
To: Michael Albinus; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 782 bytes --]
Hi Michael.
> >> - We might introduce a new function `dbus-register-service' (in dbusbind.c).
> >> It could offer optional argument flags, a list of the supported flags
> >> of "org.freedesktop.DBus.RequestName"
> >> (DBUS_NAME_FLAG_ALLOW_REPLACEMENT, DBUS_NAME_FLAG_REPLACE_EXISTING,
> >> DBUS_NAME_FLAG_DO_NOT_QUEUE). This function shall be called in
> >> `dbus-register-method' and `dbus-register-property' when
> >> `dont-register-service' is nil. Btw, the function
> >> `dbus-unregister-service' exists already ...
> >
> > I would rather tackle this change in a separate patch later.
>
> OK, I'll do it next days (except you want to do it yourself :-)
I gave it a shot. See attached patch. Like the last patch, this probably
needs revision.
Kind regards,
Jan
[-- Attachment #2: dbus-register-service.patch --]
[-- Type: text/x-patch, Size: 8026 bytes --]
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: jan.moringen@uni-bielefeld.de-20110105040922-\
# vc2ma9x9190gle92
# target_branch: bzr://bzr.savannah.gnu.org/emacs/trunk/
# testament_sha1: 951371c07f78adb5726378a78265e35c8e00f263
# timestamp: 2011-01-05 05:09:46 +0100
# base_revision_id: ken.manheimer@gmail.com-20110104195021-\
# 1x68s956czngphh2
#
# Begin patch
=== modified file 'doc/misc/dbus.texi'
--- doc/misc/dbus.texi 2011-01-04 12:38:33 +0000
+++ doc/misc/dbus.texi 2011-01-05 04:09:22 +0000
@@ -1491,6 +1491,16 @@
to the service from D-Bus.
@end defun
+@defun dbus-register-service bus service
+Register the known name @var{service} on D-Bus @var{bus}.
+
+@var{bus} is either the symbol @code{:system} or the symbol
+@code{:session}.
+
+@var{service} is the service name to be registered on the D-Bus. It
+must be a known name.
+@end defun
+
@defun dbus-unregister-service bus service
Unregister all objects from D-Bus @var{bus}, registered by Emacs for
@var{service}.
=== modified file 'etc/NEWS'
--- etc/NEWS 2011-01-04 16:57:45 +0000
+++ etc/NEWS 2011-01-05 04:09:22 +0000
@@ -558,7 +558,9 @@
system or session bus.
*** dbus-register-{method,property} do not necessarily register names anymore.
-
+*** New function dbus-register-service
+ Register a service known name on a D-Bus without simultaneously
+ registering a property or a method
** Tramp
*** There exists a new inline access method "ksu" (kerberized su).
=== modified file 'src/ChangeLog'
--- src/ChangeLog 2011-01-04 11:11:43 +0000
+++ src/ChangeLog 2011-01-05 04:09:22 +0000
@@ -1,3 +1,14 @@
+2011-01-05 Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
+
+ Added function dbus-register-service in dbusbind.c
+ * dbusbind.c (Qdbus_register_service): new variable; holds
+ function dbus-register-service
+ (Fdbus_register_service): new function; register a service known
+ name on a D-Bus
+ (Fdbus_register_method): use Fdbus_register_service to register
+ the service name
+ (syms_of_dbusbind): added symbol `dbus-register-service'
+
2011-01-04 Jan Moringen <jan.moringen@uni-bielefeld.de>
* dbusbind.c (Fdbus_register_method): Added optional parameter
=== modified file 'src/dbusbind.c'
--- src/dbusbind.c 2011-01-04 11:11:43 +0000
+++ src/dbusbind.c 2011-01-05 04:09:22 +0000
@@ -38,6 +38,7 @@
Lisp_Object Qdbus_method_return_internal;
Lisp_Object Qdbus_method_error_internal;
Lisp_Object Qdbus_send_signal;
+Lisp_Object Qdbus_register_service;
Lisp_Object Qdbus_register_signal;
Lisp_Object Qdbus_register_method;
@@ -1835,6 +1836,43 @@
xd_in_read_queued_messages = 0;
}
+DEFUN ("dbus-register-service", Fdbus_register_service, Sdbus_register_service,
+ 2, 2, 0,
+ doc: /* Register known name SERVICE on the D-Bus BUS.
+
+BUS is either a Lisp symbol, `:system' or `:session', or a string
+denoting the bus address.
+
+SERVICE is the D-Bus service name that should be registered. It must
+be a known name.
+
+Return nil.*/)
+ (Lisp_Object bus, Lisp_Object service)
+{
+ DBusConnection *connection;
+ int result;
+ DBusError derror;
+
+ /* Check parameters. */
+ CHECK_STRING (service);
+
+ /* Open a connection to the bus. */
+ connection = xd_initialize (bus, TRUE);
+
+ /* Request the known name from the bus. We can ignore the result,
+ it is set to -1 if there is an error - kind of redundancy. */
+ dbus_error_init (&derror);
+ result = dbus_bus_request_name (connection, SDATA (service), 0, &derror);
+ if (dbus_error_is_set (&derror))
+ XD_ERROR (derror);
+
+ /* Cleanup. */
+ dbus_error_free (&derror);
+
+ /* Return object. */
+ return Qnil;
+}
+
DEFUN ("dbus-register-signal", Fdbus_register_signal, Sdbus_register_signal,
6, MANY, 0,
doc: /* Register for signal SIGNAL on the D-Bus BUS.
@@ -2028,18 +2066,8 @@
/* Open a connection to the bus. */
connection = xd_initialize (bus, TRUE);
- /* Request the known name from the bus. We can ignore the result,
- it is set to -1 if there is an error - kind of redundancy. */
- if (NILP (dont_register_service))
- {
- dbus_error_init (&derror);
- result = dbus_bus_request_name (connection, SDATA (service), 0, &derror);
- if (dbus_error_is_set (&derror))
- XD_ERROR (derror);
-
- /* Cleanup. */
- dbus_error_free (&derror);
- }
+ /* Request the name. */
+ Fdbus_register_service (bus, service);
/* Create a hash table entry. We use nil for the unique name,
because the method might be called from anybody. */
@@ -2091,6 +2119,10 @@
staticpro (&Qdbus_send_signal);
defsubr (&Sdbus_send_signal);
+ Qdbus_register_service = intern_c_string ("dbus-register-service");
+ staticpro (&Qdbus_register_service);
+ defsubr (&Sdbus_register_service);
+
Qdbus_register_signal = intern_c_string ("dbus-register-signal");
staticpro (&Qdbus_register_signal);
defsubr (&Sdbus_register_signal);
# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWYWelv0ABIJfgGgwUff//3//
v8D////6YAlPl3vN3e068sjJbzK7ztm3fd3rmb10vb230fYSKSYIaptoCnk8p6mEQ9Q9NJkyNGRo
DRoBkEoU0TMTRqaamKeoMmgPU0eo02kDRoDRo0DIEomhlExCT9Kae0o0A0aAaBiYgAAaAEiQUanp
R4KfpQ2pmpozRDNRobSBoAPUAAG1JJPymk9TyZJhDRp6TTQaAAAAAAAEkQKYBGgTTBTUeTUzSeo0
NA9IGmgANPUpJBSAdvUdMUX17dO5F36BZEb+bPcnZI4BDr+9JNZYTwfR0+7inuCTc/G9+pk4M1dw
v30ZVGBIt7ItDGB/bCR+m/Op9va9VLsHZ4RnGVcLceQgkliJhb2By13ZBjvdGayjC7mGJdnVg280
oqbdyJbGtYXQypsYDbdJH1E0UvYl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js7OZedQZqZgwKkwMMC19UQhIJJmZBglu5c/FMIyTE8tQluM4MF2NxkLQZJkRC6o
1dJKtEKtZCkC6whsY8zhtDQb49Lk000hpTphJzZfyMcAN6Q57akiHGIX9jorhOumweSQaE+UbpwN
yRH9GkTOViSgpwnoaqTGmGgYF+3AXGmgzsFberJKLYxdQyYyFCIhRqknEB7ShEoKNQCBVUk0ArFh
XIO0tCAwZtxJIVaUKtc1G2QYMWF/0e3Hs7lVnXcasVIitYGeYV3wFmrt42RE0sJTl1rADMyR6GVg
0h7N7v05yOAj1GYLkrkw06OKqtZo8BEu84Vb/6V+6Kk6UtQLS1ldNS9q6xhgTMEU46SMrbSA/dGs
NQjgCqVoktKWQwSreiQEHF4hyEkVPaCTrqBNUXLnXWWoTFHmzITgFhM096RaEoYzyx/4u5IpwoSE
LPS36A==
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: DBus methods without name grabbing
[not found] ` <1294201048.2508.1.camel@gunhead>
@ 2011-01-05 10:46 ` Jan Moringen
0 siblings, 0 replies; 13+ messages in thread
From: Jan Moringen @ 2011-01-05 10:46 UTC (permalink / raw)
To: Michael Albinus; +Cc: emacs-devel
> > >> - We might introduce a new function `dbus-register-service' (in dbusbind.c).
> > >> It could offer optional argument flags, a list of the supported flags
> > >> of "org.freedesktop.DBus.RequestName"
> > >> (DBUS_NAME_FLAG_ALLOW_REPLACEMENT, DBUS_NAME_FLAG_REPLACE_EXISTING,
> > >> DBUS_NAME_FLAG_DO_NOT_QUEUE). This function shall be called in
> > >> `dbus-register-method' and `dbus-register-property' when
> > >> `dont-register-service' is nil. Btw, the function
> > >> `dbus-unregister-service' exists already ...
> > >
> > > I would rather tackle this change in a separate patch later.
> >
> > OK, I'll do it next days (except you want to do it yourself :-)
>
> I gave it a shot. See attached patch. Like the last patch, this probably
> needs revision.
I forgot to check dont_register_service in dbus_register_method, but I
can't make an updated patch right now.
Kind regards,
Jan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: DBus methods without name grabbing
2011-01-05 4:17 ` Jan Moringen
@ 2011-01-05 11:45 ` Michael Albinus
2011-01-08 5:48 ` Jan Moringen
0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2011-01-05 11:45 UTC (permalink / raw)
To: Jan Moringen; +Cc: emacs-devel
Jan Moringen <jan.moringen@uni-bielefeld.de> writes:
> Hi Michael.
Hi Jan,
> I gave it a shot. See attached patch. Like the last patch, this probably
> needs revision.
Thanks!
> --- doc/misc/dbus.texi 2011-01-04 12:38:33 +0000
> +++ doc/misc/dbus.texi 2011-01-05 04:09:22 +0000
> @@ -1491,6 +1491,16 @@
> to the service from D-Bus.
> @end defun
>
> +@defun dbus-register-service bus service
> +Register the known name @var{service} on D-Bus @var{bus}.
> +
> +@var{bus} is either the symbol @code{:system} or the symbol
> +@code{:session}.
> +
> +@var{service} is the service name to be registered on the D-Bus. It
> +must be a known name.
> +@end defun
> +
> @defun dbus-unregister-service bus service
> Unregister all objects from D-Bus @var{bus}, registered by Emacs for
> @var{service}.
Maybe we shall rearrange the whole node a little bit. In the
introductionary paragraph, service names could be described more
detailed, especially their registration policies. Afterwards,
dbus-register-service shall follow.
The explanation of dont-register-service in dbus-register-method and
dbus-register-property could be shortened, referring to the explanation
in dbus-register-service.
> --- etc/NEWS 2011-01-04 16:57:45 +0000
> +++ etc/NEWS 2011-01-05 04:09:22 +0000
> @@ -558,7 +558,9 @@
> *** dbus-register-{method,property} do not necessarily register names anymore.
> -
> +*** New function dbus-register-service
> + Register a service known name on a D-Bus without simultaneously
> + registering a property or a method
I guess we could join both entries.
> --- src/dbusbind.c 2011-01-04 11:11:43 +0000
> +++ src/dbusbind.c 2011-01-05 04:09:22 +0000
> +DEFUN ("dbus-register-service", Fdbus_register_service, Sdbus_register_service,
> + 2, 2, 0,
> + doc: /* Register known name SERVICE on the D-Bus BUS.
> +
> +BUS is either a Lisp symbol, `:system' or `:session', or a string
> +denoting the bus address.
> +
> +SERVICE is the D-Bus service name that should be registered. It must
> +be a known name.
> +
> +Return nil.*/)
> + (Lisp_Object bus, Lisp_Object service)
Your implementation looks OK to me. However, I have a more general
function in mind. Something like this:
--8<---------------cut here---------------start------------->8---
DEFUN ("dbus-register-service", Fdbus_register_service, Sdbus_register_service,
2, MANY, 0, doc: /* Register known name SERVICE on the D-Bus BUS.
BUS is either a Lisp symbol, `:system' or `:session', or a string
denoting the bus address.
SERVICE is the D-Bus service name that should be registered.
FLAGS are integers, which control how the service name is registered.
The following integer constants could be used:
`dbus-service-allow-replacement': Allow another service to become the
primary owner if requested.
`dbus-service-replace-existing': Request to replace the current
primary owner.
`dbus-service-do-not-queue': If we can not become the primary owner do
not place us in the queue.
The function returns an integer, indicating the result of the
operation. There are predefined constants to check:
`dbus-service-primary-owner': Service has become the primary owner of
the requested name.
`dbus-service-in-queue': Service could not become the primary owner
and has been placed in the queue.
`dbus-service-exists': Service is already in the queue.
`dbus-service-already-owner': Service is already the primary owner.
Example:
\(dbus-register-service :session dbus-service-emacs)
=> 1 ;; This is `dbus-service-primary-owner'.
\(dbus-register-service
:session "org.freedesktop.TextEditor"
dbus-service-allow-replacement dbus-service-replace-existing)
=> 4 ;; This is `dbus-service-already-owner'.
usage: (dbus-register-service BUS SERVICE &rest FLAGS) */)
(int nargs, register Lisp_Object *args)
--8<---------------cut here---------------end--------------->8---
The constants shall be declared as well, for initialization you could
use DBUS_NAME_FLAG* and DBUS_REQUEST_NAME_REPLY* from dbus-shared.h.
And while we are at this, maybe dbus-unregister-service could also
return a similar result, based on DBUS_RELEASE_NAME_REPLY*.
> @@ -2028,18 +2066,8 @@
> + /* Request the name. */
> + Fdbus_register_service (bus, service);
As you have said the other message, the check for dont-register-service
is missing.
Furthermore, I would also propose to use dbus-register-service in
dbus-register-property (in dbus.el).
> Kind regards,
> Jan
Best regards, Michael.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: DBus methods without name grabbing
2011-01-05 11:45 ` Michael Albinus
@ 2011-01-08 5:48 ` Jan Moringen
2011-01-09 9:42 ` Michael Albinus
0 siblings, 1 reply; 13+ messages in thread
From: Jan Moringen @ 2011-01-08 5:48 UTC (permalink / raw)
To: Michael Albinus; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 4798 bytes --]
Hi,
I finally got to improving my patch. Feedback would be appreciated.
> > --- doc/misc/dbus.texi 2011-01-04 12:38:33 +0000
> > +++ doc/misc/dbus.texi 2011-01-05 04:09:22 +0000
> > @@ -1491,6 +1491,16 @@
> > to the service from D-Bus.
> > @end defun
> >
> > +@defun dbus-register-service bus service
> > +Register the known name @var{service} on D-Bus @var{bus}.
> > +
> > +@var{bus} is either the symbol @code{:system} or the symbol
> > +@code{:session}.
> > +
> > +@var{service} is the service name to be registered on the D-Bus. It
> > +must be a known name.
> > +@end defun
> > +
> > @defun dbus-unregister-service bus service
> > Unregister all objects from D-Bus @var{bus}, registered by Emacs for
> > @var{service}.
>
> Maybe we shall rearrange the whole node a little bit. In the
> introductionary paragraph, service names could be described more
> detailed, especially their registration policies. Afterwards,
> dbus-register-service shall follow.
Done.
> The explanation of dont-register-service in dbus-register-method and
> dbus-register-property could be shortened, referring to the explanation
> in dbus-register-service.
I don't see which parts of the these discussions could be shortened.
> > --- etc/NEWS 2011-01-04 16:57:45 +0000
> > +++ etc/NEWS 2011-01-05 04:09:22 +0000
> > @@ -558,7 +558,9 @@
> > *** dbus-register-{method,property} do not necessarily register names anymore.
> > -
> > +*** New function dbus-register-service
> > + Register a service known name on a D-Bus without simultaneously
> > + registering a property or a method
>
> I guess we could join both entries.
Done.
> > --- src/dbusbind.c 2011-01-04 11:11:43 +0000
> > +++ src/dbusbind.c 2011-01-05 04:09:22 +0000
> > +DEFUN ("dbus-register-service", Fdbus_register_service, Sdbus_register_service,
> > + 2, 2, 0,
> > + doc: /* Register known name SERVICE on the D-Bus BUS.
> > +
> > +BUS is either a Lisp symbol, `:system' or `:session', or a string
> > +denoting the bus address.
> > +
> > +SERVICE is the D-Bus service name that should be registered. It must
> > +be a known name.
> > +
> > +Return nil.*/)
> > + (Lisp_Object bus, Lisp_Object service)
>
> Your implementation looks OK to me. However, I have a more general
> function in mind. Something like this:
>
> --8<---------------cut here---------------start------------->8---
> DEFUN ("dbus-register-service", Fdbus_register_service, Sdbus_register_service,
> 2, MANY, 0, doc: /* Register known name SERVICE on the D-Bus BUS.
>
> BUS is either a Lisp symbol, `:system' or `:session', or a string
> denoting the bus address.
>
> SERVICE is the D-Bus service name that should be registered.
>
> FLAGS are integers, which control how the service name is registered.
> The following integer constants could be used:
>
> `dbus-service-allow-replacement': Allow another service to become the
> primary owner if requested.
>
> `dbus-service-replace-existing': Request to replace the current
> primary owner.
>
> `dbus-service-do-not-queue': If we can not become the primary owner do
> not place us in the queue.
>
> The function returns an integer, indicating the result of the
> operation. There are predefined constants to check:
>
> `dbus-service-primary-owner': Service has become the primary owner of
> the requested name.
>
> `dbus-service-in-queue': Service could not become the primary owner
> and has been placed in the queue.
>
> `dbus-service-exists': Service is already in the queue.
>
> `dbus-service-already-owner': Service is already the primary owner.
>
> Example:
>
> \(dbus-register-service :session dbus-service-emacs)
>
> => 1 ;; This is `dbus-service-primary-owner'.
>
> \(dbus-register-service
> :session "org.freedesktop.TextEditor"
> dbus-service-allow-replacement dbus-service-replace-existing)
>
> => 4 ;; This is `dbus-service-already-owner'.
>
> usage: (dbus-register-service BUS SERVICE &rest FLAGS) */)
> (int nargs, register Lisp_Object *args)
> --8<---------------cut here---------------end--------------->8---
>
> The constants shall be declared as well, for initialization you could
> use DBUS_NAME_FLAG* and DBUS_REQUEST_NAME_REPLY* from dbus-shared.h.
I'm not sure about the integer constant and how they would be declared.
I used keywords instead.
> And while we are at this, maybe dbus-unregister-service could also
> return a similar result, based on DBUS_RELEASE_NAME_REPLY*.
Done.
> > @@ -2028,18 +2066,8 @@
> > + /* Request the name. */
> > + Fdbus_register_service (bus, service);
>
> As you have said the other message, the check for dont-register-service
> is missing.
This is fixed now.
> Furthermore, I would also propose to use dbus-register-service in
> dbus-register-property (in dbus.el).
Done.
Kind regards,
Jan
[-- Attachment #2: dbus-un-register-service.patch --]
[-- Type: text/x-patch, Size: 22908 bytes --]
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: jan.moringen@uni-bielefeld.de-20110108054407-\
# 33fj9wo8x4hb8oiu
# target_branch: bzr://bzr.savannah.gnu.org/emacs/trunk/
# testament_sha1: e93dadb08dca5ffc0f5f12e68e26573ef00e56e8
# timestamp: 2011-01-08 06:44:49 +0100
# base_revision_id: ken.manheimer@gmail.com-20110104195021-\
# 1x68s956czngphh2
#
# Begin patch
=== modified file 'doc/misc/ChangeLog'
--- doc/misc/ChangeLog 2011-01-04 12:38:33 +0000
+++ doc/misc/ChangeLog 2011-01-08 05:37:49 +0000
@@ -1,3 +1,8 @@
+2011-01-08 Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
+
+ * dbus.texi (Receiving Method Calls): rearranged node to mention
+ dbus-register-service and dbus-unregister-service first
+
2011-01-04 Jan Moringen <jan.moringen@uni-bielefeld.de>
* dbus.texi (Receiving Method Calls): Describe new optional
=== modified file 'doc/misc/dbus.texi'
--- doc/misc/dbus.texi 2011-01-04 12:38:33 +0000
+++ doc/misc/dbus.texi 2011-01-08 05:37:49 +0000
@@ -1244,9 +1244,37 @@
@cindex method calls, returning
@cindex returning method calls
-Emacs can also offer own methods, which can be called by other
-applications. These methods could be an implementation of an
-interface of a well known service, like @samp{org.freedesktop.TextEditor}.
+In order to register methods on the D-Bus, Emacs has to request a well
+known name on the D-Bus under which it will be available for other
+clients. Names on the D-Bus can be registered and unregistered using
+the following functions:
+
+@defun dbus-register-service bus service &rest flags
+Register the known name @var{service} on D-Bus @var{bus}.
+
+@var{bus} is either the symbol @code{:system} or the symbol
+@code{:session}.
+
+@var{service} is the service name to be registered on the D-Bus. It
+must be a known name.
+@end defun
+
+@defun dbus-unregister-service bus service
+Unregister all objects from D-Bus @var{bus}, registered by Emacs for
+@var{service}.
+
+@var{bus} is either the symbol @code{:system} or the symbol
+@code{:session}.
+
+@var{service} is the D-Bus service name of the D-Bus. It must be a
+known name. Emacs releases its association to @var{service} from
+D-Bus.
+@end defun
+
+When a name has been chosen, Emacs can offer own methods, which can be
+called by other applications. These methods could be an
+implementation of an interface of a well known service, like
+@samp{org.freedesktop.TextEditor}.
It could be also an implementation of an own interface. In this case,
the service name must be @samp{org.gnu.Emacs}. The object path shall
@@ -1491,18 +1519,6 @@
to the service from D-Bus.
@end defun
-@defun dbus-unregister-service bus service
-Unregister all objects from D-Bus @var{bus}, registered by Emacs for
-@var{service}.
-
-@var{bus} is either the symbol @code{:system} or the symbol
-@code{:session}.
-
-@var{service} is the D-Bus service name of the D-Bus. It must be a
-known name. Emacs releases its association to @var{service} from
-D-Bus.
-@end defun
-
@node Signals
@chapter Sending and receiving signals.
=== modified file 'etc/NEWS'
--- etc/NEWS 2011-01-04 16:57:45 +0000
+++ etc/NEWS 2011-01-08 05:43:02 +0000
@@ -557,8 +557,13 @@
*** It is possible now, to access alternative buses than the default
system or session bus.
-*** dbus-register-{method,property} do not necessarily register names anymore.
+*** dbus-register-{service,method,property}
+ The -method and -property functions do not automatically register
+ names anymore.
+ The new function dbus-register-service registers a service known
+ name on a D-Bus without simultaneously registering a property or a
+ method
** Tramp
*** There exists a new inline access method "ksu" (kerberized su).
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog 2011-01-04 19:50:21 +0000
+++ lisp/ChangeLog 2011-01-08 05:44:07 +0000
@@ -1,3 +1,11 @@
+2011-01-08 Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
+
+ * net/dbus.el (dbus-unregister-service): translate returned
+ integer into a symbol
+
+ * net/dbus.el (dbus-register-property): use
+ `dbus-register-service' to do the name registration
+
2011-01-04 Ken Manheimer <ken.manheimer@gmail.com>
* Summary: Reconcile with changes in line movement behavior for
=== modified file 'lisp/net/dbus.el'
--- lisp/net/dbus.el 2011-01-04 10:57:24 +0000
+++ lisp/net/dbus.el 2011-01-08 05:44:07 +0000
@@ -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 reply))))
(defun dbus-call-method-non-blocking-handler (&rest args)
"Handler for reply messages of asynchronous D-Bus message calls.
@@ -917,14 +922,18 @@
;; Add the handler. We use `dbus-service-emacs' as service name, in
;; order to let unregister SERVICE despite of this default handler.
(dbus-register-method
- bus service path dbus-interface-properties "Get" 'dbus-property-handler
- dont-register-service)
- (dbus-register-method
- bus service path dbus-interface-properties "GetAll" 'dbus-property-handler
- dont-register-service)
- (dbus-register-method
- bus service path dbus-interface-properties "Set" 'dbus-property-handler
- dont-register-service)
+ bus service path dbus-interface-properties "Get"
+ 'dbus-property-handler nil)
+ (dbus-register-method
+ bus service path dbus-interface-properties "GetAll"
+ 'dbus-property-handler nil)
+ (dbus-register-method
+ bus service path dbus-interface-properties "Set"
+ 'dbus-property-handler nil)
+
+ ;; Register the name SERVICE with BUS.
+ (unless dont-register-service
+ (dbus-register-service bus service))
;; Send the PropertiesChanged signal.
(when emits-signal
=== modified file 'src/ChangeLog'
--- src/ChangeLog 2011-01-04 11:11:43 +0000
+++ src/ChangeLog 2011-01-08 05:38:56 +0000
@@ -1,3 +1,34 @@
+2011-01-08 Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
+
+ Symbols for flags, return values in request-service in dbusbind.c
+ * dbusbind.c (QCdbus_request_name_allow_replacement): new symbol;
+ used by dbus-register-service
+ (QCdbus_request_name_replace_existing): likewise
+ (QCdbus_request_name_do_not_queue): likewise
+ (QCdbus_request_name_reply_primary_owner): likewise
+ (QCdbus_request_name_reply_in_queue): likewise
+ (QCdbus_request_name_reply_exists): likewise
+ (QCdbus_request_name_reply_already_owner): likewise
+ (Fdbus_register_service): changed number of arguments to MANY;
+ rest arguments are used to supply flags; adapted docstring
+ accordingly; translate value returned by DBus to a symbol
+ (Fdbus_register_method): use Fdbus_register_service to do the name
+ registration
+ (syms_of_dbusbind): added symbols :allow-replacement,
+ :replace-existing, :do-not-queue, :primary-owner, :existing,
+ :in-queue and :already-owner
+
+2011-01-05 Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
+
+ Added function dbus-register-service in dbusbind.c
+ * dbusbind.c (Qdbus_register_service): new variable; holds
+ function dbus-register-service
+ (Fdbus_register_service): new function; register a service known
+ name on a D-Bus
+ (Fdbus_register_method): use Fdbus_register_service to register
+ the service name
+ (syms_of_dbusbind): added symbol `dbus-register-service'
+
2011-01-04 Jan Moringen <jan.moringen@uni-bielefeld.de>
* dbusbind.c (Fdbus_register_method): Added optional parameter
=== modified file 'src/dbusbind.c'
--- src/dbusbind.c 2011-01-04 11:11:43 +0000
+++ src/dbusbind.c 2011-01-08 05:38:56 +0000
@@ -38,6 +38,7 @@
Lisp_Object Qdbus_method_return_internal;
Lisp_Object Qdbus_method_error_internal;
Lisp_Object Qdbus_send_signal;
+Lisp_Object Qdbus_register_service;
Lisp_Object Qdbus_register_signal;
Lisp_Object Qdbus_register_method;
@@ -50,6 +51,17 @@
/* Lisp symbol for method call timeout. */
Lisp_Object QCdbus_timeout;
+/* Lisp symbols for name request flags. */
+Lisp_Object QCdbus_request_name_allow_replacement;
+Lisp_Object QCdbus_request_name_replace_existing;
+Lisp_Object QCdbus_request_name_do_not_queue;
+
+/* Lisp symbols for name request replies. */
+Lisp_Object QCdbus_request_name_reply_primary_owner;
+Lisp_Object QCdbus_request_name_reply_in_queue;
+Lisp_Object QCdbus_request_name_reply_exists;
+Lisp_Object QCdbus_request_name_reply_already_owner;
+
/* Lisp symbols of D-Bus types. */
Lisp_Object QCdbus_type_byte, QCdbus_type_boolean;
Lisp_Object QCdbus_type_int16, QCdbus_type_uint16;
@@ -1835,6 +1847,114 @@
xd_in_read_queued_messages = 0;
}
+DEFUN ("dbus-register-service", Fdbus_register_service, Sdbus_register_service,
+ 2, MANY, 0,
+ doc: /* Register known name SERVICE on the D-Bus BUS.
+
+BUS is either a Lisp symbol, `:system' or `:session', or a string
+denoting the bus address.
+
+SERVICE is the D-Bus service name that should be registered. It must
+be a known name.
+
+FLAGS are keywords, which control how the service name is registered.
+The following keywords are recognized:
+
+`:allow-replacement': Allow another service to become the primary
+owner if requested.
+
+`:replace-existing': Request to replace the current primary owner.
+
+`:do-not-queue': If we can not become the primary owner do not place
+us in the queue.
+
+The function returns a keyword, indicating the result of the
+operation. The following keyword can be returned:
+
+`:primary-owner': Service has become the primary owner of the
+requested name.
+
+`:in-queue': Service could not become the primary owner and has been
+placed in the queue.
+
+`:exists': Service is already in the queue.
+
+`:already-owner': Service is already the primary owner.
+
+Example:
+
+\(dbus-register-service :session dbus-service-emacs)
+
+ => :primary-owner.
+
+\(dbus-register-service
+:session "org.freedesktop.TextEditor"
+dbus-service-allow-replacement dbus-service-replace-existing)
+
+ => :already-owner.
+
+usage: (dbus-register-service BUS SERVICE &rest FLAGS) */)
+ (int nargs, register Lisp_Object *args)
+{
+ Lisp_Object bus, service;
+ struct gcpro gcpro1, gcpro2;
+ DBusConnection *connection;
+ unsigned int i;
+ unsigned int value;
+ unsigned int flags = 0;
+ int result;
+ DBusError derror;
+
+ bus = args[0];
+ service = args[1];
+
+ /* Check parameters. */
+ CHECK_STRING (service);
+
+ /* Process flags. */
+ for (i = 2; i < nargs; ++i) {
+ value = ((EQ (args[i], QCdbus_request_name_replace_existing))
+ ? DBUS_NAME_FLAG_REPLACE_EXISTING
+ : (EQ (args[i], QCdbus_request_name_allow_replacement))
+ ? DBUS_NAME_FLAG_ALLOW_REPLACEMENT
+ : (EQ (args[i], QCdbus_request_name_do_not_queue))
+ ? DBUS_NAME_FLAG_DO_NOT_QUEUE
+ : -1);
+ if (value == -1)
+ xsignal0 (Qdbus_error);
+ // "Unrecognized name request flag");
+ flags |= value;
+ }
+
+ /* Open a connection to the bus. */
+ connection = xd_initialize (bus, TRUE);
+
+ /* Request the known name from the bus. We can ignore the result,
+ it is set to -1 if there is an error - kind of redundancy. */
+ dbus_error_init (&derror);
+ result = dbus_bus_request_name (connection, SDATA (service), flags,
+ &derror);
+ if (dbus_error_is_set (&derror))
+ XD_ERROR (derror);
+
+ /* Cleanup. */
+ dbus_error_free (&derror);
+
+ /* Return object. */
+ switch (result) {
+ case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
+ return QCdbus_request_name_reply_primary_owner;
+ case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
+ return QCdbus_request_name_reply_in_queue;
+ case DBUS_REQUEST_NAME_REPLY_EXISTS:
+ return QCdbus_request_name_reply_exists;
+ case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
+ return QCdbus_request_name_reply_already_owner;
+ default:
+ return Qnil;
+ }
+}
+
DEFUN ("dbus-register-signal", Fdbus_register_signal, Sdbus_register_signal,
6, MANY, 0,
doc: /* Register for signal SIGNAL on the D-Bus BUS.
@@ -2014,6 +2134,7 @@
DBusConnection *connection;
int result;
DBusError derror;
+ Lisp_Object args[2] = { bus, service };
/* Check parameters. */
CHECK_STRING (service);
@@ -2028,18 +2149,9 @@
/* Open a connection to the bus. */
connection = xd_initialize (bus, TRUE);
- /* Request the known name from the bus. We can ignore the result,
- it is set to -1 if there is an error - kind of redundancy. */
- if (NILP (dont_register_service))
- {
- dbus_error_init (&derror);
- result = dbus_bus_request_name (connection, SDATA (service), 0, &derror);
- if (dbus_error_is_set (&derror))
- XD_ERROR (derror);
-
- /* Cleanup. */
- dbus_error_free (&derror);
- }
+ /* Request the name. */
+ if (!(NILP(dont_register_service)))
+ Fdbus_register_service (2, args);
/* Create a hash table entry. We use nil for the unique name,
because the method might be called from anybody. */
@@ -2091,6 +2203,10 @@
staticpro (&Qdbus_send_signal);
defsubr (&Sdbus_send_signal);
+ Qdbus_register_service = intern_c_string ("dbus-register-service");
+ staticpro (&Qdbus_register_service);
+ defsubr (&Sdbus_register_service);
+
Qdbus_register_signal = intern_c_string ("dbus-register-signal");
staticpro (&Qdbus_register_signal);
defsubr (&Sdbus_register_signal);
@@ -2112,6 +2228,27 @@
QCdbus_session_bus = intern_c_string (":session");
staticpro (&QCdbus_session_bus);
+ QCdbus_request_name_allow_replacement = intern_c_string (":allow-replacement");
+ staticpro (&QCdbus_request_name_allow_replacement);
+
+ QCdbus_request_name_replace_existing = intern_c_string (":replace-existing");
+ staticpro (&QCdbus_request_name_replace_existing);
+
+ QCdbus_request_name_do_not_queue = intern_c_string (":do-not-queue");
+ staticpro (&QCdbus_request_name_do_not_queue);
+
+ QCdbus_request_name_reply_primary_owner = intern_c_string (":primary-owner");
+ staticpro (&QCdbus_request_name_reply_primary_owner);
+
+ QCdbus_request_name_reply_exists = intern_c_string (":exists");
+ staticpro (&QCdbus_request_name_reply_exists);
+
+ QCdbus_request_name_reply_in_queue = intern_c_string (":in-queue");
+ staticpro (&QCdbus_request_name_reply_in_queue);
+
+ QCdbus_request_name_reply_already_owner = intern_c_string (":already-owner");
+ staticpro (&QCdbus_request_name_reply_already_owner);
+
QCdbus_timeout = intern_c_string (":timeout");
staticpro (&QCdbus_timeout);
# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWUh1f54AEdXfgHgwcf//////
/+7////+YB0n0jfO7687dwao7XM14q61PFC9tNA6BdboA025Xq273vc8eWnbud3s6729dje9t7MA
u64B0r0A2waAyk3Z0cTJbChKERkk8EwRMaJpkp5NT9U9Q9TI2ptQ0GTaQPUPSNBoEkQAjQJGhTJN
PJT0njRANAIDA0IDTATDgaDTIaaNDCBkNDBGhpk0aAZBiAANBJpSIBU3pDE1M01NGmjJ6IGgaMg0
AGgBoAESiAmjQI0myIxNNNJP0JGymhqbT0hNPTSNqaAeoeQSIhBNJgJkAU08jTap6p6TaMptJp6g
AAPUGgxJ5IFwoAMkRB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coBx9zyKCs5mUQSMAisUgsiCAQEsAuF1tbTYFBQbetL1keOm9LcjcoG1
QgZiG5UTkdSruR/T5w12DJE4XKUHSsbAbKtVE2qBeB4B9aF4cVA/gHBPACgXqHl1GnAV/R/9QQPU
c01pCg36oWVSwsliUakjIPNB6FPSXAltkkjbbcC2gH7RnBrmBhkGbWHghdfOgNYPSF42G/thUdY+
rfRbLYcrs2JxaUhtb7v7i7kinChIJDq/zwA=
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: DBus methods without name grabbing
2011-01-08 5:48 ` Jan Moringen
@ 2011-01-09 9:42 ` Michael Albinus
2011-01-09 16:08 ` Jan Moringen
0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2011-01-09 9:42 UTC (permalink / raw)
To: Jan Moringen; +Cc: emacs-devel
Jan Moringen <jan.moringen@uni-bielefeld.de> writes:
> Hi,
Hi Jan,
>> Maybe we shall rearrange the whole node a little bit. In the
>> introductionary paragraph, service names could be described more
>> detailed, especially their registration policies. Afterwards,
>> dbus-register-service shall follow.
>
> Done.
>
>> The explanation of dont-register-service in dbus-register-method and
>> dbus-register-property could be shortened, referring to the explanation
>> in dbus-register-service.
>
> I don't see which parts of the these discussions could be shortened.
FTTB, let the changes as you have proposed. This we could tune later.
> I'm not sure about the integer constant and how they would be declared.
> I used keywords instead.
That's OK.
> --- doc/misc/ChangeLog 2011-01-04 12:38:33 +0000
> +++ doc/misc/ChangeLog 2011-01-08 05:37:49 +0000
> +2011-01-08 Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
> +
> + * dbus.texi (Receiving Method Calls): rearranged node to mention
> + dbus-register-service and dbus-unregister-service first
> +
> 2011-01-04 Jan Moringen <jan.moringen@uni-bielefeld.de>
There are some conventions for ChangeLog entries: Start with capital
letter, speak in active words ("Rearrange" instead of "Rearranged"),
end with a period, etc.
Do you intend to use different email addresses?
> --- doc/misc/dbus.texi 2011-01-04 12:38:33 +0000
> +++ doc/misc/dbus.texi 2011-01-08 05:37:49 +0000
> +@defun dbus-register-service bus service &rest flags
> +Register the known name @var{service} on D-Bus @var{bus}.
> +
> +@var{bus} is either the symbol @code{:system} or the symbol
> +@code{:session}.
> +
> +@var{service} is the service name to be registered on the D-Bus. It
> +must be a known name.
> +@end defun
A description of FLAGS is missing, also return values.
> +@defun dbus-unregister-service bus service
> +Unregister all objects from D-Bus @var{bus}, registered by Emacs for
> +@var{service}.
> +
> +@var{bus} is either the symbol @code{:system} or the symbol
> +@code{:session}.
> +
> +@var{service} is the D-Bus service name of the D-Bus. It must be a
> +known name. Emacs releases its association to @var{service} from
> +D-Bus.
> +@end defun
Ditto for the return values.
> --- lisp/ChangeLog 2011-01-04 19:50:21 +0000
> +++ lisp/ChangeLog 2011-01-08 05:44:07 +0000
> +2011-01-08 Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
> +
> + * net/dbus.el (dbus-unregister-service): translate returned
> + integer into a symbol
> +
> + * net/dbus.el (dbus-register-property): use
> + `dbus-register-service' to do the name registration
> +
It will be just one commit, so you can merge the entries.
> --- lisp/net/dbus.el 2011-01-04 10:57:24 +0000
> +++ lisp/net/dbus.el 2011-01-08 05:44:07 +0000
> @@ -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 reply))))
In case reply is not 1, 2 or 3, there is a problem. We shall raise a
dbus-error then.
> @@ -917,14 +922,18 @@
> ;; Add the handler. We use `dbus-service-emacs' as service name, in
> ;; order to let unregister SERVICE despite of this default handler.
> (dbus-register-method
> + bus service path dbus-interface-properties "Get"
> + 'dbus-property-handler nil)
> + (dbus-register-method
> + bus service path dbus-interface-properties "GetAll"
> + 'dbus-property-handler nil)
> + (dbus-register-method
> + bus service path dbus-interface-properties "Set"
> + 'dbus-property-handler nil)
> +
> + ;; Register the name SERVICE with BUS.
> + (unless dont-register-service
> + (dbus-register-service bus service))
I guess you mean t (or better 'dont-register) as last argument of the
dbus-register-method calls.
Btw, the comment can be shortened. "We use `dbus-service-emacs' ..." is
not true anymore.
> --- src/dbusbind.c 2011-01-04 11:11:43 +0000
> +++ src/dbusbind.c 2011-01-08 05:38:56 +0000
@@ -1835,6 +1847,114 @@
> +The function returns a keyword, indicating the result of the
> +operation. The following keyword can be returned:
"One of the following keywords is returned:"
> + if (value == -1)
> + xsignal0 (Qdbus_error);
> + // "Unrecognized name request flag");
XD_SIGNAL2 (build_string ("Unrecognized name request flag"), args[i]);
> + /* Request the known name from the bus. We can ignore the result,
> + it is set to -1 if there is an error - kind of redundancy. */
> + dbus_error_init (&derror);
> + result = dbus_bus_request_name (connection, SDATA (service), flags,
> + &derror);
> + if (dbus_error_is_set (&derror))
> + XD_ERROR (derror);
The second sentence of the comment is not true anymore.
> @@ -2028,18 +2149,9 @@
> /* Open a connection to the bus. */
> connection = xd_initialize (bus, TRUE);
>
> + /* Request the name. */
> + if (!(NILP(dont_register_service)))
> + Fdbus_register_service (2, args);
It must be
if (NILP (dont_register_service))
> Kind regards,
> Jan
Best regards, Michael.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: DBus methods without name grabbing
2011-01-09 9:42 ` Michael Albinus
@ 2011-01-09 16:08 ` Jan Moringen
2011-01-10 11:40 ` Michael Albinus
0 siblings, 1 reply; 13+ messages in thread
From: Jan Moringen @ 2011-01-09 16:08 UTC (permalink / raw)
To: Michael Albinus; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 5424 bytes --]
Hi Michael,
sorry for the sloppy patch. I couldn't put as much time into it as I
would have liked.
> > --- doc/misc/ChangeLog 2011-01-04 12:38:33 +0000
> > +++ doc/misc/ChangeLog 2011-01-08 05:37:49 +0000
> > +2011-01-08 Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
> > +
> > + * dbus.texi (Receiving Method Calls): rearranged node to mention
> > + dbus-register-service and dbus-unregister-service first
> > +
> > 2011-01-04 Jan Moringen <jan.moringen@uni-bielefeld.de>
>
> There are some conventions for ChangeLog entries: Start with capital
> letter, speak in active words ("Rearrange" instead of "Rearranged"),
> end with a period, etc.
I changed the entry.
> Do you intend to use different email addresses?
No, that wasn't intentional.
> > --- doc/misc/dbus.texi 2011-01-04 12:38:33 +0000
> > +++ doc/misc/dbus.texi 2011-01-08 05:37:49 +0000
> > +@defun dbus-register-service bus service &rest flags
> > +Register the known name @var{service} on D-Bus @var{bus}.
> > +
> > +@var{bus} is either the symbol @code{:system} or the symbol
> > +@code{:session}.
> > +
> > +@var{service} is the service name to be registered on the D-Bus. It
> > +must be a known name.
> > +@end defun
>
> A description of FLAGS is missing, also return values.
Done.
> > +@defun dbus-unregister-service bus service
> > +Unregister all objects from D-Bus @var{bus}, registered by Emacs for
> > +@var{service}.
> > +
> > +@var{bus} is either the symbol @code{:system} or the symbol
> > +@code{:session}.
> > +
> > +@var{service} is the D-Bus service name of the D-Bus. It must be a
> > +known name. Emacs releases its association to @var{service} from
> > +D-Bus.
> > +@end defun
>
> Ditto for the return values.
Done.
> > --- lisp/ChangeLog 2011-01-04 19:50:21 +0000
> > +++ lisp/ChangeLog 2011-01-08 05:44:07 +0000
> > +2011-01-08 Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
> > +
> > + * net/dbus.el (dbus-unregister-service): translate returned
> > + integer into a symbol
> > +
> > + * net/dbus.el (dbus-register-property): use
> > + `dbus-register-service' to do the name registration
> > +
>
> It will be just one commit, so you can merge the entries.
Done.
> > --- lisp/net/dbus.el 2011-01-04 10:57:24 +0000
> > +++ lisp/net/dbus.el 2011-01-08 05:44:07 +0000
> > @@ -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 reply))))
>
> In case reply is not 1, 2 or 3, there is a problem. We shall raise a
> dbus-error then.
Done.
> > @@ -917,14 +922,18 @@
> > ;; Add the handler. We use `dbus-service-emacs' as service name, in
> > ;; order to let unregister SERVICE despite of this default handler.
> > (dbus-register-method
> > + bus service path dbus-interface-properties "Get"
> > + 'dbus-property-handler nil)
> > + (dbus-register-method
> > + bus service path dbus-interface-properties "GetAll"
> > + 'dbus-property-handler nil)
> > + (dbus-register-method
> > + bus service path dbus-interface-properties "Set"
> > + 'dbus-property-handler nil)
> > +
> > + ;; Register the name SERVICE with BUS.
> > + (unless dont-register-service
> > + (dbus-register-service bus service))
>
> I guess you mean t (or better 'dont-register) as last argument of the
> dbus-register-method calls.
I think it has to be t. The service is registered or not in the
following call to `dbus-register-service' depending on
`dont-register-service'.
> Btw, the comment can be shortened. "We use `dbus-service-emacs' ..."
> is not true anymore.
I updated the comment to read:
"Add handlers for the three property-related methods."
> > --- src/dbusbind.c 2011-01-04 11:11:43 +0000
> > +++ src/dbusbind.c 2011-01-08 05:38:56 +0000
> @@ -1835,6 +1847,114 @@
> > +The function returns a keyword, indicating the result of the
> > +operation. The following keyword can be returned:
>
> "One of the following keywords is returned:"
Done.
> > + if (value == -1)
> > + xsignal0 (Qdbus_error);
> > + // "Unrecognized name request flag");
>
> XD_SIGNAL2 (build_string ("Unrecognized name request flag"), args[i]);
I was wondering how to do that. Thanks.
> > + /* Request the known name from the bus. We can ignore the result,
> > + it is set to -1 if there is an error - kind of redundancy. */
> > + dbus_error_init (&derror);
> > + result = dbus_bus_request_name (connection, SDATA (service), flags,
> > + &derror);
> > + if (dbus_error_is_set (&derror))
> > + XD_ERROR (derror);
>
> The second sentence of the comment is not true anymore.
I removed it.
> > @@ -2028,18 +2149,9 @@
> > /* Open a connection to the bus. */
> > connection = xd_initialize (bus, TRUE);
> >
> > + /* Request the name. */
> > + if (!(NILP(dont_register_service)))
> > + Fdbus_register_service (2, args);
>
> It must be
>
> if (NILP (dont_register_service))
Oops.
I hope this increases the quality of the patch to bearable levels.
Kind regards,
Jan
[-- Attachment #2: dbus-un-register-service.patch --]
[-- Type: text/x-patch, Size: 27721 bytes --]
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: jan.moringen@uni-bielefeld.de-20110109160320-\
# c5t6kwjae2hznq8p
# target_branch: bzr://bzr.savannah.gnu.org/emacs/trunk/
# testament_sha1: 4cd4c68f62bb48cee2f221b129164f70bcd611f9
# timestamp: 2011-01-09 17:06:19 +0100
# base_revision_id: ken.manheimer@gmail.com-20110104195021-\
# 1x68s956czngphh2
#
# Begin patch
=== modified file 'doc/misc/ChangeLog'
--- doc/misc/ChangeLog 2011-01-04 12:38:33 +0000
+++ doc/misc/ChangeLog 2011-01-09 15:56:26 +0000
@@ -1,3 +1,8 @@
+2011-01-08 Jan Moringen <jan.moringen@uni-bielefeld.de>
+
+ * dbus.texi (Receiving Method Calls): Rearrange node to mention
+ dbus-register-service and dbus-unregister-service first.
+
2011-01-04 Jan Moringen <jan.moringen@uni-bielefeld.de>
* dbus.texi (Receiving Method Calls): Describe new optional
=== modified file 'doc/misc/dbus.texi'
--- doc/misc/dbus.texi 2011-01-04 12:38:33 +0000
+++ doc/misc/dbus.texi 2011-01-09 15:34:23 +0000
@@ -1244,9 +1244,69 @@
@cindex method calls, returning
@cindex returning method calls
-Emacs can also offer own methods, which can be called by other
-applications. These methods could be an implementation of an
-interface of a well known service, like @samp{org.freedesktop.TextEditor}.
+In order to register methods on the D-Bus, Emacs has to request a well
+known name on the D-Bus under which it will be available for other
+clients. Names on the D-Bus can be registered and unregistered using
+the following functions:
+
+@defun dbus-register-service bus service &rest flags
+Register the known name @var{service} on D-Bus @var{bus}.
+
+@var{bus} is either the symbol @code{:system} or the symbol
+@code{:session}.
+
+@var{service} is the service name to be registered on the D-Bus. It
+must be a known name.
+
+@var{flags} is a subset of the following keywords:
+@itemize
+@item @code{:allow-replacement}: Allow another service to become the primary
+owner if requested.
+
+@item @code{:replace-existing}: Request to replace the current primary owner.
+
+@item @code{:do-not-queue}: If we can not become the primary owner do not
+place us in the queue.
+@end itemize
+
+One of the following keywords is returned:
+@itemize
+@item @code{:primary-owner}: We have become the primary owner of the name
+@var{service}.
+
+@item @code{:in-queue}: We could not become the primary owner and
+have been placed in the queue.
+
+@item @code{:exists}: We already are in the queue.
+
+@item @code{:already-owner}: We already are the primary
+owner.
+@end itemize
+@end defun
+
+@defun dbus-unregister-service bus service
+Unregister all objects from D-Bus @var{bus}, registered by Emacs for
+@var{service}.
+
+@var{bus} is either the symbol @code{:system} or the symbol
+@code{:session}.
+
+@var{service} is the D-Bus service name of the D-Bus. It must be a
+known name. Emacs releases its association to @var{service} from
+D-Bus.
+
+One of the following keywords is returned:
+@itemize
+@item @code{:released}: We successfully released the name @var{service}.
+@item @code{:non-existent}: The name @var{service} does not exist on the bus.
+@item @code{:not-owner}: We are not an owner of the name @var{service}.
+@end itemize
+@end defun
+
+When a name has been chosen, Emacs can offer own methods, which can be
+called by other applications. These methods could be an
+implementation of an interface of a well known service, like
+@samp{org.freedesktop.TextEditor}.
It could be also an implementation of an own interface. In this case,
the service name must be @samp{org.gnu.Emacs}. The object path shall
@@ -1491,18 +1551,6 @@
to the service from D-Bus.
@end defun
-@defun dbus-unregister-service bus service
-Unregister all objects from D-Bus @var{bus}, registered by Emacs for
-@var{service}.
-
-@var{bus} is either the symbol @code{:system} or the symbol
-@code{:session}.
-
-@var{service} is the D-Bus service name of the D-Bus. It must be a
-known name. Emacs releases its association to @var{service} from
-D-Bus.
-@end defun
-
@node Signals
@chapter Sending and receiving signals.
=== modified file 'etc/NEWS'
--- etc/NEWS 2011-01-04 16:57:45 +0000
+++ etc/NEWS 2011-01-08 05:43:02 +0000
@@ -557,8 +557,13 @@
*** It is possible now, to access alternative buses than the default
system or session bus.
-*** dbus-register-{method,property} do not necessarily register names anymore.
+*** dbus-register-{service,method,property}
+ The -method and -property functions do not automatically register
+ names anymore.
+ The new function dbus-register-service registers a service known
+ name on a D-Bus without simultaneously registering a property or a
+ method
** Tramp
*** There exists a new inline access method "ksu" (kerberized su).
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog 2011-01-04 19:50:21 +0000
+++ lisp/ChangeLog 2011-01-09 15:34:49 +0000
@@ -1,3 +1,10 @@
+2011-01-08 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-04 Ken Manheimer <ken.manheimer@gmail.com>
* Summary: Reconcile with changes in line movement behavior for
=== modified file 'lisp/net/dbus.el'
--- lisp/net/dbus.el 2011-01-04 10:57:24 +0000
+++ lisp/net/dbus.el 2011-01-09 16:03:20 +0000
@@ -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.
- (dbus-register-method
- bus service path dbus-interface-properties "Get" 'dbus-property-handler
- dont-register-service)
- (dbus-register-method
- bus service path dbus-interface-properties "GetAll" 'dbus-property-handler
- dont-register-service)
- (dbus-register-method
- bus service path dbus-interface-properties "Set" 'dbus-property-handler
- dont-register-service)
+ ;; Add handlers for the three property-related methods.
+ (dbus-register-method
+ bus service path dbus-interface-properties "Get"
+ 'dbus-property-handler t)
+ (dbus-register-method
+ bus service path dbus-interface-properties "GetAll"
+ 'dbus-property-handler t)
+ (dbus-register-method
+ 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
=== modified file 'src/ChangeLog'
--- src/ChangeLog 2011-01-04 11:11:43 +0000
+++ src/ChangeLog 2011-01-08 05:38:56 +0000
@@ -1,3 +1,34 @@
+2011-01-08 Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
+
+ Symbols for flags, return values in request-service in dbusbind.c
+ * dbusbind.c (QCdbus_request_name_allow_replacement): new symbol;
+ used by dbus-register-service
+ (QCdbus_request_name_replace_existing): likewise
+ (QCdbus_request_name_do_not_queue): likewise
+ (QCdbus_request_name_reply_primary_owner): likewise
+ (QCdbus_request_name_reply_in_queue): likewise
+ (QCdbus_request_name_reply_exists): likewise
+ (QCdbus_request_name_reply_already_owner): likewise
+ (Fdbus_register_service): changed number of arguments to MANY;
+ rest arguments are used to supply flags; adapted docstring
+ accordingly; translate value returned by DBus to a symbol
+ (Fdbus_register_method): use Fdbus_register_service to do the name
+ registration
+ (syms_of_dbusbind): added symbols :allow-replacement,
+ :replace-existing, :do-not-queue, :primary-owner, :existing,
+ :in-queue and :already-owner
+
+2011-01-05 Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
+
+ Added function dbus-register-service in dbusbind.c
+ * dbusbind.c (Qdbus_register_service): new variable; holds
+ function dbus-register-service
+ (Fdbus_register_service): new function; register a service known
+ name on a D-Bus
+ (Fdbus_register_method): use Fdbus_register_service to register
+ the service name
+ (syms_of_dbusbind): added symbol `dbus-register-service'
+
2011-01-04 Jan Moringen <jan.moringen@uni-bielefeld.de>
* dbusbind.c (Fdbus_register_method): Added optional parameter
=== modified file 'src/dbusbind.c'
--- src/dbusbind.c 2011-01-04 11:11:43 +0000
+++ src/dbusbind.c 2011-01-09 15:53:12 +0000
@@ -38,6 +38,7 @@
Lisp_Object Qdbus_method_return_internal;
Lisp_Object Qdbus_method_error_internal;
Lisp_Object Qdbus_send_signal;
+Lisp_Object Qdbus_register_service;
Lisp_Object Qdbus_register_signal;
Lisp_Object Qdbus_register_method;
@@ -50,6 +51,17 @@
/* Lisp symbol for method call timeout. */
Lisp_Object QCdbus_timeout;
+/* Lisp symbols for name request flags. */
+Lisp_Object QCdbus_request_name_allow_replacement;
+Lisp_Object QCdbus_request_name_replace_existing;
+Lisp_Object QCdbus_request_name_do_not_queue;
+
+/* Lisp symbols for name request replies. */
+Lisp_Object QCdbus_request_name_reply_primary_owner;
+Lisp_Object QCdbus_request_name_reply_in_queue;
+Lisp_Object QCdbus_request_name_reply_exists;
+Lisp_Object QCdbus_request_name_reply_already_owner;
+
/* Lisp symbols of D-Bus types. */
Lisp_Object QCdbus_type_byte, QCdbus_type_boolean;
Lisp_Object QCdbus_type_int16, QCdbus_type_uint16;
@@ -1835,6 +1847,112 @@
xd_in_read_queued_messages = 0;
}
+DEFUN ("dbus-register-service", Fdbus_register_service, Sdbus_register_service,
+ 2, MANY, 0,
+ doc: /* Register known name SERVICE on the D-Bus BUS.
+
+BUS is either a Lisp symbol, `:system' or `:session', or a string
+denoting the bus address.
+
+SERVICE is the D-Bus service name that should be registered. It must
+be a known name.
+
+FLAGS are keywords, which control how the service name is registered.
+The following keywords are recognized:
+
+`:allow-replacement': Allow another service to become the primary
+owner if requested.
+
+`:replace-existing': Request to replace the current primary owner.
+
+`:do-not-queue': If we can not become the primary owner do not place
+us in the queue.
+
+The function returns a keyword, indicating the result of the
+operation. One of the following keywords is returned:
+
+`:primary-owner': Service has become the primary owner of the
+requested name.
+
+`:in-queue': Service could not become the primary owner and has been
+placed in the queue.
+
+`:exists': Service is already in the queue.
+
+`:already-owner': Service is already the primary owner.
+
+Example:
+
+\(dbus-register-service :session dbus-service-emacs)
+
+ => :primary-owner.
+
+\(dbus-register-service
+:session "org.freedesktop.TextEditor"
+dbus-service-allow-replacement dbus-service-replace-existing)
+
+ => :already-owner.
+
+usage: (dbus-register-service BUS SERVICE &rest FLAGS) */)
+ (int nargs, register Lisp_Object *args)
+{
+ Lisp_Object bus, service;
+ struct gcpro gcpro1, gcpro2;
+ DBusConnection *connection;
+ unsigned int i;
+ unsigned int value;
+ unsigned int flags = 0;
+ int result;
+ DBusError derror;
+
+ bus = args[0];
+ service = args[1];
+
+ /* Check parameters. */
+ CHECK_STRING (service);
+
+ /* Process flags. */
+ for (i = 2; i < nargs; ++i) {
+ value = ((EQ (args[i], QCdbus_request_name_replace_existing))
+ ? DBUS_NAME_FLAG_REPLACE_EXISTING
+ : (EQ (args[i], QCdbus_request_name_allow_replacement))
+ ? DBUS_NAME_FLAG_ALLOW_REPLACEMENT
+ : (EQ (args[i], QCdbus_request_name_do_not_queue))
+ ? DBUS_NAME_FLAG_DO_NOT_QUEUE
+ : -1);
+ if (value == -1)
+ XD_SIGNAL2 (build_string ("Unrecognized name request flag"), args[i]);
+ flags |= value;
+ }
+
+ /* Open a connection to the bus. */
+ connection = xd_initialize (bus, TRUE);
+
+ /* Request the known name from the bus. */
+ dbus_error_init (&derror);
+ result = dbus_bus_request_name (connection, SDATA (service), flags,
+ &derror);
+ if (dbus_error_is_set (&derror))
+ XD_ERROR (derror);
+
+ /* Cleanup. */
+ dbus_error_free (&derror);
+
+ /* Return object. */
+ switch (result) {
+ case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
+ return QCdbus_request_name_reply_primary_owner;
+ case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
+ return QCdbus_request_name_reply_in_queue;
+ case DBUS_REQUEST_NAME_REPLY_EXISTS:
+ return QCdbus_request_name_reply_exists;
+ case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
+ return QCdbus_request_name_reply_already_owner;
+ default:
+ return Qnil;
+ }
+}
+
DEFUN ("dbus-register-signal", Fdbus_register_signal, Sdbus_register_signal,
6, MANY, 0,
doc: /* Register for signal SIGNAL on the D-Bus BUS.
@@ -2014,6 +2132,7 @@
DBusConnection *connection;
int result;
DBusError derror;
+ Lisp_Object args[2] = { bus, service };
/* Check parameters. */
CHECK_STRING (service);
@@ -2028,18 +2147,9 @@
/* Open a connection to the bus. */
connection = xd_initialize (bus, TRUE);
- /* Request the known name from the bus. We can ignore the result,
- it is set to -1 if there is an error - kind of redundancy. */
- if (NILP (dont_register_service))
- {
- dbus_error_init (&derror);
- result = dbus_bus_request_name (connection, SDATA (service), 0, &derror);
- if (dbus_error_is_set (&derror))
- XD_ERROR (derror);
-
- /* Cleanup. */
- dbus_error_free (&derror);
- }
+ /* Request the name. */
+ if (NILP(dont_register_service))
+ Fdbus_register_service (2, args);
/* Create a hash table entry. We use nil for the unique name,
because the method might be called from anybody. */
@@ -2091,6 +2201,10 @@
staticpro (&Qdbus_send_signal);
defsubr (&Sdbus_send_signal);
+ Qdbus_register_service = intern_c_string ("dbus-register-service");
+ staticpro (&Qdbus_register_service);
+ defsubr (&Sdbus_register_service);
+
Qdbus_register_signal = intern_c_string ("dbus-register-signal");
staticpro (&Qdbus_register_signal);
defsubr (&Sdbus_register_signal);
@@ -2112,6 +2226,27 @@
QCdbus_session_bus = intern_c_string (":session");
staticpro (&QCdbus_session_bus);
+ QCdbus_request_name_allow_replacement = intern_c_string (":allow-replacement");
+ staticpro (&QCdbus_request_name_allow_replacement);
+
+ QCdbus_request_name_replace_existing = intern_c_string (":replace-existing");
+ staticpro (&QCdbus_request_name_replace_existing);
+
+ QCdbus_request_name_do_not_queue = intern_c_string (":do-not-queue");
+ staticpro (&QCdbus_request_name_do_not_queue);
+
+ QCdbus_request_name_reply_primary_owner = intern_c_string (":primary-owner");
+ staticpro (&QCdbus_request_name_reply_primary_owner);
+
+ QCdbus_request_name_reply_exists = intern_c_string (":exists");
+ staticpro (&QCdbus_request_name_reply_exists);
+
+ QCdbus_request_name_reply_in_queue = intern_c_string (":in-queue");
+ staticpro (&QCdbus_request_name_reply_in_queue);
+
+ QCdbus_request_name_reply_already_owner = intern_c_string (":already-owner");
+ staticpro (&QCdbus_request_name_reply_already_owner);
+
QCdbus_timeout = intern_c_string (":timeout");
staticpro (&QCdbus_timeout);
# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWYdIc7EAIkZfgHgwcf//////
/+7////+YCvega6b73Pt8Pvffc8Xsttl0ly++r3vvfevfPtZO7jhSTbGQA1yAFsXb0AAB7t7YPvd
6t83tb73vu58Y18ddwzMvtzMPbzzfFz4++77ana77qe+G+PbKjTVkyqDfZyctbY1Nshz7cHu+++H
yAHy+8JIiGgmmmgaGiYmowJlRo02pskGjI9TQaG1NojaglCAAQEgUxMKYpjUA0A0ADQAAaNAkQgm
knqaAUn6U9qj1DJ6nqNB6jT0g0xAZGgAAAk0pEZCRtTT0U00A9KZMafqhGajBA9EGIMJoyaYIkkE
mnqTU9plTyp/k1T9ETJ6PSRkaZPSgZ6oMajAIPUMgVJEENAECaMmk9Q0HqBMU8o9Jk0NGg0aaADJ
lfiaSIFogWcwk5aUKgyCW/Of17O3suftw/mBi32vV7hurEcn+ygla8Tt+5vEN8Jve3xna510ZGCZ
LxniB2sizvdRaYYGaY8O7WcO+LxfxHg82sNCQU5B1AwuuIDW3vx5Tc4pyilCK4x2GiM6PuzXNnbf
Bf7IEI/B2htZuJQfA+12aMzcyGJ7z8INvH95L0DWHwPlKI3c2Z73dxgaDdcKyaaed+kxlnckzYYd
Gbt3w4GG/s/76Ufl2wkaWZoO1fyNALuhxukwmWu2+9Z6nqbIQdfdt1+B0JLETyyfh9eKpavzUcSc
61oErydCLCDctutlXU+NdzK8xsggRUoTGgUzg44+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cIU4skqrL
JXbqiXTgwimKKi8liY3PNHuTXDJInUQWie8fhDWeBBvPRH3I74+SJga5D6fJx6GkkOiNln8qP32k
D6UexHzPXK650UosgcV0LrIXN1UXI2bEjCVEDZED0IbgfGYgmN8kkkklD0CbQD6iHTHShl1FzkL+
o8onPnDxRrIdpXUfemyDCCgwQbexiYA0JeGDpEZmOc5eDI5J3GNKogdr8YtRT8dv/i7kinChIQ6Q
52I=
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: DBus methods without name grabbing
2011-01-09 16:08 ` Jan Moringen
@ 2011-01-10 11:40 ` Michael Albinus
0 siblings, 0 replies; 13+ messages in thread
From: Michael Albinus @ 2011-01-10 11:40 UTC (permalink / raw)
To: Jan Moringen; +Cc: emacs-devel
Jan Moringen <jan.moringen@uni-bielefeld.de> writes:
> Hi Michael,
Hi Jan,
> sorry for the sloppy patch. I couldn't put as much time into it as I
> would have liked.
Don't worry. By this, I had something to comment :-)
>> > + (dbus-register-method
>> > + bus service path dbus-interface-properties "Set"
>> > + 'dbus-property-handler nil)
>> > +
>> > + ;; Register the name SERVICE with BUS.
>> > + (unless dont-register-service
>> > + (dbus-register-service bus service))
>>
>> I guess you mean t (or better 'dont-register) as last argument of the
>> dbus-register-method calls.
>
> I think it has to be t. The service is registered or not in the
> following call to `dbus-register-service' depending on
> `dont-register-service'.
I did not mean the value of `dont-register-service', but a symbol
`dont-register'. For better readability, one could use a symbol
describing what is meant with a non-nil value.
> I hope this increases the quality of the patch to bearable levels.
I have committed your patchset. Afterwards, I have applied some further
minor tweakings.
> Kind regards,
> Jan
Best regards, Michael.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2011-01-10 11:40 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-02 21:06 DBus methods without name grabbing Jan Moringen
2011-01-03 12:55 ` Michael Albinus
2011-01-04 2:42 ` Jan Moringen
2011-01-04 10:10 ` Michael Albinus
2011-01-04 10:29 ` Jan Moringen
2011-01-04 13:09 ` Michael Albinus
2011-01-05 4:17 ` Jan Moringen
2011-01-05 11:45 ` Michael Albinus
2011-01-08 5:48 ` Jan Moringen
2011-01-09 9:42 ` Michael Albinus
2011-01-09 16:08 ` Jan Moringen
2011-01-10 11:40 ` Michael Albinus
[not found] ` <1294201048.2508.1.camel@gunhead>
2011-01-05 10:46 ` Jan Moringen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).