diff options
author | Iain Lane <iainl@gnome.org> | 2018-08-13 13:52:41 +0100 |
---|---|---|
committer | Iain Lane <iainl@gnome.org> | 2018-08-13 13:52:41 +0100 |
commit | 08f32c656058e6c487465db81a08d22212d2671f (patch) | |
tree | 581deb974e3993c5933ec55d5b0927e7b8c87d34 | |
parent | ed369332323ff1e64006dc68f2b325df3d42bd08 (diff) | |
download | gtk+-08f32c656058e6c487465db81a08d22212d2671f.tar.gz |
colorpickershell: Unpack the tuple returned from PickColor()fix-shell-colorpicker
When calling PickColor on org.gnome.Shell, we get back an "a{sv}", which
GDBus provides to us as "(a{sv})".
At the minute we're not unpacking this tuple, and so picking fails with
messages like:
GLib-CRITICAL **: 13:38:19.439: g_variant_lookup_value: assertion 'g_variant_is_of_type (dictionary, G_VARIANT_TYPE ("a{s*}")) || g_variant_is_of_type (dictionary, G_VARIANT_TYPE ("a{o*}"))' failed
Gtk-WARNING **: 13:38:19.439: Picking color failed: No color received
Let's unpack it.
-rw-r--r-- | gtk/gtkcolorpickershell.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gtk/gtkcolorpickershell.c b/gtk/gtkcolorpickershell.c index d465e0ab5e..6dfa299c50 100644 --- a/gtk/gtkcolorpickershell.c +++ b/gtk/gtkcolorpickershell.c @@ -119,7 +119,7 @@ color_picked (GObject *source, { GtkColorPickerShell *picker = GTK_COLOR_PICKER_SHELL (data); GError *error = NULL; - GVariant *ret; + GVariant *ret, *dict; ret = g_dbus_proxy_call_finish (picker->shell_proxy, res, &error); @@ -131,12 +131,15 @@ color_picked (GObject *source, { GdkRGBA c; + g_variant_get (ret, "(@a{sv})", &dict); + c.alpha = 1; - if (!g_variant_lookup (ret, "color", "(ddd)", &c.red, &c.green, &c.blue)) + if (!g_variant_lookup (dict, "color", "(ddd)", &c.red, &c.green, &c.blue)) g_task_return_new_error (picker->task, G_IO_ERROR, G_IO_ERROR_FAILED, "No color received"); else g_task_return_pointer (picker->task, gdk_rgba_copy (&c), (GDestroyNotify)gdk_rgba_free); + g_variant_unref (dict); g_variant_unref (ret); } |