[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DBus methods without name grabbing
From: |
Michael Albinus |
Subject: |
Re: DBus methods without name grabbing |
Date: |
Sun, 09 Jan 2011 10:42:17 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Jan Moringen <address@hidden> 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 <address@hidden>
> +
> + * dbus.texi (Receiving Method Calls): rearranged node to mention
> + dbus-register-service and dbus-unregister-service first
> +
> 2011-01-04 Jan Moringen <address@hidden>
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
> address@hidden dbus-register-service bus service &rest flags
> +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
A description of FLAGS is missing, also return values.
> address@hidden dbus-unregister-service bus service
> +Unregister all objects from D-Bus @var{bus}, registered by Emacs for
> address@hidden
> +
> address@hidden is either the symbol @code{:system} or the symbol
> address@hidden:session}.
> +
> address@hidden 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.
> address@hidden 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 <address@hidden>
> +
> + * 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.
- DBus methods without name grabbing, Jan Moringen, 2011/01/02
- Re: DBus methods without name grabbing, Michael Albinus, 2011/01/03
- Re: DBus methods without name grabbing, Jan Moringen, 2011/01/03
- Re: DBus methods without name grabbing, Michael Albinus, 2011/01/04
- Re: DBus methods without name grabbing, Jan Moringen, 2011/01/04
- Re: DBus methods without name grabbing, Michael Albinus, 2011/01/04
- Re: DBus methods without name grabbing, Jan Moringen, 2011/01/04
- Re: DBus methods without name grabbing, Michael Albinus, 2011/01/05
- Re: DBus methods without name grabbing, Jan Moringen, 2011/01/08
- Re: DBus methods without name grabbing,
Michael Albinus <=
- Re: DBus methods without name grabbing, Jan Moringen, 2011/01/09
- Re: DBus methods without name grabbing, Michael Albinus, 2011/01/10
- Message not available
- Re: DBus methods without name grabbing, Jan Moringen, 2011/01/05