From: Michael Albinus <michael.albinus@gmx.de>
To: Jan Moringen <jan.moringen@uni-bielefeld.de>
Cc: emacs-devel@gnu.org
Subject: Re: DBus methods without name grabbing
Date: Wed, 05 Jan 2011 12:45:00 +0100 [thread overview]
Message-ID: <87hbdnvakj.fsf@gmx.de> (raw)
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")
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.
next prev parent reply other threads:[~2011-01-05 11:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87hbdnvakj.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=emacs-devel@gnu.org \
--cc=jan.moringen@uni-bielefeld.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.