Commit 2c554553 authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte

GladeEditorProperty, GladePropertyClass, GladeWidgetAdaptor:

Add GVariant property type support

Closes issue #303
parent 4c3cbe35
......@@ -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);
......
......@@ -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))
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment