Try to fix bluetooth handling
We need to ensure that bluetoothd is activated, otherwise the default adapter might not be present. Unfortunately, this is not enough to make the switch actually have the same effect as the shell menuitem. https://bugzilla.gnome.org/show_bug.cgi?id=691151
This commit is contained in:
parent
678bddbdad
commit
1d68105e0d
1 changed files with 18 additions and 4 deletions
|
@ -1070,22 +1070,36 @@ static void
|
|||
bt_set_powered (BluetoothClient *client,
|
||||
gboolean powered)
|
||||
{
|
||||
gchar *adapter_path;
|
||||
GVariant *ret;
|
||||
const gchar *adapter_path;
|
||||
GDBusConnection *bus;
|
||||
|
||||
g_object_get (client, "default-adapter", &adapter_path, NULL);
|
||||
|
||||
bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
|
||||
|
||||
ret = g_dbus_connection_call_sync (bus,
|
||||
"org.bluez",
|
||||
"/",
|
||||
"org.bluez.Manager",
|
||||
"DefaultAdapter",
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
G_MAXINT,
|
||||
NULL, NULL);
|
||||
g_variant_get (ret, "(&o)", &adapter_path);
|
||||
|
||||
g_dbus_connection_call (bus,
|
||||
"org.bluez",
|
||||
adapter_path,
|
||||
"org.freedesktop.Properties",
|
||||
"SetProperty",
|
||||
g_variant_new ("sv", "Powered", g_variant_new_boolean (powered)),
|
||||
g_variant_new ("(sv)", "Powered", g_variant_new_boolean (powered)),
|
||||
NULL,
|
||||
0,
|
||||
G_MAXINT,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
g_variant_unref (ret);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue