[gnome-bluetooth] lib: Don't use deprecated ListAdapters()



commit 84834da7411e675b3571066a6966d5ed462060a9
Author: Bastien Nocera <hadess hadess net>
Date:   Sat Jun 16 23:17:56 2012 +0200

    lib: Don't use deprecated ListAdapters()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678228

 lib/bluetooth-client.c   |   20 ++++++++++++++------
 lib/bluetooth-client.xml |    4 ++--
 2 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index dd4ff15..5c40a7c 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -949,7 +949,8 @@ bluez_appeared_cb (GDBusConnection *connection,
 		   BluetoothClient *client)
 {
 	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
-	char **array = NULL;
+	GVariant *variant;
+	const char **array;
 	gchar *default_path = NULL;
 
 	priv->manager = manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
@@ -962,13 +963,21 @@ bluez_appeared_cb (GDBusConnection *connection,
 	g_signal_connect (G_OBJECT (priv->manager), "g-signal",
 			  G_CALLBACK (manager_g_signal), client);
 
-	if (manager_call_list_adapters_sync (priv->manager, &array, NULL, NULL)) {
+	manager_call_get_properties_sync (MANAGER (priv->manager), &variant, NULL, NULL);
+	if (variant != NULL) {
+		GVariant *v;
 		guint i;
 
-		for (i = 0; array[i] != NULL; i++)
-			adapter_added(priv->manager, array[i], client);
+		v = g_variant_lookup_value (variant, "Adapters", G_VARIANT_TYPE_OBJECT_PATH_ARRAY);
+		array = v ? g_variant_get_objv (v, NULL) : NULL;
 
-		g_strfreev (array);
+		if (array != NULL) {
+			for (i = 0; array[i] != NULL; i++)
+				adapter_added(priv->manager, array[i], client);
+			g_free (array);
+		}
+
+		g_object_unref (variant);
 	}
 
 	manager_call_default_adapter_sync (priv->manager, &default_path, NULL, NULL);
@@ -976,7 +985,6 @@ bluez_appeared_cb (GDBusConnection *connection,
 		default_adapter_changed (priv->manager, default_path, client);
 		g_free(default_path);
 	}
-
 }
 
 static void
diff --git a/lib/bluetooth-client.xml b/lib/bluetooth-client.xml
index 8bbebc7..32d183e 100644
--- a/lib/bluetooth-client.xml
+++ b/lib/bluetooth-client.xml
@@ -6,8 +6,8 @@
       <arg type="o" direction="out"/>
     </method>
 
-    <method name="ListAdapters">
-      <arg type="ao" direction="out"/>
+    <method name="GetProperties">
+      <arg type="a{sv}" direction="out"/>
     </method>
 
     <signal name="AdapterAdded">



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