emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DBus methods without name grabbing


From: Jan Moringen
Subject: Re: DBus methods without name grabbing
Date: Sat, 08 Jan 2011 06:48:21 +0100

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
> >  
> > address@hidden dbus-register-service bus service
> > +Register the known name @var{service} on D-Bus @var{bus}.
> > +
> > address@hidden is either the symbol @code{:system} or the symbol
> > address@hidden:session}.
> > +
> > address@hidden is the service name to be registered on the D-Bus.  It
> > +must be a known name.
> > address@hidden 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: dbus-un-register-service.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]