DBusObjectManagerClient

GDBusObjectManagerClient is used to create, monitor and delete object proxies for remote objects exported by a GDBusObjectManagerServer (or any code implementing the org.freedesktop.DBus.ObjectManager

interface).

Once an instance of this type has been created, you can connect to the object-added and object-removed signals and inspect the GDBusObjectProxy objects returned by g_dbus_object_manager_get_objects().

If the name for a GDBusObjectManagerClient 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 G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_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, GDBusObjectManagerClient object construction still succeeds but there will be no object proxies (e.g. g_dbus_object_manager_get_objects() returns the empty list) and the name-owner property is NULL.

The owner of the requested name can come and go (for example consider a system service being restarted) – GDBusObjectManagerClient handles this case too; simply connect to the notify signal to watch for changes on the name-owner property. When the name owner vanishes, the behavior is that name-owner is set to NULL (this includes emission of the notify signal) and then object-removed signals are synthesized for all currently existing object proxies. Since 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 GDBusObjectManager Similarly, when a new name owner appears, object-added signals are synthesized while name-owner is still NULL. Only when all object proxies have been added, the name-owner is set to the new name owner (this includes emission of the notify signal). Furthermore, you are guaranteed that 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, GDBusObjectManagerClient is used to obtain GDBusProxy instances. All signals (including the org.freedesktop.DBus.Properties::PropertiesChanged signal) delivered to GDBusProxy 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 GDBusObjectProxy and GDBusProxy objects, the interface-added, interface-removed, g-properties-changed and g-signal signals are also emitted on the GDBusObjectManagerClient instance managing these objects. The signals emitted are interface-added, interface-removed, interface-proxy-properties-changed and 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 GDBusObjectManagerClient object was constructed in. Additionally, the GDBusObjectProxy and GDBusProxy objects originating from the GDBusObjectManagerClient object will be created in the same context and, consequently, will deliver signals in the same main loop.

class DBusObjectManagerClient : ObjectG, AsyncInitableIF, DBusObjectManagerIF, InitableIF {}

Constructors

this
this(GDBusObjectManagerClient* gDBusObjectManagerClient, bool ownedRef = false)

Sets our main struct and passes it to the parent class.

this
this(AsyncResultIF res, bool forBus = false)

Finishes an operation started with g_dbus_object_manager_client_new().

this
this(GBusType busType, GDBusObjectManagerClientFlags flags, string name, string objectPath, GDBusProxyTypeFunc getProxyTypeFunc, void* getProxyTypeUserData, GDestroyNotify getProxyTypeDestroyNotify, Cancellable cancellable)

Like g_dbus_object_manager_client_new_sync() but takes a GBusType instead of a GDBusConnection

this
this(DBusConnection connection, GDBusObjectManagerClientFlags flags, string name, string objectPath, GDBusProxyTypeFunc getProxyTypeFunc, void* getProxyTypeUserData, GDestroyNotify getProxyTypeDestroyNotify, Cancellable cancellable)

Creates a new GDBusObjectManagerClient object.

Members

Functions

addOnInterfaceProxyPropertiesChanged
gulong addOnInterfaceProxyPropertiesChanged(void delegate(DBusObjectProxy, DBusProxy, Variant, string[], DBusObjectManagerClient) dlg, ConnectFlags connectFlags = cast(ConnectFlags)0)

Emitted when one or more D-Bus properties on proxy changes. The local cache has already been updated when this signal fires. Note that both changed_properties and invalidated_properties are guaranteed to never be NULL (either may be empty though).

addOnInterfaceProxySignal
gulong addOnInterfaceProxySignal(void delegate(DBusObjectProxy, DBusProxy, string, string, Variant, DBusObjectManagerClient) dlg, ConnectFlags connectFlags = cast(ConnectFlags)0)

Emitted when a D-Bus signal is received on interface_proxy.

getConnection
DBusConnection getConnection()

Gets the GDBusConnection used by manager.

getDBusObjectManagerClientStruct
GDBusObjectManagerClient* getDBusObjectManagerClientStruct(bool transferOwnership = false)

Get the main Gtk struct

getFlags
GDBusObjectManagerClientFlags getFlags()

Gets the flags that manager was constructed with.

getName
string getName()

Gets the name that manager is for, or NULL if not a message bus connection.

getNameOwner
string getNameOwner()

The unique name that owns the name that manager is for or NULL if no-one currently owns that name. You can connect to the notify signal to track changes to the name-owner property.

getStruct
void* getStruct()

the main Gtk struct as a void*

Static functions

getType
GType getType()
newForBus
void newForBus(GBusType busType, GDBusObjectManagerClientFlags flags, string name, string objectPath, GDBusProxyTypeFunc getProxyTypeFunc, void* getProxyTypeUserData, GDestroyNotify getProxyTypeDestroyNotify, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

Like g_dbus_object_manager_client_new() but takes a GBusType instead of a GDBusConnection

newObjectManagerClient
void newObjectManagerClient(DBusConnection connection, GDBusObjectManagerClientFlags flags, string name, string objectPath, GDBusProxyTypeFunc getProxyTypeFunc, void* getProxyTypeUserData, GDestroyNotify getProxyTypeDestroyNotify, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

Asynchronously creates a new GDBusObjectManagerClient object.

Variables

gDBusObjectManagerClient
GDBusObjectManagerClient* gDBusObjectManagerClient;

the main Gtk struct

Meta

Since

2.30