Re: How to declare use of a standard interface?

Lawrence D'Oliveiro <ldo-kC51rjc0cqs1dNLGKZg6taU/[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Organization Geek Central
Message-ID <[email protected]>
On Tue, 21 Sep 2021 23:13:48 +0000, Chris Eich wrote:

> The API Design Guidelines recommend using standard interfaces
> <https://dbus.freedesktop.org/doc/dbus-api-design.html#standard-interfaces>
>  like org.freedesktop.DBus.Properties​ and
> org.freedesktop.DBus.ObjectManager​ to avoid declaring boilerplate
> methods.
> 
> However, it's not clear how to use those interfaces if defining
> interfaces using introspection XML. Am I missing something?

An object path <node> tag can include any number of <interface> tags
indicating the interfaces that it supports. For a quick example, this
one has two:

    ldo@theon:dbussy_examples> ./introspect session org.kde.KWin /
    <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
    "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
    <node>
      <interface name="org.freedesktop.DBus.Introspectable">
        <method name="Introspect">
          <arg name="xml_data" type="s" direction="out"/>
        </method>
      </interface>
      <interface name="org.freedesktop.DBus.Peer">
        <method name="Ping"/>
        <method name="GetMachineId">
          <arg name="machine_uuid" type="s" direction="out"/>
        </method>
      </interface>
      <node name="ColorCorrect"/>
      <node name="ColorPicker"/>
      <node name="Compositor"/>
      <node name="Effects"/>
      <node name="FTrace"/>
      <node name="KWin"/>
      <node name="Plugins"/>
      <node name="Screenshot"/>
      <node name="Scripting"/>
      <node name="Session"/>
      <node name="VirtualDesktopManager"/>
      <node name="WindowsRunner"/>
    </node>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.