Free with [gobject.object.ObjectWrap.unref].
busGetSync
gio.dbus_connection.DBusConnection busGetSync(gio.types.BusType busType, gio.cancellable.Cancellable cancellable = null)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 [gio.global.busGet] and [gio.global.busGetFinish] for the asynchronous version.
The returned object is a singleton, that is, shared with other callers of [gio.global.busGet] and [gio.global.busGetSync] for bus_type. In the event that you need a private message bus connection, use [gio.global.dbusAddressGetForBusSync] and [gio.dbus_connection.DBusConnection.newForAddress] with G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT and G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION flags.
Note that the returned #GDBusConnection object will (usually) have the #GDBusConnection:exit-on-close property set to true.
Parameters
busType | a #GBusType |
cancellable | a #GCancellable or null |