Gio.DBusMethodInvocation¶
| Subclasses: | None |
|---|
Methods¶
| Inherited: | GObject.Object (37) |
|---|---|
| Structs: | GObject.ObjectClass (5) |
get_connection () |
|
get_interface_name () |
|
get_message () |
|
get_method_info () |
|
get_method_name () |
|
get_object_path () |
|
get_parameters () |
|
get_property_info () |
|
get_sender () |
|
return_dbus_error (error_name, error_message) |
|
return_error_literal (domain, code, message) |
|
return_gerror (error) |
|
return_value (parameters) |
|
return_value_with_unix_fd_list (parameters, fd_list) |
Virtual Methods¶
| Inherited: | GObject.Object (7) |
|---|
Properties¶
None
Signals¶
| Inherited: | GObject.Object (1) |
|---|
Fields¶
| Inherited: | GObject.Object (1) |
|---|
Class Details¶
-
class
Gio.DBusMethodInvocation(**kwargs)¶ Bases: GObject.ObjectAbstract: No Instances of the
Gio.DBusMethodInvocationclass are used when handling D-Bus method calls. It provides a way to asynchronously return results and errors.The normal way to obtain a
Gio.DBusMethodInvocationobject is to receive it as an argument to the handle_method_call() function in aGio.DBusInterfaceVTablethat was passed toGio.DBusConnection.register_object().New in version 2.26.
-
get_connection()[source]¶ Returns: A Gio.DBusConnection. Do not free, it is owned by self.Return type: Gio.DBusConnectionGets the
Gio.DBusConnectionthe method was invoked on.New in version 2.26.
-
get_interface_name()[source]¶ Returns: A string. Do not free, it is owned by self. Return type: strGets the name of the D-Bus interface the method was invoked on.
If this method call is a property Get, Set or GetAll call that has been redirected to the method call handler then “org.freedesktop.DBus.Properties” will be returned. See
Gio.DBusInterfaceVTablefor more information.New in version 2.26.
-
get_message()[source]¶ Returns: Gio.DBusMessage. Do not free, it is owned by self.Return type: Gio.DBusMessageGets the
Gio.DBusMessagefor the method invocation. This is useful if you need to use low-level protocol features, such as UNIX file descriptor passing, that cannot be properly expressed in theGLib.VariantAPI.See this server and client for an example of how to use this low-level API to send and receive UNIX file descriptors.
New in version 2.26.
-
get_method_info()[source]¶ Returns: A Gio.DBusMethodInfoorNone. Do not free, it is owned by self.Return type: Gio.DBusMethodInfoGets information about the method call, if any.
If this method invocation is a property Get, Set or GetAll call that has been redirected to the method call handler then
Nonewill be returned. SeeGio.DBusMethodInvocation.get_property_info() andGio.DBusInterfaceVTablefor more information.New in version 2.26.
-
get_method_name()[source]¶ Returns: A string. Do not free, it is owned by self. Return type: strGets the name of the method that was invoked.
New in version 2.26.
-
get_object_path()[source]¶ Returns: A string. Do not free, it is owned by self. Return type: strGets the object path the method was invoked on.
New in version 2.26.
-
get_parameters()[source]¶ Returns: A GLib.Varianttuple. Do not unref this because it is owned by self.Return type: GLib.VariantGets the parameters of the method invocation. If there are no input parameters then this will return a
GLib.Variantwith 0 children rather thanNone.New in version 2.26.
-
get_property_info()[source]¶ Returns: a Gio.DBusPropertyInfoorNoneReturn type: Gio.DBusPropertyInfoGets information about the property that this method call is for, if any.
This will only be set in the case of an invocation in response to a property Get or Set call that has been directed to the method call handler for an object on account of its property_get() or property_set() vtable pointers being unset.
See
Gio.DBusInterfaceVTablefor more information.If the call was GetAll,
Nonewill be returned.New in version 2.38.
-
get_sender()[source]¶ Returns: A string. Do not free, it is owned by self. Return type: strGets the bus name that invoked the method.
New in version 2.26.
-
return_dbus_error(error_name, error_message)[source]¶ Parameters: Finishes handling a D-Bus method call by returning an error.
This method will take ownership of self. See
Gio.DBusInterfaceVTablefor more information about the ownership of self.New in version 2.26.
-
return_error_literal(domain, code, message)[source]¶ Parameters: - domain (
int) – A #GQuark for theGLib.Errorerror domain. - code (
int) – The error code. - message (
str) – The error message.
Like g_dbus_method_invocation_return_error() but without printf()-style formatting.
This method will take ownership of self. See
Gio.DBusInterfaceVTablefor more information about the ownership of self.New in version 2.26.
- domain (
-
return_gerror(error)[source]¶ Parameters: error ( GLib.Error) – AGLib.Error.Like g_dbus_method_invocation_return_error() but takes a
GLib.Errorinstead of the error domain, error code and message.This method will take ownership of self. See
Gio.DBusInterfaceVTablefor more information about the ownership of self.New in version 2.26.
-
return_value(parameters)[source]¶ Parameters: parameters ( GLib.VariantorNone) – AGLib.Varianttuple with out parameters for the method orNoneif not passing any parameters.Finishes handling a D-Bus method call by returning parameters. If the parameters
GLib.Variantis floating, it is consumed.It is an error if parameters is not of the right format: it must be a tuple containing the out-parameters of the D-Bus method. Even if the method has a single out-parameter, it must be contained in a tuple. If the method has no out-parameters, parameters may be
Noneor an empty tuple.GDBusMethodInvocation *invocation = some_invocation; g_autofree gchar *result_string = NULL; g_autoptr (GError) error = NULL; result_string = calculate_result (&error); if (error != NULL) g_dbus_method_invocation_return_gerror (invocation, error); else g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", result_string)); // Do not free @invocation here; returning a value does that
This method will take ownership of self. See
Gio.DBusInterfaceVTablefor more information about the ownership of self.Since 2.48, if the method call requested for a reply not to be sent then this call will sink parameters and free self, but otherwise do nothing (as per the recommendations of the D-Bus specification).
New in version 2.26.
-
return_value_with_unix_fd_list(parameters, fd_list)[source]¶ Parameters: - parameters (
GLib.VariantorNone) – AGLib.Varianttuple with out parameters for the method orNoneif not passing any parameters. - fd_list (
Gio.UnixFDListorNone) – AGio.UnixFDListorNone.
Like
Gio.DBusMethodInvocation.return_value() but also takes aGio.UnixFDList.This method is only available on UNIX.
This method will take ownership of self. See
Gio.DBusInterfaceVTablefor more information about the ownership of self.New in version 2.30.
- parameters (
-