[gnome-control-center] shell: Fix warnings for the GVariant-encoded parameters
- From: Emanuele Aina <emaaa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] shell: Fix warnings for the GVariant-encoded parameters
- Date: Fri, 17 May 2013 16:29:24 +0000 (UTC)
commit 4e42a3613341cdbeb7954da53d15de1aa155d0db
Author: Emanuele Aina <emanuele aina collabora com>
Date: Fri May 17 16:21:33 2013 +0100
shell: Fix warnings for the GVariant-encoded parameters
This fixes a spurious warning about ignored parameters due to the
variant not being NULL since it now contains the flags dictionary.
https://bugzilla.gnome.org/show_bug.cgi?id=700530
shell/cc-panel.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/shell/cc-panel.c b/shell/cc-panel.c
index 90b15cb..1ce6716 100644
--- a/shell/cc-panel.c
+++ b/shell/cc-panel.c
@@ -83,9 +83,29 @@ cc_panel_set_property (GObject *object,
case PROP_PARAMETERS:
{
GVariant *parameters = g_value_get_variant (value);
+ GVariant *v;
+ gsize n_parameters;
- if (parameters)
+ if (parameters == NULL)
+ return;
+
+ n_parameters = g_variant_n_children (parameters);
+ if (n_parameters == 0)
+ return;
+
+ g_variant_get_child (parameters, 0, "v", &v);
+
+ if (!g_variant_is_of_type (v, G_VARIANT_TYPE_DICTIONARY))
+ g_warning ("Wrong type for the first argument GVariant, expected 'a{sv}' but got '%s'",
+ (gchar *)g_variant_get_type (v));
+ else if (g_variant_n_children (v) > 0)
+ g_warning ("Ignoring additional flags");
+
+ g_variant_unref (v);
+
+ if (n_parameters > 1)
g_warning ("Ignoring additional parameters");
+
break;
}
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]