Gio.DBusObjectManagerClient
Description: Reference for Gio.DBusObjectManagerClient

### Class

# GioDBusObjectManagerClient

since: 2.30

#### Description [src]

    class Gio.DBusObjectManagerClient : GObject.Object
      implements Gio.AsyncInitable, Gio.DBusObjectManager, Gio.Initable {
      /* No available fields */
    }

`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 `GDBusObjectManager::object-added` and [signal@Gio.DBusObjectManager::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 `GDBusObjectManagerClient: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 `GObject::notify` signal to watch for changes on the `GDBusObjectManagerClient:name-owner` property. When the name owner vanishes, the behavior is that `GDBusObjectManagerClient:name-owner` is set to `NULL` (this includes emission of the `GObject::notify` signal) and then `GDBusObjectManager::object-removed` signals are synthesized for all currently existing object proxies. Since `GDBusObjectManagerClient: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, `GDBusObjectManager::object-added` signals are synthesized while `GDBusObjectManagerClient:name-owner` is still `NULL`. Only when all object proxies have been added, the `GDBusObjectManagerClient:name-owner` is set to the new name owner (this includes emission of the `GObject::notify` signal). Furthermore, you are guaranteed that `GDBusObjectManagerClient: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 `GDBusObject::interface-added`, `GDBusObject::interface-removed`, `GDBusProxy::g-properties-changed` and `GDBusProxy::g-signal` signals are also emitted on the `GDBusObjectManagerClient` instance managing these objects. The signals emitted are `GDBusObjectManager::interface-added`, `GDBusObjectManager::interface-removed`, `GDBusObjectManagerClient::interface-proxy-properties-changed` and `GDBusObjectManagerClient::interface-proxy-signal`.

