diff options
author | Benjamin Otte <otte@redhat.com> | 2012-03-26 17:24:02 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-04-17 08:59:11 +0200 |
commit | 9b7640b898c61eb4ff49140880f2bb2b70eb9f0b (patch) | |
tree | 8549d2c0d73a7a70859210283ade4802e4d2f41e /gtk/gtkcsscustomproperty.c | |
parent | 718ceaec450947b77a52318647a972591d183b5c (diff) | |
download | gtk+-9b7640b898c61eb4ff49140880f2bb2b70eb9f0b.tar.gz |
styleproperty: Make _gtk_style_property_parse_value() return a CssValue
Also split out initial/inherit handling into a custom GtkCssValue class.
Diffstat (limited to 'gtk/gtkcsscustomproperty.c')
-rw-r--r-- | gtk/gtkcsscustomproperty.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/gtk/gtkcsscustomproperty.c b/gtk/gtkcsscustomproperty.c index 4f4e15f4b7..28355dccfa 100644 --- a/gtk/gtkcsscustomproperty.c +++ b/gtk/gtkcsscustomproperty.c @@ -28,13 +28,14 @@ G_DEFINE_TYPE (GtkCssCustomProperty, _gtk_css_custom_property, GTK_TYPE_CSS_STYLE_PROPERTY) -static gboolean +static GtkCssValue * gtk_css_custom_property_parse_value (GtkStyleProperty *property, - GValue *value, GtkCssParser *parser, GFile *base) { GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (property); + GValue value = G_VALUE_INIT; + GtkCssValue *result; gboolean success; if (custom->property_parse_func) @@ -42,12 +43,12 @@ gtk_css_custom_property_parse_value (GtkStyleProperty *property, GError *error = NULL; char *value_str; - g_value_init (value, _gtk_style_property_get_value_type (property)); + g_value_init (&value, _gtk_style_property_get_value_type (property)); value_str = _gtk_css_parser_read_value (parser); if (value_str != NULL) { - success = (* custom->property_parse_func) (value_str, value, &error); + success = (* custom->property_parse_func) (value_str, &value, &error); g_free (value_str); } else @@ -56,15 +57,21 @@ gtk_css_custom_property_parse_value (GtkStyleProperty *property, else { GtkCssStyleProperty *style = GTK_CSS_STYLE_PROPERTY (property); - g_value_init (value, _gtk_css_style_property_get_specified_type (style)); + g_value_init (&value, _gtk_css_style_property_get_specified_type (style)); - success = _gtk_css_style_parse_value (value, parser, base); + success = _gtk_css_style_parse_value (&value, parser, base); } if (!success) - g_value_unset (value); + { + g_value_unset (&value); + return NULL; + } - return success; + result = _gtk_css_value_new_from_gvalue (&value); + g_value_unset (&value); + + return result; } static void |