gi-gio-2.0.29: Gio bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gio.Objects.DBusObjectManagerClient

Description

DBusObjectManagerClient is used to create, monitor and delete object proxies for remote objects exported by a 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 DBusObjectManager::objectAdded and DBusObjectManager::objectRemoved signals and inspect the DBusObjectProxy objects returned by dBusObjectManagerGetObjects.

If the name for a 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 DBusObjectManagerClientFlagsDoNotAutoStart 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, DBusObjectManagerClient object construction still succeeds but there will be no object proxies (e.g. dBusObjectManagerGetObjects returns the empty list) and the DBusObjectManagerClient:nameOwner property is Nothing.

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

Ultimately, DBusObjectManagerClient is used to obtain DBusProxy instances. All signals (including the org.freedesktop.DBus.Properties[PropertiesChanged](#g:signal:PropertiesChanged) signal) delivered to 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 DBusObjectProxy and DBusProxy objects, the DBusObject::interfaceAdded, DBusObject::interfaceRemoved, DBusProxy::gPropertiesChanged and DBusProxy::gSignal signals are also emitted on the DBusObjectManagerClient instance managing these objects. The signals emitted are DBusObjectManager::interfaceAdded, DBusObjectManager::interfaceRemoved, DBusObjectManagerClient::interfaceProxyPropertiesChanged and DBusObjectManagerClient::interfaceProxySignal.

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

Since: 2.30

Synopsis

Exported types

newtype DBusObjectManagerClient Source #

Memory-managed wrapper type.

class (GObject o, IsDescendantOf DBusObjectManagerClient o) => IsDBusObjectManagerClient o Source #

Type class for types which can be safely cast to DBusObjectManagerClient, for instance with toDBusObjectManagerClient.

toDBusObjectManagerClient :: (MonadIO m, IsDBusObjectManagerClient o) => o -> m DBusObjectManagerClient Source #

Cast to DBusObjectManagerClient, for types for which this is known to be safe. For general casts, use castTo.

Methods

getConnection

dBusObjectManagerClientGetConnection Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusObjectManagerClient a) 
=> a

manager: A DBusObjectManagerClient

-> m DBusConnection

Returns: A DBusConnection object. Do not free, the object belongs to manager.

Gets the DBusConnection used by manager.

Since: 2.30

getFlags

dBusObjectManagerClientGetFlags Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusObjectManagerClient a) 
=> a

manager: A DBusObjectManagerClient

-> m [DBusObjectManagerClientFlags]

Returns: Zero of more flags from the DBusObjectManagerClientFlags enumeration.

Gets the flags that manager was constructed with.

Since: 2.30

getName

dBusObjectManagerClientGetName Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusObjectManagerClient a) 
=> a

manager: A DBusObjectManagerClient

-> m Text

Returns: A unique or well-known name. Do not free, the string belongs to manager.

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

Since: 2.30

getNameOwner

dBusObjectManagerClientGetNameOwner Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusObjectManagerClient a) 
=> a

manager: A DBusObjectManagerClient.

-> m (Maybe Text)

Returns: The name owner or Nothing if no name owner exists. Free with free.

The unique name that owns the name that manager is for or Nothing if no-one currently owns that name. You can connect to the Object::notify signal to track changes to the DBusObjectManagerClient:nameOwner property.

Since: 2.30

new

dBusObjectManagerClientNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusConnection a, IsCancellable b) 
=> a

connection: A DBusConnection.

-> [DBusObjectManagerClientFlags]

flags: Zero or more flags from the DBusObjectManagerClientFlags enumeration.

-> Text

name: The owner of the control object (unique or well-known name).

-> Text

objectPath: The object path of the control object.

-> Maybe DBusProxyTypeFunc

getProxyTypeFunc: A DBusProxyTypeFunc function or Nothing to always construct DBusProxy proxies.

-> Maybe b

cancellable: A Cancellable or Nothing

-> Maybe AsyncReadyCallback

callback: A AsyncReadyCallback to call when the request is satisfied.

-> m () 

Asynchronously creates a new DBusObjectManagerClient object.

