Gio.DBusObjectManagerClient

const Gio = imports.gi.Gio;

let dBusObjectManagerClient = new Gio.DBusObjectManagerClient({
    bus_type: value,
    connection: value,
    flags: value,
    get_proxy_type_destroy_notify: value,
    get_proxy_type_func: value,
    get_proxy_type_user_data: value,
    name: value,
    object_path: value,
});
  

Gio.DBusObjectManagerClient is used to create, monitor and delete object proxies for remote objects exported by a Gio.DBusObjectManagerServer (or any code implementing the [org.freedesktop.DBus.ObjectManager](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager) interface).

Once an instance of this type has been created, you can connect to the Gio.DBusObjectManager::object-added and Gio.DBusObjectManager::object-removed signals and inspect the Gio.DBusObjectProxy objects returned by Gio.DBusObjectManager.prototype.get_objects.

If the name for a Gio.DBusObjectManagerClient is not owned by anyone at object construction time, the default behavior is to request the message bus to launch an owner for the name. This behavior can be disabled using the Gio.DBusObjectManagerClientFlags.do_not_auto_start flag. It's also worth noting that this only works if the name of interest is activatable in the first place. E.g. in some cases it is not possible to launch an owner for the requested name. In this case, Gio.DBusObjectManagerClient object construction still succeeds but there will be no object proxies (e.g. Gio.DBusObjectManager.prototype.get_objects returns the empty list) and the Gio.DBusObjectManagerClient.name_owner property is null.

The owner of the requested name can come and go (for example consider a system service being restarted) – Gio.DBusObjectManagerClient handles this case too; simply connect to the GObject.Object::notify signal to watch for changes on the Gio.DBusObjectManagerClient.name_owner property. When the name owner vanishes, the behavior is that Gio.DBusObjectManagerClient.name_owner is set to null (this includes emission of the GObject.Object::notify signal) and then Gio.DBusObjectManager::object-removed signals are synthesized for all currently existing object proxies. Since Gio.DBusObjectManagerClient.name_owner is null when this happens, you can use this information to disambiguate a synthesized signal from a genuine signal caused by object removal on the remote Gio.DBusObjectManager. Similarly, when a new name owner appears, Gio.DBusObjectManager::object-added signals are synthesized while Gio.DBusObjectManagerClient.name_owner is still null. Only when all object proxies have been added, the Gio.DBusObjectManagerClient.name_owner is set to the new name owner (this includes emission of the GObject.Object::notify signal). Furthermore, you are guaranteed that Gio.DBusObjectManagerClient.name_owner will alternate between a name owner (e.g. `:1.42`) and null even in the case where the name of interest is atomically replaced

Ultimately, Gio.DBusObjectManagerClient is used to obtain Gio.DBusProxy instances. All signals (including the org.freedesktop.DBus.Properties::PropertiesChanged signal) delivered to Gio.DBusProxy instances are guaranteed to originate from the name owner. This guarantee along with the behavior described above, means that certain race conditions including the "half the proxy is from the old owner and the other half is from the new owner" problem cannot happen.

To avoid having the application connect to signals on the returned Gio.DBusObjectProxy and Gio.DBusProxy objects, the Gio.DBusObject::interface-added, Gio.DBusObject::interface-removed, Gio.DBusProxy::g-properties-changed and Gio.DBusProxy::g-signal signals are also emitted on the Gio.DBusObjectManagerClient instance managing these objects. The signals emitted are Gio.DBusObjectManager::interface-added, Gio.DBusObjectManager::interface-removed, Gio.DBusObjectManagerClient::interface-proxy-properties-changed and Gio.DBusObjectManagerClient::interface-proxy-signal.

Note that all callbacks and signals are emitted in the [thread-default main context][g-main-context-push-thread-default] that the Gio.DBusObjectManagerClient object was constructed in. Additionally, the Gio.DBusObjectProxy and Gio.DBusProxy objects originating from the Gio.DBusObjectManagerClient object will be created in the same context and, consequently, will deliver signals in the same main loop.

Since 2.30

Hierarchy

  • GObject.Object
    • Gio.DBusObjectManagerClient