-GDBusConnection *g_bus_get_private_session_conn(void)
-{
- GError *error = NULL;
- char *address;
- GDBusConnection *private_gconn = NULL;
-
- address = g_dbus_address_get_for_bus_sync(G_BUS_TYPE_SESSION, NULL, &error);
- if (address == NULL) {
- if (error) {
- BT_ERR("Failed to get bus address: %s", error->message);
- g_clear_error(&error);
- }
- return NULL;
- }
-
- private_gconn = g_dbus_connection_new_for_address_sync(address,
- G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT |
- G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION,
- NULL, /* GDBusAuthObserver */
- NULL,
- &error);
- if (!private_gconn) {
- if (error) {
- BT_ERR("Unable to connect to dbus: %s", error->message);
- g_clear_error(&error);
- }
- return NULL;
- }
-
- return private_gconn;
-}
-