glibmm: Gio::DBus::InterfaceSkeleton Class Reference

Abstract base class for D-Bus interfaces on the service side. More...

#include <giomm/dbusinterfaceskeleton.h>

Inheritance diagram for Gio::DBus::InterfaceSkeleton:

Public Types

- 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
 
- Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify func_destroy_notify
 

Public Member Functions

 InterfaceSkeleton (InterfaceSkeleton&& src) noexcept
 
InterfaceSkeletonoperator= (InterfaceSkeleton&& src) noexcept
 
 ~InterfaceSkeleton () noexcept override
 
GDBusInterfaceSkeleton* gobj ()
 Provides access to the underlying C GObject. More...

 
const GDBusInterfaceSkeleton* gobj () const
 Provides access to the underlying C GObject. More...

 
GDBusInterfaceSkeleton* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...

 
void flush ()
 If interface has outstanding changes, request for these changes to be emitted immediately. More...

 
Glib::RefPtr< InterfaceInfoget_info ()
 Gets D-Bus introspection information for the D-Bus interface implemented by interface. More...

 
Glib::RefPtr< const InterfaceInfoget_info () const
 Gets D-Bus introspection information for the D-Bus interface implemented by interface. More...

 
Glib::VariantBase get_properties () const
 Gets all D-Bus properties for interface. More...

 
void export_interface_skeleton (const Glib::RefPtr< Connection >& connection, const Glib::ustring& object_path)
 Exports interface at object_path on connection. More...

 
void unexport ()
 Stops exporting interface on all connections it is exported on. More...

 
void unexport_from_connection (const Glib::RefPtr< Connection >& connection)
 Stops exporting interface on connection. More...

 
Glib::RefPtr< Connectionget_connection ()
 Gets the first connection that interface is exported on, if any. More...

 
Glib::RefPtr< const Connectionget_connection () const
 Gets the first connection that interface is exported on, if any. More...

 
std::vector< Glib::RefPtr< Connection > > get_connections ()
 Gets a list of the connections that interface is exported on. More...

 
std::vector< Glib::RefPtr< const Connection > > get_connections () const
 Gets a list of the connections that interface is exported on. More...

 
bool has_connection (const Glib::RefPtr< const Connection >& connection) const
 Checks if interface is exported on connection. More...

 
Glib::ustring get_object_path () const
 Gets the object path that interface is exported on, if any. More...

 
Flags get_flags () const
 Gets the Gio::DBus::InterfaceSkeleton::Flags that describes what the behavior of interface. More...

 
void set_flags (Flags flags)
 Sets flags describing what the behavior of skeleton should be. More...

 
Glib::PropertyProxy< Flagsproperty_g_flags ()
 Flags from the Gio::DBus::InterfaceSkeleton::Flags enumeration. More...

 
Glib::PropertyProxy_ReadOnly< Flagsproperty_g_flags () const
 Flags from the Gio::DBus::InterfaceSkeleton::Flags enumeration. More...

 
Glib::SignalProxy< bool(const Glib::RefPtr< MethodInvocation >&)> signal_authorize_method ()
 
- Public Member Functions inherited from Glib::Object
 Object (const Object&)=delete
 
Objectoperator= (const Object&)=delete
 
 Object (Object&& src) noexcept
 
