Constructor

GioDBusConnectionnew_for_address_sync

since: 2.26

Declaration [src]

GDBusConnection*
g_dbus_connection_new_for_address_sync (
  const gchar* address,
  GDBusConnectionFlags flags,
  GDBusAuthObserver* observer,
  GCancellable* cancellable,
  GError** error
)

Description [src]

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 observer is not NULL it may be used to control the authentication process.

Available since: 2.26

Parameters

address

Type: const gchar*

A D-Bus address.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
flags

Type: GDBusConnectionFlags

Flags describing how to make the connection.

observer

Type: GDBusAuthObserver

A GDBusAuthObserver or NULL.

The argument can be NULL.
The data is owned by the caller of the function.
cancellable

Type: GCancellable

A GCancellable or NULL.

The argument can be NULL.
The data is owned by the caller of the function.
error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will be left initialized to NULL by the constructor if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: GDBusConnection

A GDBusConnection or NULL if error is set. Free with g_object_unref().

The caller of the function takes ownership of the data, and is responsible for freeing it.