public DBusConnection get_sync (BusType bus_type, Cancellable? cancellable = null) throws IOError

Synchronously connects to the message bus specified by bus_type.

Note that the returned object may shared with other callers, e.g. if two separate parts of a process calls this function with the same bus_type, they will share the same object.

This is a synchronous failable function. See @get and @get.end for the asynchronous version.

The returned object is a singleton, that is, shared with other callers of @get and get_sync for bus_type. In the event that you need a private message bus connection, use get_address_sync and new_for_address with G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT and G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION flags.

Note that the returned DBusConnection object will (usually) have the exit_on_close property set to true .



a BusType


a Cancellable or null


a DBusConnection or null if throws is set. Free with unref.

Namespace: GLib.Bus
Package: gio-2.0