Gio.DBusConnection.new
Description: Reference for Gio.DBusConnection.new

### Function

# Gio DBusConnectionnew

since: 2.26

#### Declaration

    void
    g_dbus_connection_new (
      GIOStream* stream,
      const gchar* guid,
      GDBusConnectionFlags flags,
      GDBusAuthObserver* observer,
      GCancellable* cancellable,
      GAsyncReadyCallback callback,
      gpointer user_data
    )

#### Description

Asynchronously 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.

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.

Available since: 2.26

#### Parameters

`stream`

  Type: `GIOStream`

  A `GIOStream`.

  The data is owned by the caller of the function.

`guid`

  Type: `const gchar*`

  The GUID to use if authenticating as a server or `NULL`.

  The argument can be `NULL`.
  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.

`callback`

  Type: `GAsyncReadyCallback`

  A `GAsyncReadyCallback` to call when the request is satisfied.

`user_data`

  Type: `gpointer`

  The data to pass to `callback`.

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