Functions
g_dbus_method_invocation_get_sender ()
const gchar *
g_dbus_method_invocation_get_sender (GDBusMethodInvocation *invocation);
Gets the bus name that invoked the method.
Returns
A string. Do not free, it is owned by invocation
.
Since: 2.26
g_dbus_method_invocation_get_object_path ()
const gchar *
g_dbus_method_invocation_get_object_path
(GDBusMethodInvocation *invocation);
Gets the object path the method was invoked on.
Returns
A string. Do not free, it is owned by invocation
.
Since: 2.26
g_dbus_method_invocation_get_interface_name ()
const gchar *
g_dbus_method_invocation_get_interface_name
(GDBusMethodInvocation *invocation);
Gets 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
GDBusInterfaceVTable for more information.
Returns
A string. Do not free, it is owned by invocation
.
Since: 2.26
g_dbus_method_invocation_get_method_name ()
const gchar *
g_dbus_method_invocation_get_method_name
(GDBusMethodInvocation *invocation);
Gets the name of the method that was invoked.
Returns
A string. Do not free, it is owned by invocation
.
Since: 2.26
g_dbus_method_invocation_get_property_info ()
const GDBusPropertyInfo *
g_dbus_method_invocation_get_property_info
(GDBusMethodInvocation *invocation);
Gets 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 GDBusInterfaceVTable for more information.
If the call was GetAll, NULL will be returned.
Since: 2.38
g_dbus_method_invocation_get_message ()
GDBusMessage *
g_dbus_method_invocation_get_message (GDBusMethodInvocation *invocation);
Gets the GDBusMessage for 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 the
GVariant API.
See this server and client
for an example of how to use this low-level API to send and receive
UNIX file descriptors.
Returns
GDBusMessage. Do not free, it is owned by invocation
.
[transfer none]
Since: 2.26
g_dbus_method_invocation_get_parameters ()
GVariant *
g_dbus_method_invocation_get_parameters
(GDBusMethodInvocation *invocation);
Gets the parameters of the method invocation. If there are no input
parameters then this will return a GVariant with 0 children rather than NULL.
Returns
A GVariant tuple. Do not unref this because it is owned by invocation
.
[transfer none]
Since: 2.26
g_dbus_method_invocation_return_value ()
void
g_dbus_method_invocation_return_value (GDBusMethodInvocation *invocation,
GVariant *parameters);
Finishes handling a D-Bus method call by returning parameters
.
If the parameters
GVariant is 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 NULL or an empty tuple.
This method will take ownership of invocation
. See
GDBusInterfaceVTable for more information about the ownership of
invocation
.
Since 2.48, if the method call requested for a reply not to be sent
then this call will sink parameters
and free invocation
, but
otherwise do nothing (as per the recommendations of the D-Bus
specification).
Since: 2.26
g_dbus_method_invocation_return_error ()
void
g_dbus_method_invocation_return_error (GDBusMethodInvocation *invocation,
GQuark domain,
gint code,
const gchar *format,
...);
Finishes handling a D-Bus method call by returning an error.
See g_dbus_error_encode_gerror() for details about what error name
will be returned on the wire. In a nutshell, if the given error is
registered using g_dbus_error_register_error() the name given
during registration is used. Otherwise, a name of the form
org.gtk.GDBus.UnmappedGError.Quark... is used. This provides
transparent mapping of GError between applications using GDBus.
If you are writing an application intended to be portable,
always register errors with g_dbus_error_register_error()
or use g_dbus_method_invocation_return_dbus_error().
This method will take ownership of invocation
. See
GDBusInterfaceVTable for more information about the ownership of
invocation
.
Since 2.48, if the method call requested for a reply not to be sent
then this call will free invocation
but otherwise do nothing (as per
the recommendations of the D-Bus specification).
Since: 2.26
g_dbus_method_invocation_return_error_valist ()
void
g_dbus_method_invocation_return_error_valist
(GDBusMethodInvocation *invocation,
GQuark domain,
gint code,
const gchar *format,
va_list var_args);
Like g_dbus_method_invocation_return_error() but intended for
language bindings.
This method will take ownership of invocation
. See
GDBusInterfaceVTable for more information about the ownership of
invocation
.
Since: 2.26
g_dbus_method_invocation_return_dbus_error ()
void
g_dbus_method_invocation_return_dbus_error
(GDBusMethodInvocation *invocation,
const gchar *error_name,
const gchar *error_message);
Finishes handling a D-Bus method call by returning an error.
This method will take ownership of invocation
. See
GDBusInterfaceVTable for more information about the ownership of
invocation
.
Since: 2.26