Objectoperator= (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
 
ObjectBaseoperator= (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...

 
template<class PropertyType >
PropertyType get_property (const Glib::ustring& property_name) const
 You probably want to use a specific property_*() accessor method instead. More...

 
sigc::connection 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...

 
sigc::connection 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...

 
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) noexcept
 
 ~trackable ()
 
void add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
 
void notify_callbacks ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (trackable &&src) noexcept
 
void remove_destroy_notify_callback (notifiable *data) const
 
- Public Member Functions inherited from Gio::DBus::Interface
 Interface (Interface&& src) noexcept
 
Interfaceoperator= (Interface&& src) noexcept
 
 ~Interface () noexcept override
 
GDBusInterface* gobj ()
 Provides access to the underlying C GObject. More...

 
const GDBusInterface* gobj () const
 Provides access to the underlying C GObject. More...

 
Glib::RefPtr< InterfaceInfoget_info ()
 Gets D-Bus introspection information for the D-Bus interface implemented by interface. More...

 
Glib::RefPtr< const InterfaceInfoget_info () const
 Gets D-Bus introspection information for the D-Bus interface implemented by interface. More...

 
Glib::RefPtr< Gio::DBus::Objectget_object ()
 Gets the DBusObject that interface belongs to, if any. More...

 
Glib::RefPtr< const Gio::DBus::Objectget_object () const
 Gets the DBusObject that interface belongs to, if any. More...

 
Glib::RefPtr< Gio::DBus::Objectdup_object ()
 Gets the DBusObject that interface belongs to, if any. More...

 
Glib::RefPtr< const Gio::DBus::Objectdup_object () const
 Gets the DBusObject that interface belongs to, if any. More...

 
void set_object (const Glib::RefPtr< Gio::DBus::Object >& object)
 Sets the DBusObject for interface to object. More...

 
- Public Member Functions inherited from Glib::Interface
 Interface ()
 A Default constructor. More...

 
 Interface (Interface&& src) noexcept
 
Interfaceoperator= (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
 
Interfaceoperator= (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 Public Member Functions inherited from Gio::DBus::Interface
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

virtual bool on_authorize_method (const Glib::RefPtr< MethodInvocation >& invocation)
 This is a default handler for the signal signal_authorize_method(). More...

 
- 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
 
ObjectBaseoperator= (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::Interface
 Interface ()
 You should derive from this class to use it. More...

 
virtual Glib::RefPtr< InterfaceInfoget_info_vfunc () const
 
virtual Glib::RefPtr< Gio::DBus::Objectget_object_vfunc () const
 
virtual void set_object_vfunc (const Glib::RefPtr< Gio::DBus::Object >& object)
 
virtual Glib::RefPtr< Gio::DBus::Objectdup_object_vfunc () const
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gio::DBus::InterfaceSkeletonwrap (GDBusInterfaceSkeleton* object, bool take_copy=false)
 A Glib::wrap() method for this object. More...

 

Detailed Description

Abstract base class for D-Bus interfaces on the service side.

Since glibmm 2.38:

Constructor & Destructor Documentation

Gio::DBus::InterfaceSkeleton::InterfaceSkeleton ( InterfaceSkeleton&&  src)
noexcept
Gio::DBus::InterfaceSkeleton::~InterfaceSkeleton ( )
overridenoexcept

Member Function Documentation

void Gio::DBus::InterfaceSkeleton::export_interface_skeleton ( const Glib::RefPtr< Connection >&  connection,
const Glib::ustring object_path 
)

Exports interface at object_path on connection.

This can be called multiple times to export the same interface onto multiple connections however the object_path provided must be the same for all connections.

Use g_dbus_interface_skeleton_unexport() to unexport the object.

Since glibmm 2.30:
Parameters
connectionA Gio::DBus::Connection to export interface on.
object_pathThe path to export the interface at.
Exceptions
Glib::Error
void Gio::DBus::InterfaceSkeleton::flush ( )

If interface has outstanding changes, request for these changes to be emitted immediately.

For example, an exported D-Bus interface may queue up property changes and emit the org.freedesktop.DBus.Properties.PropertiesChanged signal later (e.g. in an idle handler). This technique is useful for collapsing multiple property changes into one.

Since glibmm 2.30:
Glib::RefPtr<Connection> Gio::DBus::InterfaceSkeleton::get_connection ( )

Gets the first connection that interface is exported on, if any.

Since glibmm 2.30:
Returns
A Gio::DBus::Connection or nullptr if interface is not exported anywhere. Do not free, the object belongs to interface.
Glib::RefPtr<const Connection> Gio::DBus::InterfaceSkeleton::get_connection ( ) const

Gets the first connection that interface is exported on, if any.

Since glibmm 2.30:
Returns
A Gio::DBus::Connection or nullptr if interface is not exported anywhere. Do not free, the object belongs to interface.
std::vector< Glib::RefPtr<Connection> > Gio::DBus::InterfaceSkeleton::get_connections ( )

Gets a list of the connections that interface is exported on.

Since glibmm 2.32:
Returns
A list of all the connections that interface is exported on.
std::vector< Glib::RefPtr<const Connection> > Gio::DBus::InterfaceSkeleton::get_connections ( ) const

Gets a list of the connections that interface is exported on.

Since glibmm 2.32:
Returns
A list of all the connections that interface is exported on.
Flags Gio::DBus::InterfaceSkeleton::get_flags ( ) const

Gets the Gio::DBus::InterfaceSkeleton::Flags that describes what the behavior of interface.

Since glibmm 2.30:
Returns
One or more flags from the Gio::DBus::InterfaceSkeleton::Flags enumeration.
Glib::RefPtr<InterfaceInfo> Gio::DBus::InterfaceSkeleton::get_info ( )

Gets D-Bus introspection information for the D-Bus interface implemented by interface.

Since glibmm 2.30:
Returns
A Gio::DBus::InterfaceInfo (never nullptr). Do not free.
Glib::RefPtr<const InterfaceInfo> Gio::DBus::InterfaceSkeleton::get_info ( ) const

Gets D-Bus introspection information for the D-Bus interface implemented by interface.

Since glibmm 2.30:
Returns
A Gio::DBus::InterfaceInfo (never nullptr). Do not free.
Glib::ustring Gio::DBus::InterfaceSkeleton::get_object_path ( ) const

Gets the object path that interface is exported on, if any.

Since glibmm 2.30:
Returns
A string owned by interface or nullptr if interface is not exported anywhere. Do not free, the string belongs to interface.
Glib::VariantBase Gio::DBus::InterfaceSkeleton::get_properties ( ) const

Gets all D-Bus properties for interface.

Since glibmm 2.30:
Returns
A Variant of type ['a{sv}'][G-VARIANT-TYPE-VARDICT:CAPS]. Free with Glib::variant_unref().
static GType Gio::DBus::InterfaceSkeleton::get_type ( )
static

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

GDBusInterfaceSkeleton* Gio::DBus::InterfaceSkeleton::gobj ( )
inline

Provides access to the underlying C GObject.

const GDBusInterfaceSkeleton* Gio::DBus::InterfaceSkeleton::gobj ( ) const
inline

Provides access to the underlying C GObject.

GDBusInterfaceSkeleton* Gio::DBus::InterfaceSkeleton::gobj_copy ( )

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

bool Gio::DBus::InterfaceSkeleton::has_connection ( const Glib::RefPtr< const Connection >&  connection) const

Checks if interface is exported on connection.

Since glibmm 2.32:
Parameters
connectionA Gio::DBus::Connection.
Returns
true if interface is exported on connection, false otherwise.
virtual bool Gio::DBus::InterfaceSkeleton::on_authorize_method ( const Glib::RefPtr< MethodInvocation >&  invocation)
protectedvirtual

This is a default handler for the signal signal_authorize_method().

InterfaceSkeleton& Gio::DBus::InterfaceSkeleton::operator= ( InterfaceSkeleton&&  src)
noexcept
Glib::PropertyProxy< Flags > Gio::DBus::InterfaceSkeleton::property_g_flags ( )

Flags from the Gio::DBus::InterfaceSkeleton::Flags enumeration.

Since glibmm 2.30:

Default value: Gio::DBus::InterfaceSkeleton::Flags::NONE

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.
Glib::PropertyProxy_ReadOnly< Flags > Gio::DBus::InterfaceSkeleton::property_g_flags ( ) const

Flags from the Gio::DBus::InterfaceSkeleton::Flags enumeration.

Since glibmm 2.30:

Default value: Gio::DBus::InterfaceSkeleton::Flags::NONE

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
void Gio::DBus::InterfaceSkeleton::set_flags ( Flags  flags)

Sets flags describing what the behavior of skeleton should be.

Since glibmm 2.30:
Parameters
flagsFlags from the Gio::DBus::InterfaceSkeleton::Flags enumeration.
Glib::SignalProxy<bool(const Glib::RefPtr<MethodInvocation>&)> Gio::DBus::InterfaceSkeleton::signal_authorize_method ( )
Slot Prototype:
bool on_my_authorize_method(const Glib::RefPtr<MethodInvocation>& invocation)

Flags: Run Last

Emitted when a method is invoked by a remote caller and used to determine if the method call is authorized.

Note that this signal is emitted in a thread dedicated to handling the method call so handlers are allowed to perform blocking IO. This means that it is appropriate to call e.g. polkit_authority_check_authorization_sync() with the POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION flag set.

If false is returned then no further handlers are run and the signal handler must take a reference to invocation and finish handling the call (e.g. return an error via g_dbus_method_invocation_return_error()).

Otherwise, if true is returned, signal emission continues. If no handlers return false, then the method is dispatched. If interface has an enclosing DBusObjectSkeleton, then the DBusObjectSkeleton::signal_authorize_method() signal handlers run before the handlers for this signal.

The default class handler just returns true.

Please note that the common case is optimized: if no signals handlers are connected and the default class handler isn't overridden (for both interface and the enclosing DBusObjectSkeleton, if any) and DBusInterfaceSkeleton::property_g_flags() does not have the Gio::DBus::InterfaceSkeleton::Flags::HANDLE_METHOD_INVOCATIONS_IN_THREAD flags set, no dedicated thread is ever used and the call will be handled in the same thread as the object that interface belongs to was exported in.

Since glibmm 2.30:
Parameters
invocationA DBusMethodInvocation.
Returns
true if the call is authorized, false otherwise.
void Gio::DBus::InterfaceSkeleton::unexport ( )

Stops exporting interface on all connections it is exported on.

To unexport interface from only a single connection, use g_dbus_interface_skeleton_unexport_from_connection()

Since glibmm 2.30:
void Gio::DBus::InterfaceSkeleton::unexport_from_connection ( const Glib::RefPtr< Connection >&  connection)

Stops exporting interface on connection.

To stop exporting on all connections the interface is exported on, use g_dbus_interface_skeleton_unexport().

Since glibmm 2.32:
Parameters
connectionA Gio::DBus::Connection.

Friends And Related Function Documentation

Glib::RefPtr< Gio::DBus::InterfaceSkeleton > wrap ( GDBusInterfaceSkeleton *  object,
bool  take_copy = false 
)
related

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

Parameters
objectThe C instance.
take_copyFalse 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.