This is an asynchronous failable constructor. When the result is ready, callback will be invoked in the [thread-default main context][g-main-context-push-thread-default] of the thread you are calling this method from. You can then call dBusObjectManagerClientNewFinish to get the result. See dBusObjectManagerClientNewSync for the synchronous version.

Since: 2.30

newFinish

dBusObjectManagerClientNewFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsAsyncResult a) 
=> a

res: A AsyncResult obtained from the AsyncReadyCallback passed to dBusObjectManagerClientNew.

-> m DBusObjectManagerClient

Returns: A DBusObjectManagerClient object or Nothing if error is set. Free with objectUnref. (Can throw GError)

Finishes an operation started with dBusObjectManagerClientNew.

Since: 2.30

newForBus

dBusObjectManagerClientNewForBus Source #

Arguments

:: (HasCallStack, MonadIO m, IsCancellable a) 
=> BusType

busType: A BusType.

-> [DBusObjectManagerClientFlags]

flags: Zero or more flags from the DBusObjectManagerClientFlags enumeration.

-> Text

name: The owner of the control object (unique or well-known name).

-> Text

objectPath: The object path of the control object.

-> Maybe DBusProxyTypeFunc

getProxyTypeFunc: A DBusProxyTypeFunc function or Nothing to always construct DBusProxy proxies.

-> Maybe a

cancellable: A Cancellable or Nothing

-> Maybe AsyncReadyCallback

callback: A AsyncReadyCallback to call when the request is satisfied.

-> m () 

Like dBusObjectManagerClientNew but takes a BusType instead of a DBusConnection.

This is an asynchronous failable constructor. When the result is ready, callback will be invoked in the [thread-default main loop][g-main-context-push-thread-default] of the thread you are calling this method from. You can then call dBusObjectManagerClientNewForBusFinish to get the result. See dBusObjectManagerClientNewForBusSync for the synchronous version.

Since: 2.30

newForBusFinish

dBusObjectManagerClientNewForBusFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsAsyncResult a) 
=> a

res: A AsyncResult obtained from the AsyncReadyCallback passed to dBusObjectManagerClientNewForBus.

-> m DBusObjectManagerClient

Returns: A DBusObjectManagerClient object or Nothing if error is set. Free with objectUnref. (Can throw GError)

Finishes an operation started with dBusObjectManagerClientNewForBus.

Since: 2.30

newForBusSync

dBusObjectManagerClientNewForBusSync Source #

Arguments

:: (HasCallStack, MonadIO m, IsCancellable a) 
=> BusType

busType: A BusType.

-> [DBusObjectManagerClientFlags]

flags: Zero or more flags from the DBusObjectManagerClientFlags enumeration.

-> Text

name: The owner of the control object (unique or well-known name).

-> Text

objectPath: The object path of the control object.

-> Maybe DBusProxyTypeFunc

getProxyTypeFunc: A DBusProxyTypeFunc function or Nothing to always construct DBusProxy proxies.

-> Maybe a

cancellable: A Cancellable or Nothing

-> m DBusObjectManagerClient

Returns: A DBusObjectManagerClient object or Nothing if error is set. Free with objectUnref. (Can throw GError)

Like dBusObjectManagerClientNewSync but takes a BusType instead of a DBusConnection.

This is a synchronous failable constructor - the calling thread is blocked until a reply is received. See dBusObjectManagerClientNewForBus for the asynchronous version.

Since: 2.30

newSync

dBusObjectManagerClientNewSync Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusConnection a, IsCancellable b) 
=> a

connection: A DBusConnection.

-> [DBusObjectManagerClientFlags]

flags: Zero or more flags from the DBusObjectManagerClientFlags enumeration.

-> Maybe Text

name: The owner of the control object (unique or well-known name), or Nothing when not using a message bus connection.

-> Text

objectPath: The object path of the control object.

-> Maybe DBusProxyTypeFunc

getProxyTypeFunc: A DBusProxyTypeFunc function or Nothing to always construct DBusProxy proxies.

-> Maybe b

cancellable: A Cancellable or Nothing

-> m DBusObjectManagerClient

Returns: A DBusObjectManagerClient object or Nothing if error is set. Free with objectUnref. (Can throw GError)

