glibmm: Gio::DBus::ObjectManagerServer Class Reference

glibmm 2.62.0

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gio::DBus::ObjectManagerServer Class Reference
D-Bus API

Service-side object manager. More...

`#include <giomm/dbusobjectmanagerserver.h>`

Inheritance diagram for Gio::DBus::ObjectManagerServer:
[legend]

## Public Member Functions
| ObjectManagerServer (ObjectManagerServer&& src) noexcept
ObjectManagerServer& | operator= (ObjectManagerServer&& src) noexcept
| ~ObjectManagerServer () noexcept override
GDBusObjectManagerServer* | gobj ()
| Provides access to the underlying C GObject. More...
const GDBusObjectManagerServer* | gobj () const
| Provides access to the underlying C GObject. More...
GDBusObjectManagerServer* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
Glib::RefPtr< Connection > | get_connection ()
| Gets the DBusConnection used by manager. More...
Glib::RefPtr< const Connection > | get_connection () const
| Gets the DBusConnection used by manager. More...
void | set_connection (const Glib::RefPtr< Connection >& connection)
| Exports all objects managed by manager on connection. More...
void | export_object (const Glib::RefPtr< Gio::DBus::ObjectSkeleton >& object)
| Exports object on manager. More...
void | export_uniquely (const Glib::RefPtr< Gio::DBus::ObjectSkeleton >& object)
| Like g_dbus_object_manager_server_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. More...
bool | is_exported (const Glib::RefPtr< Gio::DBus::ObjectSkeleton >& object) const
| Returns whether object is currently exported on manager. More...
bool | unexport (const Glib::ustring& object_path)
| If manager has an object at path, removes the object. More...
Glib::PropertyProxy< Glib::RefPtr< Connection > > | property_connection ()
| The DBusConnection to export objects on. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Connection > > | property_connection () const
| The DBusConnection to export objects on. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_object_path () const
| The object path to register the manager object at. More...
Public Member Functions inherited from Glib::Object
| Object (const Object&)=delete
Object& | operator= (const Object&)=delete
| Object (Object&& src) noexcept
Object& | operator= (Object&& src) noexcept
void* | get_data (const QueryQuark& key)
void | set_data (const Quark& key, void* data)
void | set_data (const Quark& key, void* data, DestroyNotify notify)
void | remove_data (const QueryQuark& quark)
void* | steal_data (const QueryQuark& quark)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase&)=delete
ObjectBase& | operator= (const ObjectBase&)=delete
void | set_property_value (const Glib::ustring& property_name, const Glib::ValueBase& value)
| You probably want to use a specific property_*() accessor method instead. More...
void | get_property_value (const Glib::ustring& property_name, Glib::ValueBase& value) const
| You probably want to use a specific property_*() accessor method instead. More...
template<class PropertyType >
void | set_property (const Glib::ustring& property_name, const PropertyType& value)
| You probably want to use a specific property_*() accessor method instead. More...
template<class PropertyType >
void | get_property (const Glib::ustring& property_name, PropertyType& value) const
| You probably want to use a specific property_*() accessor method instead. More...
void | connect_property_changed (const Glib::ustring& property_name, const sigc::slot< void >& slot)
| You can use the signal_changed() signal of the property proxy instead. More...
void | connect_property_changed (const Glib::ustring& property_name, sigc::slot< void >&& slot)
| You can use the signal_changed() signal of the property proxy instead. More...
sigc::connection | connect_property_changed_with_return (const Glib::ustring& property_name, const sigc::slot< void >& slot)
| You can use the signal_changed() signal of the property proxy instead. More...
sigc::connection | connect_property_changed_with_return (const Glib::ustring& property_name, sigc::slot< void >&& slot)
| You can use the signal_changed() signal of the property proxy instead. More...
void | freeze_notify ()
| Increases the freeze count on object. More...
void | thaw_notify ()
| Reverts the effect of a previous call to freeze_notify(). More...
virtual void | reference () const
| Increment the reference count for this object. More...
virtual void | unreference () const
| Decrement the reference count for this object. More...
GObject* | gobj ()
| Provides access to the underlying C GObject. More...
const GObject* | gobj () const
| Provides access to the underlying C GObject. More...
GObject* | gobj_copy () const
| Give a ref-ed copy to someone. Use for direct struct access. More...
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src)
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src)
void | remove_destroy_notify_callback (void *data) const
Public Member Functions inherited from Gio::DBus::ObjectManager
| ObjectManager (ObjectManager&& src) noexcept
ObjectManager& | operator= (ObjectManager&& src) noexcept
| ~ObjectManager () noexcept override
GDBusObjectManager* | gobj ()
| Provides access to the underlying C GObject. More...
const GDBusObjectManager* | gobj () const
| Provides access to the underlying C GObject. More...
Glib::ustring | get_object_path () const
| Gets the object path that manager is for. More...
std::vector< Glib::RefPtr< Gio::DBus::Object > > | get_objects ()
| Gets all DBusObject objects known to manager. More...
std::vector< Glib::RefPtr< const Gio::DBus::Object > > | get_objects () const
| Gets all DBusObject objects known to manager. More...
Glib::RefPtr< Gio::DBus::Object > | get_object (const Glib::ustring& object_path)
| Gets the DBusObjectProxy at object_path, if any. More...
Glib::RefPtr< const Gio::DBus::Object > | get_object (const Glib::ustring& object_path) const
| Gets the DBusObjectProxy at object_path, if any. More...
Glib::RefPtr< Gio::DBus::Interface > | get_interface (const Glib::ustring& object_path, const Glib::ustring& interface_name)
| Gets the interface proxy for interface_name at object_path, if any. More...
Glib::RefPtr< const Gio::DBus::Interface > | get_interface (const Glib::ustring& object_path, const Glib::ustring& interface_name) const
| Gets the interface proxy for interface_name at object_path, if any. More...
Glib::SignalProxy< void, const Glib::RefPtr< Gio::DBus::Object >& > | signal_object_added ()
Glib::SignalProxy< void, const Glib::RefPtr< Gio::DBus::Object >& > | signal_object_removed ()
Glib::SignalProxy< void, const Glib::RefPtr< Gio::DBus::Object >&, const Glib::RefPtr< Gio::DBus::Interface >& > | signal_interface_added ()
Glib::SignalProxy< void, const Glib::RefPtr< Gio::DBus::Object >&, const Glib::RefPtr< Gio::DBus::Interface >& > | signal_interface_removed ()
Public Member Functions inherited from Glib::Interface
| Interface ()
| A Default constructor. More...
| Interface (Interface&& src) noexcept
Interface& | operator= (Interface&& src) noexcept
| Interface (const Glib::Interface_Class& interface_class)
| Called by constructors of derived classes. More...
| Interface (GObject* castitem)
| Called by constructors of derived classes. More...
| ~Interface () noexcept override
| Interface (const Interface&)=delete
Interface& | operator= (const Interface&)=delete
GObject* | gobj ()
const GObject* | gobj () const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static Glib::RefPtr< ObjectManagerServer > | create (const Glib::ustring& object_path)
| Creates a new Gio::DBus::ObjectManagerServer object. More...
Static Public Member Functions inherited from Gio::DBus::ObjectManager
static void | add_interface (GType gtype_implementer)
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...

