Optionalproperties: Partial<Gio.DBusConnection.ConstructorProps>Internal$signalsCompile-time signal type information.
This instance property is generated only for TypeScript type checking. It is not defined at runtime and should not be accessed in JS code.
Static$gtypeConstruct OnlySince 2.26addressConstruct OnlySince 2.26authentication_A Gio.DBusAuthObserver object to assist in the authentication process or null.
Construct OnlySince 2.26authenticationA Gio.DBusAuthObserver object to assist in the authentication process or null.
Read-OnlySince 2.26capabilitiesFlags from the Gio.DBusCapabilityFlags enumeration representing connection features negotiated with the other peer.
Read-OnlySince 2.26closedSince 2.26exit_A boolean specifying whether the process will be terminated (by
calling raise(SIGTERM)) if the connection is closed by the
remote peer.
Note that Gio.DBusConnection objects returned by g_bus_get_finish()
and g_bus_get_sync() will (usually) have this property set to true.
Since 2.26exitA boolean specifying whether the process will be terminated (by
calling raise(SIGTERM)) if the connection is closed by the
remote peer.
Note that Gio.DBusConnection objects returned by g_bus_get_finish()
and g_bus_get_sync() will (usually) have this property set to true.
Construct OnlySince 2.26flagsConstruct OnlySince 2.26guidThe GUID of the peer performing the role of server when authenticating.
If you are constructing a Gio.DBusConnection and pass Gio.DBusConnectionFlags.AUTHENTICATION_SERVER in the Gio.DBusConnection.flags property then you must also set this property to a valid guid.
If you are constructing a Gio.DBusConnection and pass Gio.DBusConnectionFlags.AUTHENTICATION_CLIENT in the Gio.DBusConnection.flags property you will be able to read the GUID of the other peer here after the connection has been successfully initialized.
Note that the D-Bus specification uses the term ‘UUID’ to refer to this, whereas GLib consistently uses the term ‘GUID’ for historical reasons.
Despite its name, the format of Gio.DBusConnection.guid does not follow RFC 4122 or the Microsoft GUID format.
Construct OnlySince 2.26streamThe underlying Gio.IOStream used for I/O.
If this is passed on construction and is a Gio.SocketConnection, then the corresponding Gio.Socket will be put into non-blocking mode.
While the Gio.DBusConnection is active, it will interact with this stream from a worker thread, so it is not safe to interact with the stream directly.
Read-OnlySince 2.26unique_Read-OnlySince 2.26uniqueAdds a message filter. Filters are handlers that are run on all incoming and outgoing messages, prior to standard dispatch. Filters are run in the order that they were added. The same handler can be added as a filter more than once, in which case it will be run more than once. Filters added during a filter callback won't be run on the message being processed. Filter functions are allowed to modify and even drop messages.
Note that filters are run in a dedicated message handling thread so
they can't block and, generally, can't do anything but signal a
worker thread. Also note that filters are rarely needed - use API
such as g_dbus_connection_send_message_with_reply(),
g_dbus_connection_signal_subscribe() or g_dbus_connection_call() instead.
If a filter consumes an incoming message the message is not
dispatched anywhere else - not even the standard dispatch machinery
(that API such as g_dbus_connection_signal_subscribe() and
g_dbus_connection_send_message_with_reply() relies on) will see the
message. Similarly, if a filter consumes an outgoing message, the
message will not be sent to the other peer.
If user_data_free_func is non-null, it will be called (in the
thread-default main context of the thread you are calling this
method from) at some point after user_data is no longer
needed. (It is not guaranteed to be called synchronously when the
filter is removed, and may be called after connection has been
destroyed.)
a filter function
a filter identifier that can be used with g_dbus_connection_remove_filter()
Creates a binding between source_property on source and target_property
on target.
Whenever the source_property is changed the target_property is
updated using the same value. For instance:
g_object_bind_property (action, "active", widget, "sensitive", 0);
Will result in the "sensitive" property of the widget GObject.Object instance to be updated with the same value of the "active" property of the action GObject.Object instance.
If flags contains GObject.BindingFlags.BIDIRECTIONAL then the binding will be mutual:
if target_property on target changes then the source_property on source
will be updated as well.
The binding will automatically be removed when either the source or the
target instances are finalized. To remove the binding without affecting the
source and the target you can just call g_object_unref() on the returned
GObject.Binding instance.
Removing the binding by calling g_object_unref() on it must only be done if
the binding, source and target are only used from a single thread and it
is clear that both source and target outlive the binding. Especially it
is not safe to rely on this if the binding, source or target can be
finalized from different threads. Keep another reference to the binding and
use g_binding_unbind() instead to be on the safe side.
A GObject.Object can have multiple bindings.
the property on source to bind
the target GObject.Object
the property on target to bind
flags to pass to GObject.Binding
the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.
Complete version of g_object_bind_property().
Creates a binding between source_property on source and target_property
on target, allowing you to set the transformation functions to be used by
the binding.
If flags contains GObject.BindingFlags.BIDIRECTIONAL then the binding will be mutual:
if target_property on target changes then the source_property on source
will be updated as well. The transform_from function is only used in case
of bidirectional bindings, otherwise it will be ignored
The binding will automatically be removed when either the source or the
target instances are finalized. This will release the reference that is
being held on the GObject.Binding instance; if you want to hold on to the
GObject.Binding instance, you will need to hold a reference to it.
To remove the binding, call g_binding_unbind().
A GObject.Object can have multiple bindings.
The same user_data parameter will be used for both transform_to
and transform_from transformation functions; the notify function will
be called once, when the binding is removed. If you need different data
for each transformation function, please use
g_object_bind_property_with_closures() instead.
the property on source to bind
the target GObject.Object
the property on target to bind
flags to pass to GObject.Binding
Optionaltransform_to: BindingTransformFuncthe transformation function from the source to the target, or null to use the default
Optionaltransform_from: BindingTransformFuncthe transformation function from the target to the source, or null to use the default
Optionalnotify: DestroyNotifya function to call when disposing the binding, to free resources used by the transformation functions, or null if not required
the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.
Creates a binding between source_property on source and target_property
on target, allowing you to set the transformation functions to be used by
the binding.
This function is the language bindings friendly version of
g_object_bind_property_full(), using GClosures instead of
function pointers.
the property on source to bind
the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.
Blocks a handler of an instance so it will not be called during any signal emissions
Handler ID of the handler to be blocked
Asynchronously invokes the method_name method on the
interface_name D-Bus interface on the remote object at
object_path owned by bus_name.
If connection is closed then the operation will fail with
Gio.IOErrorEnum.CLOSED. If cancellable is canceled, the operation will
fail with Gio.IOErrorEnum.CANCELLED. If parameters contains a value
not compatible with the D-Bus protocol, the operation fails with
Gio.IOErrorEnum.INVALID_ARGUMENT.
If reply_type is non-null then the reply will be checked for having this type and an
error will be raised if it does not match. Said another way, if you give a reply_type
then any non-null return value will be of this type. Unless it’s
G_VARIANT_TYPE_UNIT, the reply_type will be a tuple containing one or more
values.
If the parameters GLib.Variant is floating, it is consumed. This allows
convenient 'inline' use of g_variant_new(), e.g.:
g_dbus_connection_call (connection,
"org.freedesktop.StringThings",
"/org/freedesktop/StringThings",
"org.freedesktop.StringThings",
"TwoStrings",
g_variant_new ("(ss)",
"Thing One",
"Thing Two"),
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
(GAsyncReadyCallback) two_strings_done,
NULL);
This is an asynchronous method. When the operation is finished,
callback will be invoked in the thread-default main context
(see GLib.MainContext.push_thread_default)
of the thread you are calling this method from. You can then call
g_dbus_connection_call_finish() to get the result of the operation.
See g_dbus_connection_call_sync() for the synchronous version of this
function.
If callback is null then the D-Bus method call message will be sent with
the Gio.DBusMessageFlags.NO_REPLY_EXPECTED flag set.
a unique or well-known bus name or null if connection is not a message bus connection
path of remote object
D-Bus interface to invoke method on
the name of the method to invoke
a GLib.Variant tuple with parameters for the method or null if not passing parameters
the expected type of the reply (which will be a tuple), or null
flags from the Gio.DBusCallFlags enumeration
the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
Asynchronously invokes the method_name method on the
interface_name D-Bus interface on the remote object at
object_path owned by bus_name.
If connection is closed then the operation will fail with
Gio.IOErrorEnum.CLOSED. If cancellable is canceled, the operation will
fail with Gio.IOErrorEnum.CANCELLED. If parameters contains a value
not compatible with the D-Bus protocol, the operation fails with
Gio.IOErrorEnum.INVALID_ARGUMENT.
If reply_type is non-null then the reply will be checked for having this type and an
error will be raised if it does not match. Said another way, if you give a reply_type
then any non-null return value will be of this type. Unless it’s
G_VARIANT_TYPE_UNIT, the reply_type will be a tuple containing one or more
values.
If the parameters GLib.Variant is floating, it is consumed. This allows
convenient 'inline' use of g_variant_new(), e.g.:
g_dbus_connection_call (connection,
"org.freedesktop.StringThings",
"/org/freedesktop/StringThings",
"org.freedesktop.StringThings",
"TwoStrings",
g_variant_new ("(ss)",
"Thing One",
"Thing Two"),
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
(GAsyncReadyCallback) two_strings_done,
NULL);
This is an asynchronous method. When the operation is finished,
callback will be invoked in the thread-default main context
(see GLib.MainContext.push_thread_default)
of the thread you are calling this method from. You can then call
g_dbus_connection_call_finish() to get the result of the operation.
See g_dbus_connection_call_sync() for the synchronous version of this
function.
If callback is null then the D-Bus method call message will be sent with
the Gio.DBusMessageFlags.NO_REPLY_EXPECTED flag set.
a unique or well-known bus name or null if connection is not a message bus connection
path of remote object
D-Bus interface to invoke method on
the name of the method to invoke
a GLib.Variant tuple with parameters for the method or null if not passing parameters
the expected type of the reply (which will be a tuple), or null
flags from the Gio.DBusCallFlags enumeration
the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout
a Gio.Cancellable or null
a Gio.AsyncReadyCallback to call when the request is satisfied or null if you don't care about the result of the method invocation
Asynchronously invokes the method_name method on the
interface_name D-Bus interface on the remote object at
object_path owned by bus_name.
If connection is closed then the operation will fail with
Gio.IOErrorEnum.CLOSED. If cancellable is canceled, the operation will
fail with Gio.IOErrorEnum.CANCELLED. If parameters contains a value
not compatible with the D-Bus protocol, the operation fails with
Gio.IOErrorEnum.INVALID_ARGUMENT.
If reply_type is non-null then the reply will be checked for having this type and an
error will be raised if it does not match. Said another way, if you give a reply_type
then any non-null return value will be of this type. Unless it’s
G_VARIANT_TYPE_UNIT, the reply_type will be a tuple containing one or more
values.
If the parameters GLib.Variant is floating, it is consumed. This allows
convenient 'inline' use of g_variant_new(), e.g.:
g_dbus_connection_call (connection,
"org.freedesktop.StringThings",
"/org/freedesktop/StringThings",
"org.freedesktop.StringThings",
"TwoStrings",
g_variant_new ("(ss)",
"Thing One",
"Thing Two"),
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
(GAsyncReadyCallback) two_strings_done,
NULL);
This is an asynchronous method. When the operation is finished,
callback will be invoked in the thread-default main context
(see GLib.MainContext.push_thread_default)
of the thread you are calling this method from. You can then call
g_dbus_connection_call_finish() to get the result of the operation.
See g_dbus_connection_call_sync() for the synchronous version of this
function.
If callback is null then the D-Bus method call message will be sent with
the Gio.DBusMessageFlags.NO_REPLY_EXPECTED flag set.
a unique or well-known bus name or null if connection is not a message bus connection
path of remote object
D-Bus interface to invoke method on
the name of the method to invoke
a GLib.Variant tuple with parameters for the method or null if not passing parameters
the expected type of the reply (which will be a tuple), or null
flags from the Gio.DBusCallFlags enumeration
the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
Optionalcallback: AsyncReadyCallback<Gio.DBusConnection>a Gio.AsyncReadyCallback to call when the request is satisfied or null if you don't care about the result of the method invocation
Finishes an operation started with g_dbus_connection_call().
a Gio.AsyncResult obtained from the Gio.AsyncReadyCallback passed to g_dbus_connection_call()
null if error is set. Otherwise a non-floating GLib.Variant tuple with return values. Free with g_variant_unref().
Synchronously invokes the method_name method on the
interface_name D-Bus interface on the remote object at
object_path owned by bus_name.
If connection is closed then the operation will fail with
Gio.IOErrorEnum.CLOSED. If cancellable is canceled, the
operation will fail with Gio.IOErrorEnum.CANCELLED. If parameters
contains a value not compatible with the D-Bus protocol, the operation
fails with Gio.IOErrorEnum.INVALID_ARGUMENT.
If reply_type is non-null then the reply will be checked for having
this type and an error will be raised if it does not match. Said
another way, if you give a reply_type then any non-null return
value will be of this type.
If the parameters GLib.Variant is floating, it is consumed.
This allows convenient 'inline' use of g_variant_new(), e.g.:
g_dbus_connection_call_sync (connection,
"org.freedesktop.StringThings",
"/org/freedesktop/StringThings",
"org.freedesktop.StringThings",
"TwoStrings",
g_variant_new ("(ss)",
"Thing One",
"Thing Two"),
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
&error);
The calling thread is blocked until a reply is received. See
g_dbus_connection_call() for the asynchronous version of
this method.
a unique or well-known bus name or null if connection is not a message bus connection
path of remote object
D-Bus interface to invoke method on
the name of the method to invoke
a GLib.Variant tuple with parameters for the method or null if not passing parameters
the expected type of the reply, or null
flags from the Gio.DBusCallFlags enumeration
the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
null if error is set. Otherwise a non-floating GLib.Variant tuple with return values. Free with g_variant_unref().
Like g_dbus_connection_call() but also takes a Gio.UnixFDList object.
The file descriptors normally correspond to G_VARIANT_TYPE_HANDLE
values in the body of the message. For example, if a message contains
two file descriptors, fd_list would have length 2, and
g_variant_new_handle (0) and g_variant_new_handle (1) would appear
somewhere in the body of the message (not necessarily in that order!)
to represent the file descriptors at indexes 0 and 1 respectively.
When designing D-Bus APIs that are intended to be interoperable,
please note that non-GDBus implementations of D-Bus can usually only
access file descriptors if they are referenced in this way by a
value of type G_VARIANT_TYPE_HANDLE in the body of the message.
This method is only available on UNIX.
a unique or well-known bus name or null if connection is not a message bus connection
path of remote object
D-Bus interface to invoke method on
the name of the method to invoke
a GLib.Variant tuple with parameters for the method or null if not passing parameters
the expected type of the reply, or null
flags from the Gio.DBusCallFlags enumeration
the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout
Optionalfd_list: Gio.UnixFDLista Gio.UnixFDList or null
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
Like g_dbus_connection_call() but also takes a Gio.UnixFDList object.
The file descriptors normally correspond to G_VARIANT_TYPE_HANDLE
values in the body of the message. For example, if a message contains
two file descriptors, fd_list would have length 2, and
g_variant_new_handle (0) and g_variant_new_handle (1) would appear
somewhere in the body of the message (not necessarily in that order!)
to represent the file descriptors at indexes 0 and 1 respectively.
When designing D-Bus APIs that are intended to be interoperable,
please note that non-GDBus implementations of D-Bus can usually only
access file descriptors if they are referenced in this way by a
value of type G_VARIANT_TYPE_HANDLE in the body of the message.
This method is only available on UNIX.
a unique or well-known bus name or null if connection is not a message bus connection
path of remote object
D-Bus interface to invoke method on
the name of the method to invoke
a GLib.Variant tuple with parameters for the method or null if not passing parameters
the expected type of the reply, or null
flags from the Gio.DBusCallFlags enumeration
the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout
a Gio.UnixFDList or null
a Gio.Cancellable or null
a Gio.AsyncReadyCallback to call when the request is satisfied or null if you don't * care about the result of the method invocation
Like g_dbus_connection_call() but also takes a Gio.UnixFDList object.
The file descriptors normally correspond to G_VARIANT_TYPE_HANDLE
values in the body of the message. For example, if a message contains
two file descriptors, fd_list would have length 2, and
g_variant_new_handle (0) and g_variant_new_handle (1) would appear
somewhere in the body of the message (not necessarily in that order!)
to represent the file descriptors at indexes 0 and 1 respectively.
When designing D-Bus APIs that are intended to be interoperable,
please note that non-GDBus implementations of D-Bus can usually only
access file descriptors if they are referenced in this way by a
value of type G_VARIANT_TYPE_HANDLE in the body of the message.
This method is only available on UNIX.
a unique or well-known bus name or null if connection is not a message bus connection
path of remote object
D-Bus interface to invoke method on
the name of the method to invoke
a GLib.Variant tuple with parameters for the method or null if not passing parameters
the expected type of the reply, or null
flags from the Gio.DBusCallFlags enumeration
the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout
Optionalfd_list: Gio.UnixFDLista Gio.UnixFDList or null
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
Optionalcallback: AsyncReadyCallback<Gio.DBusConnection>a Gio.AsyncReadyCallback to call when the request is satisfied or null if you don't * care about the result of the method invocation
Finishes an operation started with g_dbus_connection_call_with_unix_fd_list().
The file descriptors normally correspond to G_VARIANT_TYPE_HANDLE
values in the body of the message. For example,
if g_variant_get_handle() returns 5, that is intended to be a reference
to the file descriptor that can be accessed by
g_unix_fd_list_get (*out_fd_list, 5, ...).
When designing D-Bus APIs that are intended to be interoperable,
please note that non-GDBus implementations of D-Bus can usually only
access file descriptors if they are referenced in this way by a
value of type G_VARIANT_TYPE_HANDLE in the body of the message.
a Gio.AsyncResult obtained from the Gio.AsyncReadyCallback passed to g_dbus_connection_call_with_unix_fd_list()
null if error is set. Otherwise a non-floating GLib.Variant tuple with return values. Free with g_variant_unref().
Like g_dbus_connection_call_sync() but also takes and returns Gio.UnixFDList objects.
See g_dbus_connection_call_with_unix_fd_list() and
g_dbus_connection_call_with_unix_fd_list_finish() for more details.
This method is only available on UNIX.
a unique or well-known bus name or null if connection is not a message bus connection
path of remote object
D-Bus interface to invoke method on
the name of the method to invoke
a GLib.Variant tuple with parameters for the method or null if not passing parameters
the expected type of the reply, or null
flags from the Gio.DBusCallFlags enumeration
the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout
Optionalfd_list: Gio.UnixFDLista Gio.UnixFDList or null
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
null if error is set. Otherwise a non-floating GLib.Variant tuple with return values. Free with g_variant_unref().
Closes connection. Note that this never causes the process to
exit (this might only happen if the other end of a shared message
bus connection disconnects, see Gio.DBusConnection.exit_on_close).
Once the connection is closed, operations such as sending a message
will return with the error Gio.IOErrorEnum.CLOSED. Closing a connection
will not automatically flush the connection so queued messages may
be lost. Use g_dbus_connection_flush() if you need such guarantees.
If connection is already closed, this method fails with
Gio.IOErrorEnum.CLOSED.
When connection has been closed, the Gio.DBusConnection::closed
signal is emitted in the thread-default main context
(see GLib.MainContext.push_thread_default)
of the thread that connection was constructed in.
This is an asynchronous method. When the operation is finished,
callback will be invoked in the thread-default main context
(see GLib.MainContext.push_thread_default)
of the thread you are calling this method from. You can
then call g_dbus_connection_close_finish() to get the result of the
operation. See g_dbus_connection_close_sync() for the synchronous
version.
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
Closes connection. Note that this never causes the process to
exit (this might only happen if the other end of a shared message
bus connection disconnects, see Gio.DBusConnection.exit_on_close).
Once the connection is closed, operations such as sending a message
will return with the error Gio.IOErrorEnum.CLOSED. Closing a connection
will not automatically flush the connection so queued messages may
be lost. Use g_dbus_connection_flush() if you need such guarantees.
If connection is already closed, this method fails with
Gio.IOErrorEnum.CLOSED.
When connection has been closed, the Gio.DBusConnection::closed
signal is emitted in the thread-default main context
(see GLib.MainContext.push_thread_default)
of the thread that connection was constructed in.
This is an asynchronous method. When the operation is finished,
callback will be invoked in the thread-default main context
(see GLib.MainContext.push_thread_default)
of the thread you are calling this method from. You can
then call g_dbus_connection_close_finish() to get the result of the
operation. See g_dbus_connection_close_sync() for the synchronous
version.
a Gio.Cancellable or null
a Gio.AsyncReadyCallback to call when the request is satisfied or null if you don't care about the result
Closes connection. Note that this never causes the process to
exit (this might only happen if the other end of a shared message
bus connection disconnects, see Gio.DBusConnection.exit_on_close).
Once the connection is closed, operations such as sending a message
will return with the error Gio.IOErrorEnum.CLOSED. Closing a connection
will not automatically flush the connection so queued messages may
be lost. Use g_dbus_connection_flush() if you need such guarantees.
If connection is already closed, this method fails with
Gio.IOErrorEnum.CLOSED.
When connection has been closed, the Gio.DBusConnection::closed
signal is emitted in the thread-default main context
(see GLib.MainContext.push_thread_default)
of the thread that connection was constructed in.
This is an asynchronous method. When the operation is finished,
callback will be invoked in the thread-default main context
(see GLib.MainContext.push_thread_default)
of the thread you are calling this method from. You can
then call g_dbus_connection_close_finish() to get the result of the
operation. See g_dbus_connection_close_sync() for the synchronous
version.
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
Optionalcallback: AsyncReadyCallback<Gio.DBusConnection>a Gio.AsyncReadyCallback to call when the request is satisfied or null if you don't care about the result
Finishes an operation started with g_dbus_connection_close().
a Gio.AsyncResult obtained from the Gio.AsyncReadyCallback passed to g_dbus_connection_close()
true if the operation succeeded, false if error is set
Synchronously closes connection. The calling thread is blocked
until this is done. See g_dbus_connection_close() for the
asynchronous version of this method and more details about what it
does.
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
true if the operation succeeded, false if error is set
SignalconnectSignalconnect_Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
Handler ID of the handler to be disconnected
SignalemitEmits a signal.
If the parameters GVariant is floating, it is consumed.
This can only fail if parameters is not compatible with the D-Bus protocol
(Gio.IOErrorEnum.INVALID_ARGUMENT), or if connection has been closed
(Gio.IOErrorEnum.CLOSED).
the unique bus name for the destination for the signal or null to emit to all listeners
path of remote object
D-Bus interface to emit a signal on
the name of the signal to emit
Optionalparameters: GLib.Variant<any>a GLib.Variant tuple with parameters for the signal or null if not passing parameters
true unless error is set
Exports action_group on connection at object_path.
The implemented D-Bus API should be considered private. It is subject to change in the future.
A given object path can only have one action group exported on it.
If this constraint is violated, the export will fail and 0 will be
returned (with error set accordingly).
You can unexport the action group using Gio.DBusConnection.unexport_action_group with the return value of this function.
The thread default main context is taken at the time of this call. All incoming action activations and state change requests are reported from this context. Any changes on the action group that cause it to emit signals must also come from this same context. Since incoming action activations and state change requests are rather likely to cause changes on the action group, this effectively limits a given action group to being exported from only one main context.
a D-Bus object path
an action group
the ID of the export (never zero), or 0 in case of failure
Exports menu on connection at object_path.
The implemented D-Bus API should be considered private. It is subject to change in the future.
An object path can only have one menu model exported on it. If this
constraint is violated, the export will fail and 0 will be
returned (with error set accordingly).
Exporting menus with sections containing more than
G_MENU_EXPORTER_MAX_SECTION_SIZE items is not supported and results in
undefined behavior.
You can unexport the menu model using
g_dbus_connection_unexport_menu_model() with the return value of
this function.
the ID of the export (never zero), or 0 in case of failure
Asynchronously flushes connection, that is, writes all queued
outgoing messages to the transport and then flushes the transport
(using g_output_stream_flush_async()). This is useful in programs
that want to emit a D-Bus signal and then exit immediately. Without
flushing the connection, there is no guarantee that the message has
been sent to the networking buffers in the OS kernel.
This is an asynchronous method. When the operation is finished,
callback will be invoked in the thread-default main context
(see GLib.MainContext.push_thread_default)
of the thread you are calling this method from. You can
then call g_dbus_connection_flush_finish() to get the result of the
operation. See g_dbus_connection_flush_sync() for the synchronous
version.
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
Asynchronously flushes connection, that is, writes all queued
outgoing messages to the transport and then flushes the transport
(using g_output_stream_flush_async()). This is useful in programs
that want to emit a D-Bus signal and then exit immediately. Without
flushing the connection, there is no guarantee that the message has
been sent to the networking buffers in the OS kernel.
This is an asynchronous method. When the operation is finished,
callback will be invoked in the thread-default main context
(see GLib.MainContext.push_thread_default)
of the thread you are calling this method from. You can
then call g_dbus_connection_flush_finish() to get the result of the
operation. See g_dbus_connection_flush_sync() for the synchronous
version.
a Gio.Cancellable or null
a Gio.AsyncReadyCallback to call when the request is satisfied or null if you don't care about the result
Asynchronously flushes connection, that is, writes all queued
outgoing messages to the transport and then flushes the transport
(using g_output_stream_flush_async()). This is useful in programs
that want to emit a D-Bus signal and then exit immediately. Without
flushing the connection, there is no guarantee that the message has
been sent to the networking buffers in the OS kernel.
This is an asynchronous method. When the operation is finished,
callback will be invoked in the thread-default main context
(see GLib.MainContext.push_thread_default)
of the thread you are calling this method from. You can
then call g_dbus_connection_flush_finish() to get the result of the
operation. See g_dbus_connection_flush_sync() for the synchronous
version.
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
Optionalcallback: AsyncReadyCallback<Gio.DBusConnection>a Gio.AsyncReadyCallback to call when the request is satisfied or null if you don't care about the result
Finishes an operation started with g_dbus_connection_flush().
a Gio.AsyncResult obtained from the Gio.AsyncReadyCallback passed to g_dbus_connection_flush()
true if the operation succeeded, false if error is set
Synchronously flushes connection. The calling thread is blocked
until this is done. See g_dbus_connection_flush() for the
asynchronous version of this method and more details about what it
does.
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
true if the operation succeeded, false if error is set
This function is intended for GObject.Object implementations to re-enforce
a [floating][floating-ref] object reference. Doing this is seldom
required: all GInitiallyUnowneds are created with a floating reference
which usually just needs to be sunken by calling g_object_ref_sink().
Increases the freeze count on object. If the freeze count is
non-zero, the emission of "notify" signals on object is
stopped. The signals are queued until the freeze count is decreased
to zero. Duplicate notifications are squashed so that at most one
GObject.Object::notify signal is emitted for each property modified while the
object is frozen.
This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.
Gets the capabilities negotiated with the remote peer
zero or more flags from the Gio.DBusCapabilityFlags enumeration
Gets a named field from the objects table of associations (see g_object_set_data()).
name of the key for that association
the data if found, or null if no such data exists.
Gets whether the process is terminated when connection is
closed by the remote peer. See
Gio.DBusConnection.exit_on_close for more details.
whether the process is terminated when connection is closed by the remote peer
Gets the flags used to construct this connection
zero or more flags from the Gio.DBusConnectionFlags enumeration
The GUID of the peer performing the role of server when authenticating. See Gio.DBusConnection.guid for more details.
The GUID. Do not free this string, it is owned by connection.
Retrieves the last serial number assigned to a Gio.DBusMessage on
the current thread. This includes messages sent via both low-level
API such as g_dbus_connection_send_message() as well as
high-level API such as g_dbus_connection_emit_signal(),
g_dbus_connection_call() or g_dbus_proxy_call().
the last used serial or zero when no message has been sent within the current thread
Gets the credentials of the authenticated peer. This will always
return null unless connection acted as a server
(e.g. Gio.DBusConnectionFlags.AUTHENTICATION_SERVER was passed)
when set up and the client passed credentials as part of the
authentication process.
In a message bus setup, the message bus is always the server and
each application is a client. So this method will always return
null for message bus clients.
a Gio.Credentials or null if not available. Do not free this object, it is owned by connection.
Gets a property of an object.
The value can be:
In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
The name of the property to get
Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
This function gets back user data pointers stored via
g_object_set_qdata().
A GLib.Quark, naming the user data pointer
The user data pointer set, or null
Gets the underlying stream used for IO.
While the Gio.DBusConnection is active, it will interact with this stream from a worker thread, so it is not safe to interact with the stream directly.
the stream used for IO
Gets the unique name of connection as assigned by the message
bus. This can also be used to figure out if connection is a
message bus connection.
the unique name or null if connection is not a message bus connection. Do not free this string, it is owned by connection.
Gets n_properties properties for an object.
Obtained properties will be set to values. All properties must be valid.
Warnings will be emitted and undefined behaviour may result if invalid
properties are passed in.
the names of each property to get
the values of each property to get
Initializes the object implementing the interface.
This method is intended for language bindings. If writing in C,
g_initable_new() should typically be used instead.
The object must be initialized before any real use after initial
construction, either with this function or g_async_initable_init_async().
Implementations may also support cancellation. If cancellable is not null,
then initialization can be cancelled by triggering the cancellable object
from another thread. If the operation was cancelled, the error
Gio.IOErrorEnum.CANCELLED will be returned. If cancellable is not null and
the object doesn't support cancellable initialization the error
Gio.IOErrorEnum.NOT_SUPPORTED will be returned.
If the object is not initialized, or initialization returns with an
error, then all operations on the object except g_object_ref() and
g_object_unref() are considered to be invalid, and have undefined
behaviour. See the [description][iface@Gio.Initable#description] for more details.
Callers should not assume that a class which implements Gio.Initable can be
initialized multiple times, unless the class explicitly documents itself as
supporting this. Generally, a class’ implementation of init() can assume
(and assert) that it will only be called once. Previously, this documentation
recommended all Gio.Initable implementations should be idempotent; that
recommendation was relaxed in GLib 2.54.
If a class explicitly supports being initialized multiple times, it is recommended that the method is idempotent: multiple calls with the same arguments should return the same results. Only the first call initializes the object; further calls return the result of the first call.
One reason why a class might need to support idempotent initialization is if
it is designed to be used via the singleton pattern, with a
GObject.ObjectClass.constructor that sometimes returns an existing instance.
In this pattern, a caller would expect to be able to call g_initable_init()
on the result of g_object_new(), regardless of whether it is in fact a new
instance.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore.
true if successful. If an error has occurred, this function will return false and set error appropriately if present.
Starts asynchronous initialization of the object implementing the
interface. This must be done before any real use of the object after
initial construction. If the object also implements Gio.Initable you can
optionally call g_initable_init() instead.
This method is intended for language bindings. If writing in C,
g_async_initable_new_async() should typically be used instead.
When the initialization is finished, callback will be called. You can
then call g_async_initable_init_finish() to get the result of the
initialization.
Implementations may also support cancellation. If cancellable is not
null, then initialization can be cancelled by triggering the cancellable
object from another thread. If the operation was cancelled, the error
Gio.IOErrorEnum.CANCELLED will be returned. If cancellable is not null, and
the object doesn't support cancellable initialization, the error
Gio.IOErrorEnum.NOT_SUPPORTED will be returned.
As with Gio.Initable, if the object is not initialized, or initialization
returns with an error, then all operations on the object except
g_object_ref() and g_object_unref() are considered to be invalid, and
have undefined behaviour. They will often fail with g_critical() or
g_warning(), but this must not be relied on.
Callers should not assume that a class which implements Gio.AsyncInitable can
be initialized multiple times; for more information, see g_initable_init().
If a class explicitly supports being initialized multiple times,
implementation requires yielding all subsequent calls to init_async() on the
results of the first call.
For classes that also support the Gio.Initable interface, the default
implementation of this method will run the g_initable_init() function
in a thread, so if you want to support asynchronous initialization via
threads, just implement the Gio.AsyncInitable interface without overriding
any interface methods.
the I/O priority of the operation
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore.
Starts asynchronous initialization of the object implementing the
interface. This must be done before any real use of the object after
initial construction. If the object also implements Gio.Initable you can
optionally call g_initable_init() instead.
This method is intended for language bindings. If writing in C,
g_async_initable_new_async() should typically be used instead.
When the initialization is finished, callback will be called. You can
then call g_async_initable_init_finish() to get the result of the
initialization.
Implementations may also support cancellation. If cancellable is not
null, then initialization can be cancelled by triggering the cancellable
object from another thread. If the operation was cancelled, the error
Gio.IOErrorEnum.CANCELLED will be returned. If cancellable is not null, and
the object doesn't support cancellable initialization, the error
Gio.IOErrorEnum.NOT_SUPPORTED will be returned.
As with Gio.Initable, if the object is not initialized, or initialization
returns with an error, then all operations on the object except
g_object_ref() and g_object_unref() are considered to be invalid, and
have undefined behaviour. They will often fail with g_critical() or
g_warning(), but this must not be relied on.
Callers should not assume that a class which implements Gio.AsyncInitable can
be initialized multiple times; for more information, see g_initable_init().
If a class explicitly supports being initialized multiple times,
implementation requires yielding all subsequent calls to init_async() on the
results of the first call.
For classes that also support the Gio.Initable interface, the default
implementation of this method will run the g_initable_init() function
in a thread, so if you want to support asynchronous initialization via
threads, just implement the Gio.AsyncInitable interface without overriding
any interface methods.
the I/O priority of the operation
optional Gio.Cancellable object, null to ignore.
a Gio.AsyncReadyCallback to call when the request is satisfied
Starts asynchronous initialization of the object implementing the
interface. This must be done before any real use of the object after
initial construction. If the object also implements Gio.Initable you can
optionally call g_initable_init() instead.
This method is intended for language bindings. If writing in C,
g_async_initable_new_async() should typically be used instead.
When the initialization is finished, callback will be called. You can
then call g_async_initable_init_finish() to get the result of the
initialization.
Implementations may also support cancellation. If cancellable is not
null, then initialization can be cancelled by triggering the cancellable
object from another thread. If the operation was cancelled, the error
Gio.IOErrorEnum.CANCELLED will be returned. If cancellable is not null, and
the object doesn't support cancellable initialization, the error
Gio.IOErrorEnum.NOT_SUPPORTED will be returned.
As with Gio.Initable, if the object is not initialized, or initialization
returns with an error, then all operations on the object except
g_object_ref() and g_object_unref() are considered to be invalid, and
have undefined behaviour. They will often fail with g_critical() or
g_warning(), but this must not be relied on.
Callers should not assume that a class which implements Gio.AsyncInitable can
be initialized multiple times; for more information, see g_initable_init().
If a class explicitly supports being initialized multiple times,
implementation requires yielding all subsequent calls to init_async() on the
results of the first call.
For classes that also support the Gio.Initable interface, the default
implementation of this method will run the g_initable_init() function
in a thread, so if you want to support asynchronous initialization via
threads, just implement the Gio.AsyncInitable interface without overriding
any interface methods.
the I/O priority of the operation
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore.
Optionalcallback: AsyncReadyCallback<Gio.DBusConnection>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes asynchronous initialization and returns the result.
See g_async_initable_init_async().
true if successful. If an error has occurred, this function will return false and set error appropriately if present.
Gets whether connection is closed.
true if the connection is closed, false otherwise
Checks whether object has a [floating][floating-ref] reference.
true if object has a floating reference
Finishes the async construction for the various g_async_initable_new
calls, returning the created object or null on error.
the Gio.AsyncResult from the callback
a newly created GObject.Object, or null on error. Free with g_object_unref().
Emits a "notify" signal for the property property_name on object.
When possible, eg. when signaling a property change from within the class
that registered the property, you should use g_object_notify_by_pspec()
instead.
Note that emission of the notify signal may be blocked with
g_object_freeze_notify(). In this case, the signal emissions are queued
and will be emitted (in reverse order) when g_object_thaw_notify() is
called.
the name of a property installed on the class of object.
Emits a "notify" signal for the property specified by pspec on object.
This function omits the property name lookup, hence it is faster than
g_object_notify().
One way to avoid using g_object_notify() from within the
class that registered the properties, and using g_object_notify_by_pspec()
instead, is to store the GParamSpec used with
g_object_class_install_property() inside a static array, e.g.:
typedef enum
{
PROP_FOO = 1,
PROP_LAST
} MyObjectProperty;
static GParamSpec *properties[PROP_LAST];
static void
my_object_class_init (MyObjectClass *klass)
{
properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
0, 100,
50,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (gobject_class,
PROP_FOO,
properties[PROP_FOO]);
}
and then notify a change on the "foo" property with:
g_object_notify_by_pspec (self, properties[PROP_FOO]);
the GObject.ParamSpec of a property installed on the class of object.
the well-known name to own
a set of flags with ownership options
Optionalname_acquired_closure: Closure<any, any>closure to invoke when name is acquired, or NULL to ignore
Optionalname_lost_closure: Closure<any, any>closure to invoke when name is lost, or NULL to ignore
Increases the reference count of object.
Since GLib 2.56, if GLIB_VERSION_MAX_ALLOWED is 2.56 or greater, the type
of object will be propagated to the return type (using the GCC typeof()
extension), so any casting the caller needs to do on the return type must be
explicit.
the same object
Increase the reference count of object, and possibly remove the
[floating][floating-ref] reference, if object has a floating reference.
In other words, if the object is floating, then this call "assumes ownership" of the floating reference, converting it to a normal reference by clearing the floating flag while leaving the reference count unchanged. If the object is not floating, then this call adds a new normal reference increasing the reference count by one.
Since GLib 2.56, the type of object will be propagated to the return type
under the same conditions as for g_object_ref().
object
Registers callbacks for exported objects at object_path with the
D-Bus interface that is described in interface_info.
Calls to functions in vtable (and user_data_free_func) will happen
in the thread-default main context
(see GLib.MainContext.push_thread_default)
of the thread you are calling this method from.
Note that all GLib.Variant values passed to functions in vtable will match
the signature given in interface_info - if a remote caller passes
incorrect values, the org.freedesktop.DBus.Error.InvalidArgs
is returned to the remote caller.
Additionally, if the remote caller attempts to invoke methods or
access properties not mentioned in interface_info the
org.freedesktop.DBus.Error.UnknownMethod resp.
org.freedesktop.DBus.Error.InvalidArgs errors
are returned to the caller.
It is considered a programming error if the
Gio.DBusInterfaceGetPropertyFunc function in vtable returns a
GLib.Variant of incorrect type.
If an existing callback is already registered at object_path and
interface_name, then error is set to Gio.IOErrorEnum.EXISTS.
GDBus automatically implements the standard D-Bus interfaces org.freedesktop.DBus.Properties, org.freedesktop.DBus.Introspectable and org.freedesktop.Peer, so you don't have to implement those for the objects you export. You can implement org.freedesktop.DBus.Properties yourself, e.g. to handle getting and setting of properties asynchronously.
Note that the reference count on interface_info will be
incremented by 1 (unless allocated statically, e.g. if the
reference count is -1, see g_dbus_interface_info_ref()) for as long
as the object is exported. Also note that vtable will be copied.
See this [server][class@Gio.DBusConnection#an-example-d-bus-server] for an example of how to use this method.
the object path to register at
introspection data for the interface
Optionalvtable: DBusInterfaceVTablea Gio.DBusInterfaceVTable to call into or null
Optionaluser_data: anydata to pass to functions in vtable
0 if error is set, otherwise a registration id (never 0) that can be used with g_dbus_connection_unregister_object()
Version of g_dbus_connection_register_object() using closures instead of a
Gio.DBusInterfaceVTable for easier binding in other languages.
Note that the reference counting semantics of the function wrapped by
method_call_closure are the same as those of
Gio.DBusInterfaceMethodCallFunc: ownership of a reference to the
Gio.DBusMethodInvocation is transferred to the function.
The object path to register at.
Introspection data for the interface.
Optionalmethod_call_closure: Closure<any, any>GObject.Closure for handling incoming method calls.
Optionalget_property_closure: Closure<any, any>GObject.Closure for getting a property.
Optionalset_property_closure: Closure<any, any>GObject.Closure for setting a property.
0 if error is set, otherwise a registration ID (never 0) that can be used with g_dbus_connection_unregister_object() .
Version of Gio.DBusConnection.register_object using closures instead of a Gio.DBusInterfaceVTable for easier binding in other languages.
In contrast to Gio.DBusConnection.register_object and
Gio.DBusConnection.register_object_with_closures, the reference
counting semantics of the function wrapped by method_call_closure are not
the same as those of Gio.DBusInterfaceMethodCallFunc. Ownership of
a reference to the Gio.DBusMethodInvocation is not transferred to
the function. Bindings must ensure that they add a reference to the
Gio.DBusMethodInvocation before calling any
g_dbus_method_invocation_return_*() methods on it. This should be automatic
as a result of the introspection annotations on those methods.
The object path to register at.
Introspection data for the interface.
Optionalmethod_call_closure: Closure<any, any>GObject.Closure for handling incoming method calls.
Optionalget_property_closure: Closure<any, any>GObject.Closure for getting a property.
Optionalset_property_closure: Closure<any, any>GObject.Closure for setting a property.
0 if error is set, otherwise a registration ID (never 0) that can be used with Gio.DBusConnection.unregister_object.
Registers a whole subtree of dynamic objects.
The enumerate and introspection functions in vtable are used to
convey, to remote callers, what nodes exist in the subtree rooted
by object_path.
When handling remote calls into any node in the subtree, first the
enumerate function is used to check if the node exists. If the node exists
or the Gio.DBusSubtreeFlags.DISPATCH_TO_UNENUMERATED_NODES flag is set
the introspection function is used to check if the node supports the
requested method. If so, the dispatch function is used to determine
where to dispatch the call. The collected Gio.DBusInterfaceVTable and
gpointer will be used to call into the interface vtable for processing
the request.
All calls into user-provided code will be invoked in the thread-default main context (see GLib.MainContext.push_thread_default) of the thread you are calling this method from.
If an existing subtree is already registered at object_path or
then error is set to Gio.IOErrorEnum.EXISTS.
Note that it is valid to register regular objects (using
g_dbus_connection_register_object()) in a subtree registered with
g_dbus_connection_register_subtree() - if so, the subtree handler
is tried as the last resort. One way to think about a subtree
handler is to consider it a fallback handler for object paths not
registered via g_dbus_connection_register_object() or other bindings.
Note that vtable will be copied so you cannot change it after
registration.
See this [server][class@Gio.DBusConnection#an-example-for-exporting-a-subtree] for an example of how to use this method.
the object path to register the subtree at
a Gio.DBusSubtreeVTable to enumerate, introspect and dispatch nodes in the subtree
flags used to fine tune the behavior of the subtree
Optionaluser_data: anydata to pass to functions in vtable
0 if error is set, otherwise a subtree registration ID (never 0) that can be used with g_dbus_connection_unregister_subtree()
Removes a filter.
Note that since filters run in a different thread, there is a race
condition where it is possible that the filter will be running even
after calling g_dbus_connection_remove_filter(), so you cannot just
free data that the filter might be using. Instead, you should pass
a GLib.DestroyNotify to g_dbus_connection_add_filter(), which will be
called when it is guaranteed that the data is no longer needed.
an identifier obtained from g_dbus_connection_add_filter()
Releases all references to other objects. This can be used to break reference cycles.
This function should only be called from object system implementations.
Asynchronously sends message to the peer represented by connection.
Unless flags contain the
Gio.DBusSendMessageFlags.PRESERVE_SERIAL flag, the serial number
will be assigned by connection and set on message via
g_dbus_message_set_serial(). If out_serial is not null, then the
serial number used will be written to this location prior to
submitting the message to the underlying transport. While it has a volatile
qualifier, this is a historical artifact and the argument passed to it should
not be volatile.
If connection is closed then the operation will fail with
Gio.IOErrorEnum.CLOSED. If message is not well-formed,
the operation fails with Gio.IOErrorEnum.INVALID_ARGUMENT.
See this [server][class@Gio.DBusConnection#an-example-d-bus-server] and [client][class@Gio.DBusConnection#an-example-for-file-descriptor-passing] for an example of how to use this low-level API to send and receive UNIX file descriptors.
Note that message must be unlocked, unless flags contain the
Gio.DBusSendMessageFlags.PRESERVE_SERIAL flag.
flags affecting how the message is sent
true if the message was well-formed and queued for transmission, false if error is set
Asynchronously sends message to the peer represented by connection.
Unless flags contain the
Gio.DBusSendMessageFlags.PRESERVE_SERIAL flag, the serial number
will be assigned by connection and set on message via
g_dbus_message_set_serial(). If out_serial is not null, then the
serial number used will be written to this location prior to
submitting the message to the underlying transport. While it has a volatile
qualifier, this is a historical artifact and the argument passed to it should
not be volatile.
If connection is closed then the operation will fail with
Gio.IOErrorEnum.CLOSED. If cancellable is canceled, the operation will
fail with Gio.IOErrorEnum.CANCELLED. If message is not well-formed,
the operation fails with Gio.IOErrorEnum.INVALID_ARGUMENT.
This is an asynchronous method. When the operation is finished, callback
will be invoked in the thread-default main context
(see GLib.MainContext.push_thread_default)
of the thread you are calling this method from. You can then call
g_dbus_connection_send_message_with_reply_finish() to get the result of the operation.
See g_dbus_connection_send_message_with_reply_sync() for the synchronous version.
Note that message must be unlocked, unless flags contain the
Gio.DBusSendMessageFlags.PRESERVE_SERIAL flag.
See this [server][class@Gio.DBusConnection#an-example-d-bus-server] and [client][class@Gio.DBusConnection#an-example-for-file-descriptor-passing] for an example of how to use this low-level API to send and receive UNIX file descriptors.
flags affecting how the message is sent
the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
Asynchronously sends message to the peer represented by connection.
Unless flags contain the
Gio.DBusSendMessageFlags.PRESERVE_SERIAL flag, the serial number
will be assigned by connection and set on message via
g_dbus_message_set_serial(). If out_serial is not null, then the
serial number used will be written to this location prior to
submitting the message to the underlying transport. While it has a volatile
qualifier, this is a historical artifact and the argument passed to it should
not be volatile.
If connection is closed then the operation will fail with
Gio.IOErrorEnum.CLOSED. If cancellable is canceled, the operation will
fail with Gio.IOErrorEnum.CANCELLED. If message is not well-formed,
the operation fails with Gio.IOErrorEnum.INVALID_ARGUMENT.
This is an asynchronous method. When the operation is finished, callback
will be invoked in the thread-default main context
(see GLib.MainContext.push_thread_default)
of the thread you are calling this method from. You can then call
g_dbus_connection_send_message_with_reply_finish() to get the result of the operation.
See g_dbus_connection_send_message_with_reply_sync() for the synchronous version.
Note that message must be unlocked, unless flags contain the
Gio.DBusSendMessageFlags.PRESERVE_SERIAL flag.
See this [server][class@Gio.DBusConnection#an-example-d-bus-server] and [client][class@Gio.DBusConnection#an-example-for-file-descriptor-passing] for an example of how to use this low-level API to send and receive UNIX file descriptors.
flags affecting how the message is sent
the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout
a Gio.Cancellable or null
a Gio.AsyncReadyCallback to call when the request is satisfied or null if you don't care about the result
Asynchronously sends message to the peer represented by connection.
Unless flags contain the
Gio.DBusSendMessageFlags.PRESERVE_SERIAL flag, the serial number
will be assigned by connection and set on message via
g_dbus_message_set_serial(). If out_serial is not null, then the
serial number used will be written to this location prior to
submitting the message to the underlying transport. While it has a volatile
qualifier, this is a historical artifact and the argument passed to it should
not be volatile.
If connection is closed then the operation will fail with
Gio.IOErrorEnum.CLOSED. If cancellable is canceled, the operation will
fail with Gio.IOErrorEnum.CANCELLED. If message is not well-formed,
the operation fails with Gio.IOErrorEnum.INVALID_ARGUMENT.
This is an asynchronous method. When the operation is finished, callback
will be invoked in the thread-default main context
(see GLib.MainContext.push_thread_default)
of the thread you are calling this method from. You can then call
g_dbus_connection_send_message_with_reply_finish() to get the result of the operation.
See g_dbus_connection_send_message_with_reply_sync() for the synchronous version.
Note that message must be unlocked, unless flags contain the
Gio.DBusSendMessageFlags.PRESERVE_SERIAL flag.
See this [server][class@Gio.DBusConnection#an-example-d-bus-server] and [client][class@Gio.DBusConnection#an-example-for-file-descriptor-passing] for an example of how to use this low-level API to send and receive UNIX file descriptors.
flags affecting how the message is sent
the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
Optionalcallback: AsyncReadyCallback<Gio.DBusConnection>a Gio.AsyncReadyCallback to call when the request is satisfied or null if you don't care about the result
Finishes an operation started with g_dbus_connection_send_message_with_reply().
Note that error is only set if a local in-process error
occurred. That is to say that the returned Gio.DBusMessage object may
be of type Gio.DBusMessageType.ERROR. Use
g_dbus_message_to_gerror() to transcode this to a GLib.Error.
See this [server][class@Gio.DBusConnection#an-example-d-bus-server] and [client][class@Gio.DBusConnection#an-example-for-file-descriptor-passing] for an example of how to use this low-level API to send and receive UNIX file descriptors.
a Gio.AsyncResult obtained from the Gio.AsyncReadyCallback passed to g_dbus_connection_send_message_with_reply()
a locked Gio.DBusMessage or null if error is set
Synchronously sends message to the peer represented by connection
and blocks the calling thread until a reply is received or the
timeout is reached. See g_dbus_connection_send_message_with_reply()
for the asynchronous version of this method.
Unless flags contain the
Gio.DBusSendMessageFlags.PRESERVE_SERIAL flag, the serial number
will be assigned by connection and set on message via
g_dbus_message_set_serial(). If out_serial is not null, then the
serial number used will be written to this location prior to
submitting the message to the underlying transport. While it has a volatile
qualifier, this is a historical artifact and the argument passed to it should
not be volatile.
If connection is closed then the operation will fail with
Gio.IOErrorEnum.CLOSED. If cancellable is canceled, the operation will
fail with Gio.IOErrorEnum.CANCELLED. If message is not well-formed,
the operation fails with Gio.IOErrorEnum.INVALID_ARGUMENT.
Note that error is only set if a local in-process error
occurred. That is to say that the returned Gio.DBusMessage object may
be of type Gio.DBusMessageType.ERROR. Use
g_dbus_message_to_gerror() to transcode this to a GLib.Error.
See this [server][class@Gio.DBusConnection#an-example-d-bus-server] and [client][class@Gio.DBusConnection#an-example-for-file-descriptor-passing] for an example of how to use this low-level API to send and receive UNIX file descriptors.
Note that message must be unlocked, unless flags contain the
Gio.DBusSendMessageFlags.PRESERVE_SERIAL flag.
flags affecting how the message is sent.
the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
a locked Gio.DBusMessage that is the reply to message or null if error is set
Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
Object containing the properties to set
Each object carries around a table of associations from strings to pointers. This function lets you set an association.
If the object already had an association with that name, the old association will be destroyed.
Internally, the key is converted to a GLib.Quark using g_quark_from_string().
This means a copy of key is kept permanently (even after object has been
finalized) — so it is recommended to only use a small, bounded set of values
for key in your program, to avoid the GLib.Quark storage growing unbounded.
name of the key
Optionaldata: anydata to associate with that key
Sets whether the process should be terminated when connection is
closed by the remote peer. See Gio.DBusConnection.exit_on_close for
more details.
Note that this function should be used with care. Most modern UNIX
desktops tie the notion of a user session with the session bus, and expect
all of a user's applications to quit when their bus connection goes away.
If you are setting exit_on_close to false for the shared session
bus connection, you should make sure that your application exits
when the user session ends.
whether the process should be terminated when connection is closed by the remote peer
Sets a property on an object.
The name of the property to set
The value to set the property to
Subscribes to signals on connection and invokes callback whenever
the signal is received. Note that callback will be invoked in the
thread-default main context (see GLib.MainContext.push_thread_default)
of the thread you are calling this method from.
If connection is not a message bus connection, sender must be
null.
If sender is a well-known name note that callback is invoked with
the unique name for the owner of sender, not the well-known name
as one would expect. This is because the message bus rewrites the
name. As such, to avoid certain race conditions, users should be
tracking the name owner of the well-known name and use that when
processing the received signal.
If one of Gio.DBusSignalFlags.MATCH_ARG0_NAMESPACE or
Gio.DBusSignalFlags.MATCH_ARG0_PATH are given, arg0 is
interpreted as part of a namespace or path. The first argument
of a signal is matched against that part as specified by D-Bus.
If user_data_free_func is non-null, it will be called (in the
thread-default main context of the thread you are calling this
method from) at some point after user_data is no longer
needed. (It is not guaranteed to be called synchronously when the
signal is unsubscribed from, and may be called after connection
has been destroyed.)
As callback is potentially invoked in a different thread from where it’s
emitted, it’s possible for this to happen after
g_dbus_connection_signal_unsubscribe() has been called in another thread.
Due to this, user_data should have a strong reference which is freed with
user_data_free_func, rather than pointing to data whose lifecycle is tied
to the signal subscription. For example, if a GObject.Object is used to store the
subscription ID from g_dbus_connection_signal_subscribe(), a strong reference
to that GObject.Object must be passed to user_data, and g_object_unref() passed to
user_data_free_func. You are responsible for breaking the resulting
reference count cycle by explicitly unsubscribing from the signal when
dropping the last external reference to the GObject.Object. Alternatively, a weak
reference may be used.
It is guaranteed that if you unsubscribe from a signal using
g_dbus_connection_signal_unsubscribe() from the same thread which made the
corresponding g_dbus_connection_signal_subscribe() call, callback will not
be invoked after g_dbus_connection_signal_unsubscribe() returns.
The returned subscription identifier is an opaque value which is guaranteed to never be zero.
This function can never fail.
sender name to match on (unique or well-known name) or null to listen from all senders
D-Bus interface name to match on or null to match on all interfaces
D-Bus signal name to match on or null to match on all signals
object path to match on or null to match on all object paths
contents of first string argument to match on or null to match on all kinds of arguments
Gio.DBusSignalFlags describing how arg0 is used in subscribing to the signal
callback to invoke when there is a signal matching the requested data
Optionaluser_data_free_func: DestroyNotifyfunction to free user_data with when subscription is removed or null
a subscription identifier that can be used with g_dbus_connection_signal_unsubscribe()
Unsubscribes from signals.
Note that there may still be D-Bus traffic to process (relating to this
signal subscription) in the current thread-default GLib.MainContext after this
function has returned. You should continue to iterate the GLib.MainContext
until the GLib.DestroyNotify function passed to
g_dbus_connection_signal_subscribe() is called, in order to avoid memory
leaks through callbacks queued on the GLib.MainContext after it’s stopped being
iterated.
Alternatively, any idle source with a priority lower than G_PRIORITY_DEFAULT
that was scheduled after unsubscription, also indicates that all resources
of this subscription are released.
a subscription id obtained from g_dbus_connection_signal_subscribe()
If connection was created with
Gio.DBusConnectionFlags.DELAY_MESSAGE_PROCESSING, this method
starts processing messages. Does nothing on if connection wasn't
created with this flag or if the method has already been called.
Remove a specified datum from the object's data associations, without invoking the association's destroy handler.
name of the key
the data if found, or null if no such data exists.
This function gets back user data pointers stored via
g_object_set_qdata() and removes the data from object
without invoking its destroy() function (if any was
set).
Usually, calling this function is only required to update
user data pointers with a destroy notifier, for example:
void
object_add_to_user_list (GObject *object,
const gchar *new_string)
{
// the quark, naming the object data
GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
// retrieve the old string list
GList *list = g_object_steal_qdata (object, quark_string_list);
// prepend new string
list = g_list_prepend (list, g_strdup (new_string));
// this changed 'list', so we need to set it again
g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
}
static void
free_string_list (gpointer data)
{
GList *node, *list = data;
for (node = list; node; node = node->next)
g_free (node->data);
g_list_free (list);
}
Using g_object_get_qdata() in the above example, instead of
g_object_steal_qdata() would have left the destroy function set,
and thus the partial string list would have been freed upon
g_object_set_qdata_full().
A GLib.Quark, naming the user data pointer
The user data pointer set, or null
Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
Name of the signal to stop emission of
Reverts the effect of a previous call to
g_object_freeze_notify(). The freeze count is decreased on object
and when it reaches zero, queued "notify" signals are emitted.
Duplicate notifications for each property are squashed so that at most one GObject.Object::notify signal is emitted for each property, in the reverse order in which they have been queued.
It is an error to call this function when the freeze count is zero.
Unblocks a handler so it will be called again during any signal emissions
Handler ID of the handler to be unblocked
Reverses the effect of a previous call to Gio.DBusConnection.export_action_group.
It is an error to call this function with an ID that wasn’t returned from Gio.DBusConnection.export_action_group or to call it with the same ID more than once.
the ID from Gio.DBusConnection.export_action_group
Reverses the effect of a previous call to
g_dbus_connection_export_menu_model().
It is an error to call this function with an ID that wasn't returned
from g_dbus_connection_export_menu_model() or to call it with the
same ID more than once.
the ID from g_dbus_connection_export_menu_model()
an identifier obtained from Gio.bus_own_name
Decreases the reference count of object. When its reference count
drops to 0, the object is finalized (i.e. its memory is freed).
If the pointer to the GObject.Object may be reused in future (for example, if it is
an instance variable of another object), it is recommended to clear the
pointer to null rather than retain a dangling pointer to a potentially
invalid GObject.Object instance. Use g_clear_object() for this.
Unregisters an object.
a registration id obtained from g_dbus_connection_register_object()
true if the object was unregistered, false otherwise
Unregisters a subtree.
a subtree registration id obtained from g_dbus_connection_register_subtree()
true if the subtree was unregistered, false otherwise
An identifier obtained from g_bus_watch_name()
Virtualvfunc_the constructed function is called by g_object_new() as the
final step of the object creation process. At the point of the call, all
construction properties have been set on the object. The purpose of this
call is to allow for object initialisation steps that can only be performed
after construction properties have been set. constructed implementors
should chain up to the constructed call of their parent class to allow it
to complete its initialisation.
Virtualvfunc_Virtualvfunc_the dispose function is supposed to drop all references to other
objects, but keep the instance otherwise intact, so that client method
invocations still work. It may be run multiple times (due to reference
loops). Before returning, dispose should chain up to the dispose method
of the parent class.
Virtualvfunc_instance finalization function, should finish the finalization of
the instance begun in dispose and chain up to the finalize method of the
parent class.
Virtualvfunc_Virtualvfunc_Initializes the object implementing the interface.
This method is intended for language bindings. If writing in C,
g_initable_new() should typically be used instead.
The object must be initialized before any real use after initial
construction, either with this function or g_async_initable_init_async().
Implementations may also support cancellation. If cancellable is not null,
then initialization can be cancelled by triggering the cancellable object
from another thread. If the operation was cancelled, the error
Gio.IOErrorEnum.CANCELLED will be returned. If cancellable is not null and
the object doesn't support cancellable initialization the error
Gio.IOErrorEnum.NOT_SUPPORTED will be returned.
If the object is not initialized, or initialization returns with an
error, then all operations on the object except g_object_ref() and
g_object_unref() are considered to be invalid, and have undefined
behaviour. See the [description][iface@Gio.Initable#description] for more details.
Callers should not assume that a class which implements Gio.Initable can be
initialized multiple times, unless the class explicitly documents itself as
supporting this. Generally, a class’ implementation of init() can assume
(and assert) that it will only be called once. Previously, this documentation
recommended all Gio.Initable implementations should be idempotent; that
recommendation was relaxed in GLib 2.54.
If a class explicitly supports being initialized multiple times, it is recommended that the method is idempotent: multiple calls with the same arguments should return the same results. Only the first call initializes the object; further calls return the result of the first call.
One reason why a class might need to support idempotent initialization is if
it is designed to be used via the singleton pattern, with a
GObject.ObjectClass.constructor that sometimes returns an existing instance.
In this pattern, a caller would expect to be able to call g_initable_init()
on the result of g_object_new(), regardless of whether it is in fact a new
instance.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore.
Virtualvfunc_Starts asynchronous initialization of the object implementing the
interface. This must be done before any real use of the object after
initial construction. If the object also implements Gio.Initable you can
optionally call g_initable_init() instead.
This method is intended for language bindings. If writing in C,
g_async_initable_new_async() should typically be used instead.
When the initialization is finished, callback will be called. You can
then call g_async_initable_init_finish() to get the result of the
initialization.
Implementations may also support cancellation. If cancellable is not
null, then initialization can be cancelled by triggering the cancellable
object from another thread. If the operation was cancelled, the error
Gio.IOErrorEnum.CANCELLED will be returned. If cancellable is not null, and
the object doesn't support cancellable initialization, the error
Gio.IOErrorEnum.NOT_SUPPORTED will be returned.
As with Gio.Initable, if the object is not initialized, or initialization
returns with an error, then all operations on the object except
g_object_ref() and g_object_unref() are considered to be invalid, and
have undefined behaviour. They will often fail with g_critical() or
g_warning(), but this must not be relied on.
Callers should not assume that a class which implements Gio.AsyncInitable can
be initialized multiple times; for more information, see g_initable_init().
If a class explicitly supports being initialized multiple times,
implementation requires yielding all subsequent calls to init_async() on the
results of the first call.
For classes that also support the Gio.Initable interface, the default
implementation of this method will run the g_initable_init() function
in a thread, so if you want to support asynchronous initialization via
threads, just implement the Gio.AsyncInitable interface without overriding
any interface methods.
the I/O priority of the operation
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore.
Optionalcallback: AsyncReadyCallback<Gio.DBusConnection>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes asynchronous initialization and returns the result.
See g_async_initable_init_async().
Virtualvfunc_Emits a "notify" signal for the property property_name on object.
When possible, eg. when signaling a property change from within the class
that registered the property, you should use g_object_notify_by_pspec()
instead.
Note that emission of the notify signal may be blocked with
g_object_freeze_notify(). In this case, the signal emissions are queued
and will be emitted (in reverse order) when g_object_thaw_notify() is
called.
Virtualvfunc_the generic setter for all properties of this type. Should be
overridden for every type with properties. If implementations of
set_property don't emit property change notification explicitly, this will
be done implicitly by the type system. However, if the notify signal is
emitted explicitly, the type system will not emit it a second time.
This function essentially limits the life time of the closure to
the life time of the object. That is, when the object is finalized,
the closure is invalidated by calling g_closure_invalidate() on
it, in order to prevent invocations of the closure with a finalized
(nonexisting) object. Also, g_object_ref() and g_object_unref() are
added as marshal guards to the closure, to ensure that an extra
reference count is held on object during invocation of the
closure. Usually, this function will be called on closures that
use this object as closure data.
GObject.Closure to watch
The name (well-known or unique) to watch.
Flags from the Gio.BusNameWatcherFlags enumeration.
Optionalname_appeared_closure: Closure<any, any>GObject.Closure to invoke when name is known to exist or null.
Optionalname_vanished_closure: Closure<any, any>GObject.Closure to invoke when name is known to not exist or null.
StaticnewAsynchronously sets up a D-Bus connection for exchanging D-Bus messages
with the end represented by stream.
If stream is a Gio.SocketConnection, then the corresponding Gio.Socket
will be put into non-blocking mode.
The D-Bus connection will interact with stream from a worker thread.
As a result, the caller should not interact with stream after this
method has been called, except by calling g_object_unref() on it.
If observer is not null it may be used to control the
authentication process.
When the operation is finished, callback will be invoked. You can
then call g_dbus_connection_new_finish() to get the result of the
operation.
This is an asynchronous failable constructor. See
g_dbus_connection_new_sync() for the synchronous
version.
the GUID to use if authenticating as a server or null
flags describing how to make the connection
Optionalobserver: Gio.DBusAuthObservera Gio.DBusAuthObserver or null
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
Optionalcallback: AsyncReadyCallback<Gio.DBusConnection>a Gio.AsyncReadyCallback to call when the request is satisfied
Staticnew_Staticnew_Asynchronously connects and sets up a D-Bus client connection for
exchanging D-Bus messages with an endpoint specified by address
which must be in the
D-Bus address format.
This constructor can only be used to initiate client-side
connections - use g_dbus_connection_new() if you need to act as the
server. In particular, flags cannot contain the
Gio.DBusConnectionFlags.AUTHENTICATION_SERVER,
Gio.DBusConnectionFlags.AUTHENTICATION_ALLOW_ANONYMOUS or
Gio.DBusConnectionFlags.AUTHENTICATION_REQUIRE_SAME_USER flags.
When the operation is finished, callback will be invoked. You can
then call g_dbus_connection_new_for_address_finish() to get the result of
the operation.
If observer is not null it may be used to control the
authentication process.
This is an asynchronous failable constructor. See
g_dbus_connection_new_for_address_sync() for the synchronous
version.
a D-Bus address
flags describing how to make the connection
Optionalobserver: Gio.DBusAuthObservera Gio.DBusAuthObserver or null
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
Optionalcallback: AsyncReadyCallback<Gio.DBusConnection>a Gio.AsyncReadyCallback to call when the request is satisfied
Staticnew_Staticnew_Optionalobserver: Gio.DBusAuthObserverOptionalcancellable: Gio.CancellableStaticnew_Optionalobserver: Gio.DBusAuthObserverOptionalcancellable: Gio.CancellableStatic_Staticcompat_Optionaldata: anyStaticfind_Staticinstall_Staticinstall_the id for the new property
the GObject.ParamSpec for the new property
Staticinterface_Find the GObject.ParamSpec with the given name for an
interface. Generally, the interface vtable passed in as g_iface
will be the default vtable from g_type_default_interface_ref(), or,
if you know the interface has already been loaded,
g_type_default_interface_peek().
any interface vtable for the interface, or the default vtable for the interface
name of a property to look up.
Staticinterface_Add a property to an interface; this is only useful for interfaces
that are added to GObject-derived types. Adding a property to an
interface forces all objects classes with that interface to have a
compatible property. The compatible property could be a newly
created GObject.ParamSpec, but normally
g_object_class_override_property() will be used so that the object
class only needs to provide an implementation and inherits the
property description, default value, bounds, and so forth from the
interface property.
This function is meant to be called from the interface's default
vtable initialization function (the class_init member of
GObject.TypeInfo.) It must not be called after after class_init has
been called for any object types implementing this interface.
If pspec is a floating reference, it will be consumed.
any interface vtable for the interface, or the default vtable for the interface.
the GObject.ParamSpec for the new property
Staticinterface_Lists the properties of an interface.Generally, the interface
vtable passed in as g_iface will be the default vtable from
g_type_default_interface_ref(), or, if you know the interface has
already been loaded, g_type_default_interface_peek().
any interface vtable for the interface, or the default vtable for the interface
Staticlist_StaticnewvStaticoverride_the new property ID
the name of a property registered in a parent class or in an interface of this class.
The Gio.DBusConnection type is used for D-Bus connections to remote peers such as a message buses.
It is a low-level API that offers a lot of flexibility. For instance, it lets you establish a connection over any transport that can by represented as a Gio.IOStream.
This class is rarely used directly in D-Bus clients. If you are writing a D-Bus client, it is often easier to use the Gio.bus_own_name, Gio.bus_watch_name or Gio.DBusProxy.new_for_bus APIs.
As an exception to the usual GLib rule that a particular object must not be used by two threads at the same time, Gio.DBusConnections methods may be called from any thread. This is so that Gio.bus_get and Gio.bus_get_sync can safely return the same Gio.DBusConnection when called from any thread.
Most of the ways to obtain a Gio.DBusConnection automatically initialize it (i.e. connect to D-Bus): for instance, Gio.DBusConnection.new and Gio.bus_get, and the synchronous versions of those methods, give you an initialized connection. Language bindings for GIO should use Gio.Initable.new or Gio.AsyncInitable.new_async, which also initialize the connection.
If you construct an uninitialized Gio.DBusConnection, such as via GObject.Object.new, you must initialize it via Gio.Initable.init or Gio.AsyncInitable.init_async before using its methods or properties. Calling methods or accessing properties on a Gio.DBusConnection that has not completed initialization successfully is considered to be invalid, and leads to undefined behaviour. In particular, if initialization fails with a GLib.Error, the only valid thing you can do with that Gio.DBusConnection is to free it with GObject.Object.unref.
An example D-Bus server
Here is an example for a D-Bus server: gdbus-example-server.c
An example for exporting a subtree
Here is an example for exporting a subtree: gdbus-example-subtree.c
An example for file descriptor passing
Here is an example for passing UNIX file descriptors: gdbus-unix-fd-client.c
An example for exporting a GObject
Here is an example for exporting a GObject.Object: gdbus-example-export.c
Since
2.26