More about "intents": Several improvements to desktop files and caches

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Jan 6 08:26:43 PST 2014


On 06/01/14 01:25, Jerome Leclanche wrote:
> There's a lot TBD still. For example: Do we require apps implementing
> an intent to support every method of the intent? I don't think it's
> necessary due to dbus introspection letting us figure out whether a
> method is supported.

With my D-Bus maintainer hat on:

D-Bus introspection (o.fd.DBus.Introspectable.Introspect) is a
debugging, development and (occasionally) code-generation tool, and
should not be used in "production" code[1]. It is not a
capability-discovery mechanism.

For instance, Telepathy connections' introspection XML lists every
method for which they have C code; but on a connection to a particular
server, it's common to have methods that don't work and never will, due
to the limitations of this particular server. For instance, you can
block offensive contacts via proprietary messages to Google's XMPP
servers, but you can't block contacts on a minimal XMPP server with no
extensions; so on Google XMPP servers, the BlockContacts method can
work, but on minimal XMPP servers, it will just fail.

If you want to discover capabilities ("I can do this and this but not
this") over D-Bus, you should use a simpler mechanism that doesn't
involve parsing XML, and does allow saying "I have code for this method
but it doesn't work on this object". A property whose value is an
integer representing a bitfield, or a property whose value is a list of
strings, are better representations. Remember to define (in your D-Bus
API) whether that property can change within an object's lifetime, and
if so, how the change is signalled.

For instance, Telepathy typically uses properties named "Interfaces"
containing a string array (a list of interfaces that work), and a
property per interface named "SomethingFlags" to describe the features
of that interface that will work here.

Regards,
    S

[1] Yes, I know I maintain dbus-python, which does (ab)use introspection
for some of its functionality. It's constrained to do so by backwards
compatibility, and I consider it to be a design flaw that it does this.
"Do as I say, not as I do" :-)



More information about the xdg mailing list