[gnome-control-center] Try to fix bluetooth handling



commit 1d68105e0d8bcd579f1d51e93e169c545f0c696e
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jan 4 23:12:06 2013 -0500

    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

 panels/power/cc-power-panel.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index 716a20e..df3c30f 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]