Ultimately, gio.dbus_object_manager_client.DBusObjectManagerClient is used to obtain
gio.dbus_proxy.DBusProxy instances. All signals (including the
org.freedesktop.DBus.Properties::PropertiesChanged signal)
delivered to gio.dbus_proxy.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.dbus_object_proxy.DBusObjectProxy and gio.dbus_proxy.DBusProxy objects, the
signal@Gio.DBusObject::interface-added,
signal@Gio.DBusObject::interface-removed,
signal@Gio.DBusProxy::g-properties-changed and
signal@Gio.DBusProxy::g-signal signals
are also emitted on the gio.dbus_object_manager_client.DBusObjectManagerClient instance managing these
objects. The signals emitted are
signal@Gio.DBusObjectManager::interface-added,
signal@Gio.DBusObjectManager::interface-removed,
signal@Gio.DBusObjectManagerClient::interface-proxy-properties-changed and
signal@Gio.DBusObjectManagerClient::interface-proxy-signal.
gio.dbus_object_manager_client.DBusObjectManagerClient is used to create, monitor and delete object proxies for remote objects exported by a gio.dbus_object_manager_server.DBusObjectManagerServer (or any code implementing the org.freedesktop.DBus.ObjectManager
interface).
Once an instance of this type has been created, you can connect to the signal@Gio.DBusObjectManager::object-added and signal@Gio.DBusObjectManager::object-removed signals and inspect the gio.dbus_object_proxy.DBusObjectProxy objects returned by gio.dbus_object_manager.DBusObjectManager.getObjects.
If the name for a gio.dbus_object_manager_client.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.types.DBusObjectManagerClientFlags.DoNotAutoStart 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.dbus_object_manager_client.DBusObjectManagerClient object construction still succeeds but there will be no object proxies (e.g. gio.dbus_object_manager.DBusObjectManager.getObjects returns the empty list) and the gio.dbus_object_manager_client.DBusObjectManagerClient.utf8 property is NULL.
The owner of the requested name can come and go (for example consider a system service being restarted) – gio.dbus_object_manager_client.DBusObjectManagerClient handles this case too; simply connect to the gobject.object.ObjectG.notify signal to watch for changes on the gio.dbus_object_manager_client.DBusObjectManagerClient.utf8 property. When the name owner vanishes, the behavior is that gio.dbus_object_manager_client.DBusObjectManagerClient.utf8 is set to NULL (this includes emission of the gobject.object.ObjectG.notify signal) and then signal@Gio.DBusObjectManager::object-removed signals are synthesized for all currently existing object proxies. Since gio.dbus_object_manager_client.DBusObjectManagerClient.utf8 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.dbus_object_manager.DBusObjectManager. Similarly, when a new name owner appears, signal@Gio.DBusObjectManager::object-added signals are synthesized while gio.dbus_object_manager_client.DBusObjectManagerClient.utf8 is still NULL. Only when all object proxies have been added, the gio.dbus_object_manager_client.DBusObjectManagerClient.utf8 is set to the new name owner (this includes emission of the gobject.object.ObjectG.notify signal). Furthermore, you are guaranteed that gio.dbus_object_manager_client.DBusObjectManagerClient.utf8 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.dbus_object_manager_client.DBusObjectManagerClient is used to obtain gio.dbus_proxy.DBusProxy instances. All signals (including the org.freedesktop.DBus.Properties::PropertiesChanged signal) delivered to gio.dbus_proxy.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.dbus_object_proxy.DBusObjectProxy and gio.dbus_proxy.DBusProxy objects, the signal@Gio.DBusObject::interface-added, signal@Gio.DBusObject::interface-removed, signal@Gio.DBusProxy::g-properties-changed and signal@Gio.DBusProxy::g-signal signals are also emitted on the gio.dbus_object_manager_client.DBusObjectManagerClient instance managing these objects. The signals emitted are signal@Gio.DBusObjectManager::interface-added, signal@Gio.DBusObjectManager::interface-removed, signal@Gio.DBusObjectManagerClient::interface-proxy-properties-changed and signal@Gio.DBusObjectManagerClient::interface-proxy-signal.
Note that all callbacks and signals are emitted in the thread-default main context (see glib.main_context.MainContext.pushThreadDefault) that the gio.dbus_object_manager_client.DBusObjectManagerClient object was constructed in. Additionally, the gio.dbus_object_proxy.DBusObjectProxy and gio.dbus_proxy.DBusProxy objects originating from the gio.dbus_object_manager_client.DBusObjectManagerClient object will be created in the same context and, consequently, will deliver signals in the same main loop.