DBusObjectManagerClient

open class DBusObjectManagerClient(pointer: <Error class: unknown class><<Error class: unknown class>>) : AsyncInitable, DBusObjectManager, Initable

GDBusObjectManagerClient is used to create, monitor and delete object proxies for remote objects exported by a class@Gio.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 class@Gio.DBusObjectProxy objects returned by method@Gio.DBusObjectManager.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. method@Gio.DBusObjectManager.get_objects returns the empty list) and the property@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) – GDBusObjectManagerClient handles this case too; simply connect to the signal@GObject.Object::notify signal to watch for changes on the property@Gio.DBusObjectManagerClient:name-owner property. When the name owner vanishes, the behavior is that property@Gio.DBusObjectManagerClient:name-owner is set to NULL (this includes emission of the signal@GObject.Object::notify signal) and then signal@Gio.DBusObjectManager::object-removed signals are synthesized for all currently existing object proxies. Since property@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 iface@Gio.DBusObjectManager. Similarly, when a new name owner appears, signal@Gio.DBusObjectManager::object-added signals are synthesized while property@Gio.DBusObjectManagerClient:name-owner is still NULL. Only when all object proxies have been added, the property@Gio.DBusObjectManagerClient:name-owner is set to the new name owner (this includes emission of the signal@GObject.Object::notify signal). Furthermore, you are guaranteed that property@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, GDBusObjectManagerClient is used to obtain class@Gio.DBusProxy instances. All signals (including the org.freedesktop.DBus.Properties::PropertiesChanged signal) delivered to class@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 class@Gio.DBusObjectProxy and class@Gio.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 GDBusObjectManagerClient 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 method@GLib.MainContext.push_thread_default) that the GDBusObjectManagerClient object was constructed in. Additionally, the class@Gio.DBusObjectProxy and class@Gio.DBusProxy objects originating from the GDBusObjectManagerClient object will be created in the same context and, consequently, will deliver signals in the same main loop.

Skipped during bindings generation

  • method bus-type: Property has no getter nor setter

  • method get-proxy-type-destroy-notify: Property has no getter nor setter

  • method get-proxy-type-func: Property has no getter nor setter

  • method get-proxy-type-user-data: Property has no getter nor setter

  • method object-path: Property has no getter nor setter

Since

2.30

Constructors

Link copied to clipboard
constructor(res: AsyncResult)

Finishes an operation started with g_dbus_object_manager_client_new().

constructor(busType: BusType, flags: DBusObjectManagerClientFlags, name: String, objectPath: String, getProxyTypeFunc: DBusProxyTypeFunc?, cancellable: Cancellable? = null)

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

constructor(connection: DBusConnection, flags: DBusObjectManagerClientFlags, name: String? = null, objectPath: String, getProxyTypeFunc: DBusProxyTypeFunc?, cancellable: Cancellable? = null)

Creates a new #GDBusObjectManagerClient object.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The #GDBusConnection to use.

Link copied to clipboard

Flags from the #GDBusObjectManagerClientFlags enumeration.

Link copied to clipboard
open override val gioAsyncInitablePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
val gioDBusObjectManagerClientPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open override val gioDBusObjectManagerPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open override val gioInitablePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val name: String

The well-known name or unique name that the manager is for.

Link copied to clipboard
open val nameOwner: String?

The unique name that owns #GDBusObjectManagerClient:name or null if no-one is currently owning the name. Connect to the #GObject::notify signal to track changes to this property.

Functions

Link copied to clipboard
open fun connectInterfaceAdded(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (object: DBusObject, interface: DBusInterface) -> Unit): <Error class: unknown class>

Emitted when @interface is added to @object.

Link copied to clipboard
fun connectInterfaceProxyPropertiesChanged(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (objectProxy: DBusObjectProxy, interfaceProxy: DBusProxy, <Error class: unknown class>, invalidatedProperties: List<String>) -> Unit): <Error class: unknown class>

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).

Link copied to clipboard
fun connectInterfaceProxySignal(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (objectProxy: DBusObjectProxy, interfaceProxy: DBusProxy, senderName: String, signalName: String, <Error class: unknown class>) -> Unit): <Error class: unknown class>

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

Link copied to clipboard
open fun connectInterfaceRemoved(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (object: DBusObject, interface: DBusInterface) -> Unit): <Error class: unknown class>

Emitted when @interface has been removed from @object.

Link copied to clipboard
open fun connectObjectAdded(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (object: DBusObject) -> Unit): <Error class: unknown class>

Emitted when @object is added to @manager.

Link copied to clipboard
open fun connectObjectRemoved(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (object: DBusObject) -> Unit): <Error class: unknown class>

Emitted when @object is removed from @manager.

Link copied to clipboard
open fun getInterface(objectPath: String, interfaceName: String): DBusInterface?

Gets the interface proxy for @interface_name at @object_path, if any.

Link copied to clipboard
open fun getObject(objectPath: String): DBusObject?

Gets the #GDBusObject at @object_path, if any.

Link copied to clipboard
open fun getObjectPath(): String

Gets the object path that @manager is for.

Link copied to clipboard
open fun getObjects(): <Error class: unknown class>

Gets all #GDBusObject objects known to @manager.

Link copied to clipboard
open fun init(cancellable: Cancellable? = null): <Error class: unknown class><Boolean>

Initializes the object implementing the interface.

Link copied to clipboard
open fun initAsync(ioPriority: <Error class: unknown class>, cancellable: Cancellable? = null, callback: AsyncReadyCallback?)

Starts asynchronous initialization of the object implementing the interface. This must be done before any real use of the object after initial construction. If the object also implements #GInitable you can optionally call g_initable_init() instead.

Link copied to clipboard
open fun initFinish(res: AsyncResult): <Error class: unknown class><Boolean>

Finishes asynchronous initialization and returns the result. See g_async_initable_init_async().

Link copied to clipboard
open fun newFinish(res: AsyncResult): <Error class: unknown class><<Error class: unknown class>>

Finishes the async construction for the various g_async_initable_new calls, returning the created object or null on error.