all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* dbus-register-method and introspection
@ 2023-05-21 11:40 Rahguzar
  2023-05-21 15:35 ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Rahguzar @ 2023-05-21 11:40 UTC (permalink / raw)
  To: help-gnu-emacs

Hello all,

I am playing with the d-bus integration in Emacs 29.0.91. When I
register a method with `dbus-register-method` I am unable to see what
effect it has had. For example if I evaluate the following code in the
node (dbus) Register Objects of the manual,


(defun my-dbus-method-handler (filename) (if (find-file filename)
  '(:boolean t) '(:boolean nil)))

(dbus-register-method :session "org.freedesktop.TextEditor"
 "/org/freedesktop/TextEditor" "org.freedesktop.TextEditor" "OpenFile"
 #'my-dbus-method-handler)

and then evaluate

(dbus-introspect-xml :session "org.freedesktop.TextEditor"
"/org/freedesktop/TextEditor")

I get nil. Similarly I can see the service 'org.freedesktop.TextEditor'
in the application 'd-feet' but clicking on it doesn't show the method
that was registered above and after a while I get a timeout error. This
is in contrast to other services for which I can see what interfaces and
methods they provide.

Is there a simple way to expose such information for the services
provided from inside emacs?

Thanks in advance,
Rahguzar



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: dbus-register-method and introspection
  2023-05-21 11:40 dbus-register-method and introspection Rahguzar
@ 2023-05-21 15:35 ` Michael Albinus
  2023-05-21 16:41   ` Rahguzar
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2023-05-21 15:35 UTC (permalink / raw)
  To: Rahguzar; +Cc: help-gnu-emacs

Rahguzar <rahguzar@zohomail.eu> writes:

> Hello all,

Hi Rahguzar,

> I am playing with the d-bus integration in Emacs 29.0.91. When I
> register a method with `dbus-register-method` I am unable to see what
> effect it has had. For example if I evaluate the following code in the
> node (dbus) Register Objects of the manual,
>
>
> (defun my-dbus-method-handler (filename) (if (find-file filename)
>   '(:boolean t) '(:boolean nil)))
>
> (dbus-register-method :session "org.freedesktop.TextEditor"
>  "/org/freedesktop/TextEditor" "org.freedesktop.TextEditor" "OpenFile"
>  #'my-dbus-method-handler)
>
> and then evaluate
>
> (dbus-introspect-xml :session "org.freedesktop.TextEditor"
> "/org/freedesktop/TextEditor")
>
> I get nil. Similarly I can see the service 'org.freedesktop.TextEditor'
> in the application 'd-feet' but clicking on it doesn't show the method
> that was registered above and after a while I get a timeout error. This
> is in contrast to other services for which I can see what interfaces and
> methods they provide.
>
> Is there a simple way to expose such information for the services
> provided from inside emacs?

The dbus-introspect-* methods work over the
"org.freedesktop.DBus.Introspectable" interface. You must provide an own
implementation for this with your "org.freedesktop.TextEditor" service,
if you want to see the introspection data.

Most existing D-Bus services provide an own file with that data, see
directory /usr/share/dbus-1/interfaces (on my Fedora system, it could be
somewhere else on your system). When this interface is called, they
simply dump out the respective file.

> Thanks in advance,
> Rahguzar

Best regards, Michael.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: dbus-register-method and introspection
  2023-05-21 15:35 ` Michael Albinus
@ 2023-05-21 16:41   ` Rahguzar
  2023-05-21 18:13     ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Rahguzar @ 2023-05-21 16:41 UTC (permalink / raw)
  To: Michael Albinus; +Cc: help-gnu-emacs


Hi Michael,
 Thanks for the reply.

Michael Albinus <michael.albinus@gmx.de> writes:

> The dbus-introspect-* methods work over the
> "org.freedesktop.DBus.Introspectable" interface. You must provide an own
> implementation for this with your "org.freedesktop.TextEditor" service,
> if you want to see the introspection data.
>
> Most existing D-Bus services provide an own file with that data, see
> directory /usr/share/dbus-1/interfaces (on my Fedora system, it could be
> somewhere else on your system). When this interface is called, they
> simply dump out the respective file.
>

I was somehow hoping that since the methods need to be registered, d-bus
had some magical way of determining at least which methods a service
provided. That not being the case, is there some way of using the
information provided to `dbus-register-method` to provide a rudimentary
implementation of introspection methods?


> Best regards, Michael.

Thanks again,
Rahguzar



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: dbus-register-method and introspection
  2023-05-21 16:41   ` Rahguzar
@ 2023-05-21 18:13     ` Michael Albinus
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Albinus @ 2023-05-21 18:13 UTC (permalink / raw)
  To: Rahguzar; +Cc: help-gnu-emacs

Rahguzar <rahguzar@zohomail.eu> writes:

> Hi Michael,

Hi Rahguzar,

> I was somehow hoping that since the methods need to be registered, d-bus
> had some magical way of determining at least which methods a service
> provided. That not being the case, is there some way of using the
> information provided to `dbus-register-method` to provide a rudimentary
> implementation of introspection methods?

There is the GNU ELPA package dbus-codegen, which provides some
support. I haven't used it myself, so I cannot say too much about.

> Thanks again,
> Rahguzar

Best regards, Michael.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-21 18:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-21 11:40 dbus-register-method and introspection Rahguzar
2023-05-21 15:35 ` Michael Albinus
2023-05-21 16:41   ` Rahguzar
2023-05-21 18:13     ` Michael Albinus

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.