DBusGConnection

## DBusGConnection DBusGConnection — DBus Connection |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

                        DBusGConnection;
    DBusGConnection*    dbus_g_bus_get                      (DBusBusType type,
                                                             GError **error);
    void                dbus_g_thread_init                  (void);
    DBusGConnection*    dbus_g_connection_open              (const gchar *address,
                                                             GError **error);
    DBusGConnection*    dbus_g_connection_ref               (DBusGConnection *connection);
    void                dbus_g_connection_unref             (DBusGConnection *connection);
    void                dbus_g_connection_flush             (DBusGConnection *connection);
    DBusConnection*     dbus_g_connection_get_connection    (DBusGConnection *gconnection);
    void                dbus_g_connection_register_g_object (DBusGConnection *connection,
                                                             const char *at_path,
                                                             GObject *object);
    GObject*            dbus_g_connection_lookup_g_object   (DBusGConnection *connection,
                                                             const char *at_path);

## Description

A DBusGConnection is a boxed type abstracting a DBusConnection.

## Details

### DBusGConnection

    typedef struct _DBusGConnection DBusGConnection;

### dbus_g_bus_get ()

    DBusGConnection*    dbus_g_bus_get                      (DBusBusType type,
                                                             GError **error);

Returns a connection to the given bus. The connection is a global variable shared with other callers of this function.

(Internally, calls `dbus_bus_get()` then calls `dbus_connection_setup_with_g_main()` on the result.)

`type` : | bus type
`error` : | address where an error can be returned.
Returns : | a DBusConnection

### dbus_g_thread_init ()

    void                dbus_g_thread_init                  (void);

Initializes the D-BUS thread system. This function may only be called once and must be called prior to calling any other function in the D-BUS API.

### dbus_g_connection_open ()

    DBusGConnection*    dbus_g_connection_open              (const gchar *address,
                                                             GError **error);

Returns a connection to the given address.

(Internally, calls `dbus_connection_open()` then calls `dbus_connection_setup_with_g_main()` on the result.)

`address` : | address of the connection to open
`error` : | address where an error can be returned.
Returns : | a DBusConnection

### dbus_g_connection_ref ()

    DBusGConnection*    dbus_g_connection_ref               (DBusGConnection *connection);

Increment refcount on a DBusGConnection

`connection` : |
Returns : | the connection that was ref'd

### dbus_g_connection_unref ()

    void                dbus_g_connection_unref             (DBusGConnection *connection);

Decrement refcount on a DBusGConnection

`connection` : |

### dbus_g_connection_flush ()

    void                dbus_g_connection_flush             (DBusGConnection *connection);

Blocks until outgoing calls and signal emissions have been sent.

`connection` : | the DBusGConnection to flush

### dbus_g_connection_get_connection ()

    DBusConnection*     dbus_g_connection_get_connection    (DBusGConnection *gconnection);

Get the DBusConnection corresponding to this DBusGConnection. The return value does not have its refcount incremented.

`gconnection` : | a DBusGConnection
Returns : | DBusConnection

### dbus_g_connection_register_g_object ()

    void                dbus_g_connection_register_g_object (DBusGConnection *connection,
                                                             const char *at_path,
                                                             GObject *object);

Registers a GObject at the given path. Properties, methods, and signals of the object can then be accessed remotely. Methods are only available if method introspection data has been added to the object's class with `g_object_class_install_info()`.

The registration will be cancelled if either the DBusConnection or the GObject gets finalized.

`connection` : | the D-BUS connection
`at_path` : | the path where the object will live (the object's name)
`object` : | the object

### dbus_g_connection_lookup_g_object ()

    GObject*            dbus_g_connection_lookup_g_object   (DBusGConnection *connection,
                                                             const char *at_path);

FIXME

`connection` : | a DBusGConnection
`at_path` : | path
Returns : | the object at path `at_path`

## See Also

DBusConnection