summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd@luon.net>2012-07-01 12:28:20 +0200
committerBastien Nocera <hadess@hadess.net>2012-07-02 11:21:54 +0100
commit6fbda2b161a3e0ee428d87c73e1fa6656f635d92 (patch)
treecf26fe88522804a68384beca91554df008126434
parent749a81425d86f8fb0b02efa30b82a3fa79e67374 (diff)
downloadgnome-bluetooth-6fbda2b161a3e0ee428d87c73e1fa6656f635d92.tar.gz
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
-rw-r--r--applet/bluetooth-applet.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/applet/bluetooth-applet.c b/applet/bluetooth-applet.c
index 0eb29734..32d373e5 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);