## Protected Member Functions
| ObjectManagerServer (const Glib::ustring& object_path)
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams& construct_params)
| Object (GObject* castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| This default constructor is called implicitly from the constructor of user-derived classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor. More...
| ObjectBase (const char* custom_type_name)
| A derived constructor always overrides this choice. More...
| ObjectBase (const std::type_info& custom_type_info)
| This constructor is a special feature to allow creation of derived types on the fly, without having to use g_object_new() manually. More...
| ObjectBase (ObjectBase&& src) noexcept
ObjectBase& | operator= (ObjectBase&& src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject* castitem)
void | initialize_move (GObject* castitem, Glib::ObjectBase* previous_wrapper)
Protected Member Functions inherited from Gio::DBus::ObjectManager
| ObjectManager ()
| You should derive from this class to use it. More...
virtual Glib::ustring | get_object_path_vfunc () const
virtual std::vector< Glib::RefPtr< Gio::DBus::Object > > | get_objects_vfunc () const
virtual Glib::RefPtr< Gio::DBus::Object > | get_object_vfunc (const Glib::ustring& object_path) const
virtual Glib::RefPtr< Gio::DBus::Interface > | get_interface_vfunc (const Glib::ustring& object_path, const Glib::ustring& interface_name) const
virtual void | on_object_added (const Glib::RefPtr< Gio::DBus::Object >& object)
| This is a default handler for the signal signal_object_added(). More...
virtual void | on_object_removed (const Glib::RefPtr< Gio::DBus::Object >& object)
| This is a default handler for the signal signal_object_removed(). More...
virtual void | on_interface_added (const Glib::RefPtr< Gio::DBus::Object >& object, const Glib::RefPtr< Gio::DBus::Interface >& iface)
| This is a default handler for the signal signal_interface_added(). More...
virtual void | on_interface_removed (const Glib::RefPtr< Gio::DBus::Object >& object, const Glib::RefPtr< Gio::DBus::Interface >& iface)
| This is a default handler for the signal signal_interface_removed(). More...

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gio::DBus::ObjectManagerServer > | wrap (GDBusObjectManagerServer* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Glib::Object
Glib::RefPtr< Glib::Object > | wrap (GObject* object, bool take_copy=false)
Related Functions inherited from Gio::DBus::ObjectManager
Glib::RefPtr< Gio::DBus::ObjectManager > | wrap (GDBusObjectManager* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members
Public Types inherited from Glib::Object
using | DestroyNotify = void(*)(gpointer data)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

Service-side object manager.

Gio::DBus::ObjectManagerServer is used to export Gio::DBus::Object 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::DBus::ObjectManagerClient for the client-side code that is intended to be used with ObjectManagerServer or any D-Bus object implementing the org.freedesktop.DBus.ObjectManager interface.

Since glibmm 2.62:

## Constructor & Destructor Documentation

## ◆ ObjectManagerServer() [1/2]

Gio::DBus::ObjectManagerServer::ObjectManagerServer | ( | ObjectManagerServer&& | src | ) |
| noexcept

## ◆ ~ObjectManagerServer()

Gio::DBus::ObjectManagerServer::~ObjectManagerServer | ( |  | ) |
| overridenoexcept

## ◆ ObjectManagerServer() [2/2]

Gio::DBus::ObjectManagerServer::ObjectManagerServer | ( | const Glib::ustring& | object_path | ) |
| explicitprotected

## Member Function Documentation

## ◆ create()

static Glib::RefPtr<ObjectManagerServer> Gio::DBus::ObjectManagerServer::create | ( | const Glib::ustring& | object_path | ) |
| static

Creates a new Gio::DBus::ObjectManagerServer object.

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

Parameters

  object_path | The object path to export the manager object at.

Returns
  A new Gio::DBus::ObjectManagerServer object.

## ◆ export_object()

void Gio::DBus::ObjectManagerServer::export_object | ( | const Glib::RefPtr< Gio::DBus::ObjectSkeleton >& | object | ) |

Exports object on manager.

If there is already a 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 manager.

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

Since glibmm 2.30:

Parameters

  object | A DBusObjectSkeleton.

## ◆ export_uniquely()

void Gio::DBus::ObjectManagerServer::export_uniquely | ( | const Glib::RefPtr< Gio::DBus::ObjectSkeleton >& | object | ) |

Like g_dbus_object_manager_server_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 DBusObjectProxy::property_g_object_path() property of object may be modified.

Since glibmm 2.30:

Parameters

  object | An object.

## ◆ get_connection() [1/2]

Glib::RefPtr<Connection> Gio::DBus::ObjectManagerServer::get_connection | ( |  | ) |

Gets the DBusConnection used by manager.

Since glibmm 2.30:

Returns
  A DBusConnection object or `nullptr` if manager isn't exported on a connection. The returned object should be freed with Glib::object_unref().

## ◆ get_connection() [2/2]

Glib::RefPtr<const Connection> Gio::DBus::ObjectManagerServer::get_connection | ( |  | ) | const

Gets the DBusConnection used by manager.

Since glibmm 2.30:

Returns
  A DBusConnection object or `nullptr` if manager isn't exported on a connection. The returned object should be freed with Glib::object_unref().

## ◆ get_type()

static GType Gio::DBus::ObjectManagerServer::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

GDBusObjectManagerServer* Gio::DBus::ObjectManagerServer::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GDBusObjectManagerServer* Gio::DBus::ObjectManagerServer::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GDBusObjectManagerServer* Gio::DBus::ObjectManagerServer::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ is_exported()

bool Gio::DBus::ObjectManagerServer::is_exported | ( | const Glib::RefPtr< Gio::DBus::ObjectSkeleton >& | object | ) | const

Returns whether object is currently exported on manager.

Since glibmm 2.34:

Parameters

  object | An object.

Returns
  `true` if object is exported.

## ◆ operator=()

ObjectManagerServer& Gio::DBus::ObjectManagerServer::operator= | ( | ObjectManagerServer&& | src | ) |
| noexcept

## ◆ property_connection() [1/2]

Glib::PropertyProxy< Glib::RefPtr<Connection> > Gio::DBus::ObjectManagerServer::property_connection | ( |  | ) |

The DBusConnection to export objects on.

Since glibmm 2.30:

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_connection() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Connection> > Gio::DBus::ObjectManagerServer::property_connection | ( |  | ) | const

The DBusConnection to export objects on.

Since glibmm 2.30:

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_object_path()

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gio::DBus::ObjectManagerServer::property_object_path | ( |  | ) | const

The object path to register the manager object at.

Since glibmm 2.30:

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ set_connection()

void Gio::DBus::ObjectManagerServer::set_connection | ( | const Glib::RefPtr< Connection >& | connection | ) |

Exports all objects managed by manager on connection.

If connection is `nullptr`, stops exporting objects.

Parameters

  connection | A DBusConnection or `nullptr`.

## ◆ unexport()

bool Gio::DBus::ObjectManagerServer::unexport | ( | const Glib::ustring& | object_path | ) |

If manager 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 manager.

Since glibmm 2.30:

Parameters

  object_path | An object path.

Returns
  `true` if object at object_path was removed, `false` otherwise.

## Friends And Related Function Documentation

## ◆ wrap()

Glib::RefPtr< Gio::DBus::ObjectManagerServer > wrap | ( | GDBusObjectManagerServer * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.