diff options
author | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2018-07-30 20:53:45 -0300 |
---|---|---|
committer | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2018-07-30 20:56:18 -0300 |
commit | 2c55455387d4a3ed6aa268d56572bbac2d563148 (patch) | |
tree | 733603544ab343961053e5f97331b1cb73b854c1 | |
parent | 4c3cbe3591b295fe9974a0a2fcf7e80e95377072 (diff) | |
download | glade-2c55455387d4a3ed6aa268d56572bbac2d563148.tar.gz |
GladeEditorProperty, GladePropertyClass, GladeWidgetAdaptor:
Add GVariant property type support
Closes issue #303
-rw-r--r-- | gladeui/glade-editor-property.c | 3 | ||||
-rw-r--r-- | gladeui/glade-property-class.c | 9 | ||||
-rw-r--r-- | gladeui/glade-widget-adaptor.c | 3 |
3 files changed, 13 insertions, 2 deletions
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c index 0162c04e..c49a07bd 100644 --- a/gladeui/glade-editor-property.c +++ b/gladeui/glade-editor-property.c @@ -1919,7 +1919,8 @@ glade_eprop_text_changed_common (GladeEditorProperty *eprop, if (pspec->value_type == G_TYPE_STRV || pspec->value_type == value_array_type || pspec->value_type == GDK_TYPE_PIXBUF || - pspec->value_type == G_TYPE_FILE) + pspec->value_type == G_TYPE_FILE || + pspec->value_type == G_TYPE_VARIANT) { GladeWidget *gwidget = glade_property_get_widget (eprop->priv->property); diff --git a/gladeui/glade-property-class.c b/gladeui/glade-property-class.c index 849b47b3..aed3960f 100644 --- a/gladeui/glade-property-class.c +++ b/gladeui/glade-property-class.c @@ -581,6 +581,13 @@ glade_property_class_make_string_from_gvalue (GladePropertyClass * else if (G_IS_PARAM_SPEC_BOOLEAN (property_class->pspec)) string = g_strdup_printf ("%s", g_value_get_boolean (value) ? GLADE_TAG_TRUE : GLADE_TAG_FALSE); + else if (G_IS_PARAM_SPEC_VARIANT (property_class->pspec)) + { + GVariant *variant; + + if ((variant = g_value_get_variant (value))) + string = g_variant_print (variant, TRUE); + } else if (G_IS_PARAM_SPEC_OBJECT (property_class->pspec)) { object = g_value_get_object (value); @@ -878,6 +885,8 @@ glade_property_class_make_gvalue_from_string (GladePropertyClass *property_class g_value_take_boxed (value, strv); } } + else if (G_IS_PARAM_SPEC_VARIANT (property_class->pspec)) + g_value_take_variant (value, g_variant_parse (NULL, string, NULL, NULL, NULL)); else if (G_IS_PARAM_SPEC_INT (property_class->pspec)) g_value_set_int (value, g_ascii_strtoll (string, NULL, 10)); else if (G_IS_PARAM_SPEC_UINT (property_class->pspec)) diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c index dc44f9b7..f74ac001 100644 --- a/gladeui/glade-widget-adaptor.c +++ b/gladeui/glade-widget-adaptor.c @@ -1247,7 +1247,8 @@ glade_widget_adaptor_get_eprop_type (GParamSpec *pspec) else if (pspec->value_type == G_TYPE_STRV) type = GLADE_TYPE_EPROP_TEXT; } - else if (G_IS_PARAM_SPEC_STRING (pspec)) + else if (G_IS_PARAM_SPEC_STRING (pspec) || + G_IS_PARAM_SPEC_VARIANT (pspec)) type = GLADE_TYPE_EPROP_TEXT; else if (G_IS_PARAM_SPEC_BOOLEAN (pspec)) type = GLADE_TYPE_EPROP_BOOL; |