Creates a new DBusObjectManagerClient object.

This is a synchronous failable constructor - the calling thread is blocked until a reply is received. See dBusObjectManagerClientNew for the asynchronous version.

Since: 2.30

Properties

busType

If this property is not BusTypeNone, then DBusObjectManagerClient:connection must be Nothing and will be set to the DBusConnection obtained by calling busGet with the value of this property.

Since: 2.30

constructDBusObjectManagerClientBusType :: (IsDBusObjectManagerClient o, MonadIO m) => BusType -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “bus-type” property. This is rarely needed directly, but it is used by new.

connection

The DBusConnection to use.

Since: 2.30

constructDBusObjectManagerClientConnection :: (IsDBusObjectManagerClient o, MonadIO m, IsDBusConnection a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “connection” property. This is rarely needed directly, but it is used by new.

getDBusObjectManagerClientConnection :: (MonadIO m, IsDBusObjectManagerClient o) => o -> m DBusConnection Source #

Get the value of the “connection” property. When overloading is enabled, this is equivalent to

get dBusObjectManagerClient #connection

flags

Flags from the DBusObjectManagerClientFlags enumeration.

Since: 2.30

constructDBusObjectManagerClientFlags :: (IsDBusObjectManagerClient o, MonadIO m) => [DBusObjectManagerClientFlags] -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “flags” property. This is rarely needed directly, but it is used by new.

getDBusObjectManagerClientFlags :: (MonadIO m, IsDBusObjectManagerClient o) => o -> m [DBusObjectManagerClientFlags] Source #

Get the value of the “flags” property. When overloading is enabled, this is equivalent to

get dBusObjectManagerClient #flags

getProxyTypeDestroyNotify

A DestroyNotify for the gpointer user_data in DBusObjectManagerClient:getProxyTypeUserData.

Since: 2.30

constructDBusObjectManagerClientGetProxyTypeDestroyNotify :: (IsDBusObjectManagerClient o, MonadIO m) => Ptr () -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “get-proxy-type-destroy-notify” property. This is rarely needed directly, but it is used by new.

getDBusObjectManagerClientGetProxyTypeDestroyNotify :: (MonadIO m, IsDBusObjectManagerClient o) => o -> m (Ptr ()) Source #

Get the value of the “get-proxy-type-destroy-notify” property. When overloading is enabled, this is equivalent to

get dBusObjectManagerClient #getProxyTypeDestroyNotify

getProxyTypeFunc

The DBusProxyTypeFunc to use when determining what GType to use for interface proxies or Nothing.

Since: 2.30

constructDBusObjectManagerClientGetProxyTypeFunc :: (IsDBusObjectManagerClient o, MonadIO m) => Ptr () -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “get-proxy-type-func” property. This is rarely needed directly, but it is used by new.

getDBusObjectManagerClientGetProxyTypeFunc :: (MonadIO m, IsDBusObjectManagerClient o) => o -> m (Ptr ()) Source #

Get the value of the “get-proxy-type-func” property. When overloading is enabled, this is equivalent to

get dBusObjectManagerClient #getProxyTypeFunc

getProxyTypeUserData

The gpointer user_data to pass to DBusObjectManagerClient:getProxyTypeFunc.

Since: 2.30

constructDBusObjectManagerClientGetProxyTypeUserData :: (IsDBusObjectManagerClient o, MonadIO m) => Ptr () -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “get-proxy-type-user-data” property. This is rarely needed directly, but it is used by new.

getDBusObjectManagerClientGetProxyTypeUserData :: (MonadIO m, IsDBusObjectManagerClient o) => o -> m (Ptr ()) Source #

Get the value of the “get-proxy-type-user-data” property. When overloading is enabled, this is equivalent to

get dBusObjectManagerClient #getProxyTypeUserData

name

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

Since: 2.30

constructDBusObjectManagerClientName :: (IsDBusObjectManagerClient o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “name” property. This is rarely needed directly, but it is used by new.

getDBusObjectManagerClientName :: (MonadIO m, IsDBusObjectManagerClient o) => o -> m Text Source #

Get the value of the “name” property. When overloading is enabled, this is equivalent to

get dBusObjectManagerClient #name

nameOwner

The unique name that owns DBusObjectManagerClient:name or Nothing if no-one is currently owning the name. Connect to the Object::notify signal to track changes to this property.

Since: 2.30

getDBusObjectManagerClientNameOwner :: (MonadIO m, IsDBusObjectManagerClient o) => o -> m (Maybe Text) Source #

Get the value of the “name-owner” property. When overloading is enabled, this is equivalent to

get dBusObjectManagerClient #nameOwner

objectPath

The object path the manager is for.

Since: 2.30

constructDBusObjectManagerClientObjectPath :: (IsDBusObjectManagerClient o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “object-path” property. This is rarely needed directly, but it is used by new.

getDBusObjectManagerClientObjectPath :: (MonadIO m, IsDBusObjectManagerClient o) => o -> m (Maybe Text) Source #

Get the value of the “object-path” property. When overloading is enabled, this is equivalent to

get dBusObjectManagerClient #objectPath

Signals

interfaceProxyPropertiesChanged

type DBusObjectManagerClientInterfaceProxyPropertiesChangedCallback Source #

Arguments

 = DBusObjectProxy

objectProxy: The DBusObjectProxy on which an interface has properties that are changing.

-> DBusProxy

interfaceProxy: The DBusProxy that has properties that are changing.

-> GVariant

changedProperties: A GVariant containing the properties that changed (type: a{sv}).

-> [Text]

invalidatedProperties: A Nothing terminated array of properties that were invalidated.

-> IO () 

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 changedProperties and invalidatedProperties are guaranteed to never be Nothing (either may be empty though).

This signal exists purely as a convenience to avoid having to connect signals to all interface proxies managed by manager.

This signal is emitted in the [thread-default main context][g-main-context-push-thread-default] that manager was constructed in.

Since: 2.30

afterDBusObjectManagerClientInterfaceProxyPropertiesChanged :: (IsDBusObjectManagerClient a, MonadIO m) => a -> ((?self :: a) => DBusObjectManagerClientInterfaceProxyPropertiesChangedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the interfaceProxyPropertiesChanged signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after dBusObjectManagerClient #interfaceProxyPropertiesChanged callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onDBusObjectManagerClientInterfaceProxyPropertiesChanged :: (IsDBusObjectManagerClient a, MonadIO m) => a -> ((?self :: a) => DBusObjectManagerClientInterfaceProxyPropertiesChangedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the interfaceProxyPropertiesChanged signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on dBusObjectManagerClient #interfaceProxyPropertiesChanged callback

interfaceProxySignal

type DBusObjectManagerClientInterfaceProxySignalCallback Source #

Arguments

 = DBusObjectProxy

objectProxy: The DBusObjectProxy on which an interface is emitting a D-Bus signal.

-> DBusProxy

interfaceProxy: The DBusProxy that is emitting a D-Bus signal.

-> Text

senderName: The sender of the signal or NULL if the connection is not a bus connection.

-> Text

signalName: The signal name.

-> GVariant

parameters: A GVariant tuple with parameters for the signal.

-> IO () 

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

This signal exists purely as a convenience to avoid having to connect signals to all interface proxies managed by manager.

This signal is emitted in the [thread-default main context][g-main-context-push-thread-default] that manager was constructed in.

Since: 2.30

afterDBusObjectManagerClientInterfaceProxySignal :: (IsDBusObjectManagerClient a, MonadIO m) => a -> ((?self :: a) => DBusObjectManagerClientInterfaceProxySignalCallback) -> m SignalHandlerId Source #

Connect a signal handler for the interfaceProxySignal signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after dBusObjectManagerClient #interfaceProxySignal callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onDBusObjectManagerClientInterfaceProxySignal :: (IsDBusObjectManagerClient a, MonadIO m) => a -> ((?self :: a) => DBusObjectManagerClientInterfaceProxySignalCallback) -> m SignalHandlerId Source #

Connect a signal handler for the interfaceProxySignal signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on dBusObjectManagerClient #interfaceProxySignal callback