Note that all callbacks and signals are emitted in the thread-default main context (see `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.

Available since: 2.30

#### Hierarchy

#### Ancestors

- GObject

#### Implements

- GAsyncInitable
- GDBusObjectManager
- GInitable

#### Constructors

###### g_dbus_object_manager_client_new_finish

Finishes an operation started with g_dbus_object_manager_client_new().

since: 2.30

###### g_dbus_object_manager_client_new_for_bus_finish

Finishes an operation started with g_dbus_object_manager_client_new_for_bus().

since: 2.30

###### g_dbus_object_manager_client_new_for_bus_sync

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

since: 2.30

###### g_dbus_object_manager_client_new_sync

Creates a new `GDBusObjectManagerClient` object.

since: 2.30

#### Functions

###### g_dbus_object_manager_client_new

Asynchronously creates a new `GDBusObjectManagerClient` object.

since: 2.30

###### g_dbus_object_manager_client_new_for_bus

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

since: 2.30

#### Instance methods

###### g_dbus_object_manager_client_get_connection

Gets the `GDBusConnection` used by `manager`.

since: 2.30

###### g_dbus_object_manager_client_get_flags

Gets the flags that `manager` was constructed with.

since: 2.30

###### g_dbus_object_manager_client_get_name

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

since: 2.30

###### g_dbus_object_manager_client_get_name_owner

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 `GObject::notify` signal to track changes to the `GDBusObjectManagerClient:name-owner` property.

since: 2.30

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

##### Methods inherited from GAsyncInitable (3)

###### g_async_initable_init_async

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.

since: 2.22

###### g_async_initable_init_finish

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

since: 2.22

###### g_async_initable_new_finish

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

since: 2.22

##### Methods inherited from GDBusObjectManager (4)

###### g_dbus_object_manager_get_interface

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

since: 2.30

###### g_dbus_object_manager_get_object

Gets the `GDBusObject` at `object_path`, if any.

since: 2.30

###### g_dbus_object_manager_get_object_path

Gets the object path that `manager` is for.

since: 2.30

###### g_dbus_object_manager_get_objects

Gets all `GDBusObject` objects known to `manager`.

since: 2.30

##### Methods inherited from GInitable (1)

###### g_initable_init

Initializes the object implementing the interface.

since: 2.22

#### Properties

###### Gio.DBusObjectManagerClient:bus-type

If this property is not `G_BUS_TYPE_NONE`, then `GDBusObjectManagerClient:connection` must be `NULL` and will be set to the `GDBusConnection` obtained by calling `g_bus_get()` with the value of this property.

since: 2.30

###### Gio.DBusObjectManagerClient:connection

The `GDBusConnection` to use.

since: 2.30

###### Gio.DBusObjectManagerClient:flags

Flags from the `GDBusObjectManagerClientFlags` enumeration.

since: 2.30

###### Gio.DBusObjectManagerClient:get-proxy-type-destroy-notify

A `GDestroyNotify` for the #gpointer user_data in `GDBusObjectManagerClient:get-proxy-type-user-data`.

since: 2.30

###### Gio.DBusObjectManagerClient:get-proxy-type-func

The `GDBusProxyTypeFunc` to use when determining what `GType` to use for interface proxies or `NULL`.

since: 2.30

###### Gio.DBusObjectManagerClient:get-proxy-type-user-data

The #gpointer user_data to pass to `GDBusObjectManagerClient:get-proxy-type-func`.

since: 2.30

###### Gio.DBusObjectManagerClient:name

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

since: 2.30

###### Gio.DBusObjectManagerClient:name-owner

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.

since: 2.30

###### Gio.DBusObjectManagerClient:object-path

The object path the manager is for.

since: 2.30

#### Signals

###### Gio.DBusObjectManagerClient::interface-proxy-properties-changed

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

since: 2.30

###### Gio.DBusObjectManagerClient::interface-proxy-signal

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

since: 2.30

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

##### Signals inherited from GDBusObjectManager (4)

###### GDBusObjectManager::interface-added

Emitted when `interface` is added to `object`.

since: 2.30

###### GDBusObjectManager::interface-removed

Emitted when `interface` has been removed from `object`.

since: 2.30

###### GDBusObjectManager::object-added

Emitted when `object` is added to `manager`.

since: 2.30

###### GDBusObjectManager::object-removed

Emitted when `object` is removed from `manager`.

since: 2.30

#### Class structure

    struct GioDBusObjectManagerClientClass {
      GObjectClass parent_class;
      void (* interface_proxy_signal) (
        GDBusObjectManagerClient* manager,
        GDBusObjectProxy* object_proxy,
        GDBusProxy* interface_proxy,
        const gchar* sender_name,
        const gchar* signal_name,
        GVariant* parameters
      );
      void (* interface_proxy_properties_changed) (
        GDBusObjectManagerClient* manager,
        GDBusObjectProxy* object_proxy,
        GDBusProxy* interface_proxy,
        GVariant* changed_properties,
        const gchar* const* invalidated_properties
      );

    }

Class structure for `GDBusObjectManagerClient`.

###### Class members

`parent_class: GObjectClass`

  The parent class.

`interface_proxy_signal: void (* interface_proxy_signal) ( GDBusObjectManagerClient* manager, GDBusObjectProxy* object_proxy, GDBusProxy* interface_proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters )`

  Signal class handler for the `GDBusObjectManagerClient::interface-proxy-signal` signal.

`interface_proxy_properties_changed: void (* interface_proxy_properties_changed) ( GDBusObjectManagerClient* manager, GDBusObjectProxy* object_proxy, GDBusProxy* interface_proxy, GVariant* changed_properties, const gchar* const* invalidated_properties )`

  Signal class handler for the `GDBusObjectManagerClient::interface-proxy-properties-changed` signal.

#### Virtual methods

###### Gio.DBusObjectManagerClientClass.interface_proxy_properties_changed

Signal class handler for the `GDBusObjectManagerClient::interface-proxy-properties-changed` signal.

###### Gio.DBusObjectManagerClientClass.interface_proxy_signal

Signal class handler for the `GDBusObjectManagerClient::interface-proxy-signal` signal.