Skip to content

Gio.DBusInterfaceSkeleton

class — extends GObject.Object, DBusInterface

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

Methods

export

def export(self, connection: DBusConnection, object_path: str) -> bool

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 DBusInterfaceSkeleton.unexport to unexport the object.

Parameters:

  • connection — A DBusConnection to export interface_ on.
  • object_path — The path to export the interface at.

flush

def flush(self) -> None

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.

get_connection

def get_connection(self) -> DBusConnection | None

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

get_connections

def get_connections(self) -> list[DBusConnection]

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

get_flags

def get_flags(self) -> DBusInterfaceSkeletonFlags

Gets the DBusInterfaceSkeletonFlags that describes what the behavior of interface_

get_info

def get_info(self) -> DBusInterfaceInfo

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

get_object_path

def get_object_path(self) -> str | None

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

get_properties

def get_properties(self) -> GLib.Variant

Gets all D-Bus properties for interface_.

get_vtable

def get_vtable(self) -> DBusInterfaceVTable

Gets the interface vtable for the D-Bus interface implemented by interface_. The returned function pointers should expect interface_ itself to be passed as user_data.

has_connection

def has_connection(self, connection: DBusConnection) -> bool

Checks if interface_ is exported on connection.

Parameters:

set_flags

def set_flags(self, flags: DBusInterfaceSkeletonFlags | int) -> None

Sets flags describing what the behavior of skeleton should be.

Parameters:

unexport

def unexport(self) -> None

Stops exporting interface_ on all connections it is exported on.

To unexport interface_ from only a single connection, use DBusInterfaceSkeleton.unexport_from_connection

unexport_from_connection

def unexport_from_connection(self, connection: DBusConnection) -> None

Stops exporting interface_ on connection.

To stop exporting on all connections the interface is exported on, use DBusInterfaceSkeleton.unexport.

Parameters:

Virtual methods

do_flush

def do_flush(self) -> None

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.

do_g_authorize_method

def do_g_authorize_method(self, invocation: DBusMethodInvocation) -> bool

Signal class handler for the DBusInterfaceSkeleton::g-authorize-method signal.

do_get_info

def do_get_info(self) -> DBusInterfaceInfo

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

do_get_properties

def do_get_properties(self) -> GLib.Variant

Gets all D-Bus properties for interface_.

do_get_vtable

def do_get_vtable(self) -> DBusInterfaceVTable

Gets the interface vtable for the D-Bus interface implemented by interface_. The returned function pointers should expect interface_ itself to be passed as user_data.

Properties

g_flags

g_flags: DBusInterfaceSkeletonFlags | int  # read/write

Flags from the DBusInterfaceSkeletonFlags enumeration.

Signals

g-authorize-method

def on_g_authorize_method(self, invocation: DBusMethodInvocation) -> bool: ...

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::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:g-flags does not have the DBusInterfaceSkeletonFlags.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.