[gnome-bluetooth/gnome-3-4] applet: Fix device_get_name() in the applet



commit 6fbda2b161a3e0ee428d87c73e1fa6656f635d92
Author: Sjoerd Simons <sjoerd luon net>
Date:   Sun Jul 1 12:28:20 2012 +0200

    applet: Fix device_get_name() in the applet
    
    g_dbus_proxy_call_sync returns a tuple with the results, not the results
    directly. As such we first need to get the dictionary out of the tuple
    before we can lookup the information in it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=674414

 applet/bluetooth-applet.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/applet/bluetooth-applet.c b/applet/bluetooth-applet.c
index 0eb2973..32d373e 100644
--- a/applet/bluetooth-applet.c
+++ b/applet/bluetooth-applet.c
@@ -313,6 +313,7 @@ device_get_name (GDBusProxy *proxy, char **long_name)
 {
 	GVariant *value;
 	GVariant *result;
+	GVariant *dict;
 	char *alias, *address;
 
 	g_return_val_if_fail (long_name != NULL, NULL);
@@ -322,14 +323,17 @@ device_get_name (GDBusProxy *proxy, char **long_name)
 	if (result == NULL)
 		return NULL;
 
-	value = g_variant_lookup_value (result, "Address", G_VARIANT_TYPE_STRING);
+	/* Retrieve the dictionary */
+	dict  = g_variant_get_child_value (result, 0);
+
+	value = g_variant_lookup_value (dict, "Address", G_VARIANT_TYPE_STRING);
 	if (value == NULL) {
 		g_variant_unref (result);
 		return NULL;
 	}
 	address = g_strdup (g_variant_get_string (value, NULL));
 
-	value = g_variant_lookup_value (result, "Name", G_VARIANT_TYPE_STRING);
+	value = g_variant_lookup_value (dict, "Name", G_VARIANT_TYPE_STRING);
 	alias = value ? g_strdup (g_variant_get_string (value, NULL)) : g_strdup (address);
 
 	g_variant_unref (result);



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