[836:14] static extends: object
Generated metadata helpers for DBusConnection class surfaces.
properties ()
Returns property metadata for
DBusConnection.
A list.signals ()
Returns signal metadata for
DBusConnection.
A list.[47:7] extends: object
The GDBusConnection 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 [class@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 [func@Gio.bus_own_name], [func@Gio.bus_watch_name] or
[func@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,
GDBusConnections methods may be called from any thread. This is so that
[func@Gio.bus_get] and [func@Gio.bus_get_sync] can safely return the same
GDBusConnection when called from any thread. Most of the ways to obtain a
GDBusConnection automatically initialize it (i.e. connect to D-Bus): for
instance, [func@Gio.DBusConnection.new] and [func@Gio.bus_get], and the
synchronous versions of those methods, give you an initialized connection.
Language bindings for GIO should use [func@Gio.Initable.new] or
[func@Gio.AsyncInitable.new_async], which also initialize the connection. If
you construct an uninitialized GDBusConnection, such as via
[ctor@GObject.Object.new], you must initialize it via
[method@Gio.Initable.init] or [method@Gio.AsyncInitable.init_async] before
using its methods or properties. Calling methods or accessing properties on a
GDBusConnection that has not completed initialization successfully is
considered to be invalid, and leads to undefined behaviour. In particular, if
initialization fails with a GError, the only valid thing you can do with
that GDBusConnection is to free it with [method@GObject.Object.unref]. ##
An example D-Bus server Here is an example for a D-Bus server:
gdbus-example-server.c
subtree: gdbus-example-subtree.c
file descriptors: gdbus-unix-fd-client.c
#GObject: gdbus-example-export.c
DBusConnection (res = null)
Finishes an operation started with g_dbus_connection_new().
res is a #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_new()..toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asObject ()
Wraps this handle as
Object.
A Object object.asAsyncInitable ()
Wraps this handle as
AsyncInitable.
A AsyncInitable object.asInitable ()
Wraps this handle as
Initable.
A Initable object.connectSignal (string Name, CallbackObj)
Connects one generated callback wrapper to a named signal.
Name is the signal name.CallbackObj is the generated callback wrapper to connect.The connected handler id.disconnectSignalHandler (int HandlerId)
Disconnects one retained signal handler id.
HandlerId is the signal handler id to disconnect.None.setOnClosed (callback Fn, UserData = null)
Emitted when the connection is closed. The cause of this event can be - If g_dbus_connection_close() is called. In this case
is set to %FALSE and @error is %NULL. - If the remote peer closes the connection. In this case @remote_peer_vanished is set to %TRUE and @error is set. - If the remote peer sends invalid or malformed data. In this case @remote_peer_vanished is set to %FALSE andis set. Upon receiving this signal, you should give up your reference to @connection. You are guaranteed that this signal is emitted only once.Fn is the Aussom callback.Fn is called with (DBusConnection Self, bool Remote_peer_vanished, Error Error).UserData is retained and passed through to the generated callback wrapper when provided.The connected handler id.getProperty (string Name)
Reads one generated property by name.
setProperty (string Name, Value)
Writes one generated property by name.
setExitonclose (bool Value)
A boolean specifying whether the process will be terminated (by calling
raise(SIGTERM)) if the connection is closed by the remote peer. Note that #GDBusConnection objects returned by g_bus_get_finish() and g_bus_get_sync() will (usually) have this property set to %TRUE.
Value is the new property value.None.call_finish (object res)
Finishes an operation started with g_dbus_connection_call().
res is a #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_call().call_sync (string bus_name, string object_path, string interface_name, string method_name, object parameters, object reply_type, string flags, int timeout_msec, object cancellable)
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 %G_IO_ERROR_CLOSED. If @cancellable is canceled, the operation will fail with %G_IO_ERROR_CANCELLED. If @parameters contains a value not compatible with the D-Bus protocol, the operation fails with %G_IO_ERROR_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 #GVariant 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.
bus_name is a unique or well-known bus name or %NULL if @connection is not a message bus connection.object_path is path of remote object.interface_name is D-Bus interface to invoke method on.method_name is the name of the method to invoke.parameters is a #GVariant tuple with parameters for the method or %NULL if not passing parameters.reply_type is the expected type of the reply, or %NULL.flags is flags from the #GDBusCallFlags enumeration.timeout_msec is the timeout in milliseconds, -1 to use the default timeout or %G_MAXINT for no timeout.cancellable is a #GCancellable or %NULL.close_finish (object res)
Finishes an operation started with g_dbus_connection_close().
res is a #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_close().close_sync (object cancellable)
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.
cancellable is a #GCancellable or %NULL.emit_signal (string destination_bus_name, string object_path, string interface_name, string signal_name, object parameters)
Emits 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 (%G_IO_ERROR_INVALID_ARGUMENT), or if @connection has been closed (%G_IO_ERROR_CLOSED).
destination_bus_name is the unique bus name for the destination for the signal or %NULL to emit to all listeners.object_path is path of remote object.interface_name is D-Bus interface to emit a signal on.signal_name is the name of the signal to emit.parameters is a #GVariant tuple with parameters for the signal or %NULL if not passing parameters.export_action_group (string object_path, object action_group)
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 [method@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.
object_path is a D-Bus object path.action_group is an action group.export_menu_model (string object_path, object menu)
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
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.object_path is a D-Bus object path.menu is a #GMenuModel.flush_finish (object res)
Finishes an operation started with g_dbus_connection_flush().
res is a #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_flush().flush_sync (object cancellable)
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.
cancellable is a #GCancellable or %NULL.get_capabilities ()
Gets the capabilities negotiated with the remote peer
get_exit_on_close ()
Gets whether the process is terminated when @connection is closed by the remote peer. See #GDBusConnection:exit-on-close for more details.
get_flags ()
Gets the flags used to construct this connection
get_guid ()
The GUID of the peer performing the role of server when authenticating. See #GDBusConnection:guid for more details.
get_peer_credentials ()
Gets the credentials of the authenticated peer. This will always return %NULL unless @connection acted as a server (e.g. %G_DBUS_CONNECTION_FLAGS_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.
get_stream ()
Gets the underlying stream used for IO. While the #GDBusConnection is active, it will interact with this stream from a worker thread, so it is not safe to interact with the stream directly.
get_unique_name ()
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.
is_closed ()
Gets whether @connection is closed.
register_object_with_closures (string object_path, object interface_info, object method_call_closure, object get_property_closure, object set_property_closure)
Version of g_dbus_connection_register_object() using closures instead of a #GDBusInterfaceVTable for easier binding in other languages. Note that the reference counting semantics of the function wrapped by
are the same as those of [callback@Gio.DBusInterfaceMethodCallFunc]: ownership of a reference to the [class@Gio.DBusMethodInvocation] is transferred to the function.object_path is The object path to register at..interface_info is Introspection data for the interface..method_call_closure is #GClosure for handling incoming method calls..get_property_closure is #GClosure for getting a property..set_property_closure is #GClosure for setting a property..register_object_with_closures2 (string object_path, object interface_info, object method_call_closure, object get_property_closure, object set_property_closure)
Version of [method@Gio.DBusConnection.register_object] using closures instead of a [type@Gio.DBusInterfaceVTable] for easier binding in other languages. In contrast to [method@Gio.DBusConnection.register_object] and [method@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 [callback@Gio.DBusInterfaceMethodCallFunc]. Ownership of a reference to the [class@Gio.DBusMethodInvocation] is not transferred to the function. Bindings must ensure that they add a reference to the [class@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.
object_path is The object path to register at..interface_info is Introspection data for the interface..method_call_closure is [type@GObject.Closure] for handling incoming method calls..get_property_closure is [type@GObject.Closure] for getting a property..set_property_closure is [type@GObject.Closure] for setting a property..remove_filter (int filter_id)
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 #GDestroyNotify to g_dbus_connection_add_filter(), which will be called when it is guaranteed that the data is no longer needed.
filter_id is an identifier obtained from g_dbus_connection_add_filter().None.send_message_with_reply_finish (object res)
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 #GDBusMessage object may be of type %G_DBUS_MESSAGE_TYPE_ERROR. Use g_dbus_message_to_gerror() to transcode this to a #GError. 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.
res is a #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_send_message_with_reply().set_exit_on_close (bool exit_on_close)
Sets whether the process should be terminated when @connection is closed by the remote peer. See #GDBusConnection: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.
exit_on_close is whether the process should be terminated whenis closed by the remote peer.None.signal_unsubscribe (int subscription_id)
Unsubscribes from signals. Note that there may still be D-Bus traffic to process (relating to this signal subscription) in the current thread-default #GMainContext after this function has returned. You should continue to iterate the #GMainContext until the #GDestroyNotify function passed to g_dbus_connection_signal_subscribe() is called, in order to avoid memory leaks through callbacks queued on the #GMainContext 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.
subscription_id is a subscription id obtained from g_dbus_connection_signal_subscribe().None.start_message_processing ()
If @connection was created with %G_DBUS_CONNECTION_FLAGS_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.
None.unexport_action_group (int export_id)
Reverses the effect of a previous call to [method@Gio.DBusConnection.export_action_group]. It is an error to call this function with an ID that wasn’t returned from [method@Gio.DBusConnection.export_action_group] or to call it with the same ID more than once.
export_id is the ID from [method@Gio.DBusConnection.export_action_group].None.unexport_menu_model (int export_id)
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.
export_id is the ID from g_dbus_connection_export_menu_model().None.unregister_object (int registration_id)
Unregisters an object.
registration_id is a registration id obtained from g_dbus_connection_register_object().unregister_subtree (int registration_id)
Unregisters a subtree.
registration_id is a subtree registration id obtained from g_dbus_connection_register_subtree().[690:14] static extends: object
Alternate constructors for DBusConnection. Usage:
DBusConnectionCtors.<name>(...). The primary constructor lives
directly on DBusConnection.
newForAddressFinish (object res)
Finishes an operation started with g_dbus_connection_new_for_address().
res is a #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_new().A new DBusConnection.newForAddressSync (string address, string flags, object observer, object cancellable)
Synchronously 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_sync() if you need to act as the server. In particular, @flags cannot contain the %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER, %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS or %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER flags. This is a synchronous failable constructor. See g_dbus_connection_new_for_address() for the asynchronous version. If
is not %NULL it may be used to control the authentication process.address is a D-Bus address.flags is flags describing how to make the connection.observer is a #GDBusAuthObserver or %NULL.cancellable is a #GCancellable or %NULL.A new DBusConnection.newSync (object stream, string guid, string flags, object observer, object cancellable)
Synchronously sets up a D-Bus connection for exchanging D-Bus messages with the end represented by @stream. If @stream is a #GSocketConnection, then the corresponding #GSocket 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. This is a synchronous failable constructor. See g_dbus_connection_new() for the asynchronous version.
stream is a #GIOStream.guid is the GUID to use if authenticating as a server or %NULL.flags is flags describing how to make the connection.observer is a #GDBusAuthObserver or %NULL.cancellable is a #GCancellable or %NULL.A new DBusConnection.[764:7] extends: object
Generated low-level callback wrapper for GIR callback closed.
DBusConnectionClosedCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (nativeSelf, remote_peer_vanished, error, nativeUserData)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.