Gio.DBusObjectManagerServer

g GObject.GInterface GObject.GInterface Gio.DBusObjectManager Gio.DBusObjectManager GObject.GInterface->Gio.DBusObjectManager GObject.Object GObject.Object Gio.DBusObjectManagerServer Gio.DBusObjectManagerServer GObject.Object->Gio.DBusObjectManagerServer Gio.DBusObjectManager->Gio.DBusObjectManagerServer

Subclasses:None

Methods

Inherited:GObject.Object (37), Gio.DBusObjectManager (4)
Structs:GObject.ObjectClass (5)
class new (object_path)
  export (object)
  export_uniquely (object)
  get_connection ()
  is_exported (object)
  set_connection (connection)
  unexport (object_path)

Virtual Methods

Inherited:GObject.Object (7), Gio.DBusObjectManager (8)

Properties

Name Type Flags Short Description
connection Gio.DBusConnection r/w The connection to export objects on
object-path str r/w/co The object path to register the manager object at

Fields

Inherited:GObject.Object (1), Gio.DBusObjectManager (4)
Name Type Access Description
parent_instance GObject.Object r  

Class Details

class Gio.DBusObjectManagerServer(**kwargs)
Bases:GObject.Object, Gio.DBusObjectManager
Abstract:No
Structure:Gio.DBusObjectManagerServerClass

Gio.DBusObjectManagerServer is used to export Gio.DBusObject instances using the standardized org.freedesktop.DBus.ObjectManager interface. For example, remote D-Bus clients can get all objects and properties in a single call. Additionally, any change in the object hierarchy is broadcast using signals. This means that D-Bus clients can keep caches up to date by only listening to D-Bus signals.

The recommended path to export an object manager at is the path form of the well-known name of a D-Bus service, or below. For example, if a D-Bus service is available at the well-known name net.example.ExampleService1, the object manager should typically be exported at /net/example/ExampleService1, or below (to allow for multiple object managers in a service).

It is supported, but not recommended, to export an object manager at the root path, /.

See Gio.DBusObjectManagerClient for the client-side code that is intended to be used with Gio.DBusObjectManagerServer or any D-Bus object implementing the org.freedesktop.DBus.ObjectManager interface.

New in version 2.30.

classmethod new(object_path)[source]
Parameters:object_path (str) – The object path to export the manager object at.
Returns:A Gio.DBusObjectManagerServer object. Free with GObject.Object.unref().
Return type:Gio.DBusObjectManagerServer

Creates a new Gio.DBusObjectManagerServer object.

The returned server isn’t yet exported on any connection. To do so, use Gio.DBusObjectManagerServer.set_connection(). Normally you want to export all of your objects before doing so to avoid InterfacesAdded signals being emitted.

New in version 2.30.

export(object)[source]
Parameters:object (Gio.DBusObjectSkeleton) – A Gio.DBusObjectSkeleton.

Exports object on self.

If there is already a Gio.DBusObject exported at the object path, then the old object is removed.

The object path for object must be in the hierarchy rooted by the object path for self.

Note that self will take a reference on object for as long as it is exported.

New in version 2.30.

export_uniquely(object)[source]
Parameters:object (Gio.DBusObjectSkeleton) – An object.

Like Gio.DBusObjectManagerServer.export() but appends a string of the form _N (with N being a natural number) to object’s object path if an object with the given path already exists. As such, the Gio.DBusObjectProxy :g-object-path property of object may be modified.

New in version 2.30.

get_connection()[source]
Returns:A Gio.DBusConnection object or None if self isn’t exported on a connection. The returned object should be freed with GObject.Object.unref().
Return type:Gio.DBusConnection

Gets the Gio.DBusConnection used by self.

New in version 2.30.

is_exported(object)[source]
Parameters:object (Gio.DBusObjectSkeleton) – An object.
Returns:True if object is exported
Return type:bool

Returns whether object is currently exported on self.

New in version 2.34.

set_connection(connection)[source]
Parameters:connection (Gio.DBusConnection or None) – A Gio.DBusConnection or None.

Exports all objects managed by self on connection. If connection is None, stops exporting objects.

unexport(object_path)[source]
Parameters:object_path (str) – An object path.
Returns:True if object at object_path was removed, False otherwise.
Return type:bool

If self has an object at path, removes the object. Otherwise does nothing.

Note that object_path must be in the hierarchy rooted by the object path for self.

New in version 2.30.

Property Details

Gio.DBusObjectManagerServer.props.connection
Name:connection
Type:Gio.DBusConnection
Default Value:None
Flags:READABLE, WRITABLE

The Gio.DBusConnection to export objects on.

New in version 2.30.

Gio.DBusObjectManagerServer.props.object_path
Name:object-path
Type:str
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

The object path to register the manager object at.

New in version 2.30.