summaryrefslogtreecommitdiff
path: root/gtk/gtkcssvalue.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2012-03-08 16:49:13 +0100
committerAlexander Larsson <alexl@redhat.com>2012-03-08 16:49:13 +0100
commitec65270c2cb2c00e9042fe7609b77186986c58d7 (patch)
tree1c990fa9161c84ff864092d0d60e57034f3ff7ac /gtk/gtkcssvalue.c
parent1ceed037b24c78b48a5319f465e4c489eb373413 (diff)
downloadgtk+-ec65270c2cb2c00e9042fe7609b77186986c58d7.tar.gz
Add some more types to GtkCssValue
Seems these types were used in the parser tests, so we need to handle them.
Diffstat (limited to 'gtk/gtkcssvalue.c')
-rw-r--r--gtk/gtkcssvalue.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gtk/gtkcssvalue.c b/gtk/gtkcssvalue.c
index 367818116e..56c4eac1e3 100644
--- a/gtk/gtkcssvalue.c
+++ b/gtk/gtkcssvalue.c
@@ -32,7 +32,9 @@ struct _GtkCssValue
union {
gpointer ptr;
gint gint;
+ guint guint;
double dbl;
+ float flt;
} u;
};
@@ -76,14 +78,20 @@ _gtk_css_value_new_from_gvalue (const GValue *g_value)
value->u.ptr = g_value_dup_boxed (g_value);
else if (g_type_is_a (type, G_TYPE_INT))
value->u.gint = g_value_get_int (g_value);
+ else if (g_type_is_a (type, G_TYPE_UINT))
+ value->u.guint = g_value_get_uint (g_value);
else if (g_type_is_a (type, G_TYPE_BOOLEAN))
value->u.gint = g_value_get_boolean (g_value);
else if (g_type_is_a (type, G_TYPE_ENUM))
value->u.gint = g_value_get_enum (g_value);
+ else if (g_type_is_a (type, G_TYPE_FLAGS))
+ value->u.guint = g_value_get_flags (g_value);
else if (g_type_is_a (type, G_TYPE_STRING))
value->u.ptr = g_value_dup_string (g_value);
else if (g_type_is_a (type, G_TYPE_DOUBLE))
value->u.dbl = g_value_get_double (g_value);
+ else if (g_type_is_a (type, G_TYPE_FLOAT))
+ value->u.flt = g_value_get_float (g_value);
else
g_assert_not_reached ();
}
@@ -122,14 +130,20 @@ _gtk_css_value_new_take_gvalue (GValue *g_value)
value->u.ptr = g_value_get_boxed (g_value);
else if (g_type_is_a (type, G_TYPE_INT))
value->u.gint = g_value_get_int (g_value);
+ else if (g_type_is_a (type, G_TYPE_UINT))
+ value->u.guint = g_value_get_uint (g_value);
else if (g_type_is_a (type, G_TYPE_BOOLEAN))
value->u.gint = g_value_get_boolean (g_value);
else if (g_type_is_a (type, G_TYPE_ENUM))
value->u.gint = g_value_get_enum (g_value);
+ else if (g_type_is_a (type, G_TYPE_FLAGS))
+ value->u.guint = g_value_get_flags (g_value);
else if (g_type_is_a (type, G_TYPE_STRING))
value->u.ptr = g_value_dup_string (g_value);
else if (g_type_is_a (type, G_TYPE_DOUBLE))
value->u.dbl = g_value_get_double (g_value);
+ else if (g_type_is_a (type, G_TYPE_FLOAT))
+ value->u.flt = g_value_get_float (g_value);
else
g_assert_not_reached ();
}
@@ -403,14 +417,20 @@ fill_gvalue (GtkCssValue *value,
g_value_set_boxed (g_value, value->u.ptr);
else if (g_type_is_a (type, G_TYPE_INT))
g_value_set_int (g_value, value->u.gint);
+ else if (g_type_is_a (type, G_TYPE_UINT))
+ g_value_set_uint (g_value, value->u.guint);
else if (g_type_is_a (type, G_TYPE_BOOLEAN))
g_value_set_boolean (g_value, value->u.gint);
else if (g_type_is_a (type, G_TYPE_ENUM))
g_value_set_enum (g_value, value->u.gint);
+ else if (g_type_is_a (type, G_TYPE_FLAGS))
+ g_value_set_flags (g_value, value->u.guint);
else if (g_type_is_a (type, G_TYPE_STRING))
g_value_set_string (g_value, value->u.ptr);
else if (g_type_is_a (type, G_TYPE_DOUBLE))
g_value_set_double (g_value, value->u.dbl);
+ else if (g_type_is_a (type, G_TYPE_FLOAT))
+ g_value_set_float (g_value, value->u.flt);
else
g_assert_not_reached ();
}