From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: DBus methods without name grabbing Date: Wed, 05 Jan 2011 12:45:00 +0100 Message-ID: <87hbdnvakj.fsf@gmx.de> References: <19384_1294002375_ZZh0g13mCbLkV.00_1294002364.12635.44.camel@gunhead> <87lj32kuyz.fsf@gmx.de> <7758_1294108975_ZZh0g0_f99~qx.00_1294108972.8785.33.camel@gunhead> <87zkrhf081.fsf@gmx.de> <26843_1294201050_ZZh0g3doKzQB1.00_1294201048.2508.1.camel@gunhead> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1294227929 5968 80.91.229.12 (5 Jan 2011 11:45:29 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 5 Jan 2011 11:45:29 +0000 (UTC) Cc: emacs-devel@gnu.org To: Jan Moringen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 05 12:45:24 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PaRnw-000523-EK for ged-emacs-devel@m.gmane.org; Wed, 05 Jan 2011 12:45:24 +0100 Original-Received: from localhost ([127.0.0.1]:60606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PaRnv-0003uY-Uw for ged-emacs-devel@m.gmane.org; Wed, 05 Jan 2011 06:45:24 -0500 Original-Received: from [140.186.70.92] (port=43047 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PaRnk-0003tY-Kk for emacs-devel@gnu.org; Wed, 05 Jan 2011 06:45:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PaRnf-0005mf-MP for emacs-devel@gnu.org; Wed, 05 Jan 2011 06:45:12 -0500 Original-Received: from mailout-de.gmx.net ([213.165.64.22]:48987 helo=mail.gmx.net) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PaRnf-0005lx-8U for emacs-devel@gnu.org; Wed, 05 Jan 2011 06:45:07 -0500 Original-Received: (qmail invoked by alias); 05 Jan 2011 11:45:05 -0000 Original-Received: from p57BBD4DA.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.212.218] by mail.gmx.net (mp064) with SMTP; 05 Jan 2011 12:45:05 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/elp8BVFneNldE3b9KKylWVZqLMi3+zujd4deE5U UxC35aDWhj95Cf In-Reply-To: <26843_1294201050_ZZh0g3doKzQB1.00_1294201048.2508.1.camel@gunhead> (Jan Moringen's message of "Wed, 05 Jan 2011 05:17:28 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:134281 Archived-At: Jan Moringen 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.