diff options
author | Benjamin Otte <otte@redhat.com> | 2011-12-31 19:59:16 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-01-09 18:37:53 +0100 |
commit | 341a738dc6ac8e79472c27db1a5ad0cbf0450b41 (patch) | |
tree | ed5b808f1aab6d57ad1eb69f4f048076d7c78aba /gtk/gtkstyleproperty.c | |
parent | d9c5d37e5611c7cfcffad18ed750a774f834587f (diff) | |
download | gtk+-341a738dc6ac8e79472c27db1a5ad0cbf0450b41.tar.gz |
styleproperty: Move member variables
These variables are only relevant for style properties, but not for
shorthands, so put them there.
Diffstat (limited to 'gtk/gtkstyleproperty.c')
-rw-r--r-- | gtk/gtkstyleproperty.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c index 63badd9951..3543952fa9 100644 --- a/gtk/gtkstyleproperty.c +++ b/gtk/gtkstyleproperty.c @@ -1801,7 +1801,7 @@ _gtk_style_property_default_value (GtkStyleProperty *property, GtkStateFlags state, GValue *value) { - g_value_copy (&property->initial_value, value); + g_value_copy (_gtk_css_style_property_get_initial_value (GTK_CSS_STYLE_PROPERTY (property)), value); } static gboolean @@ -2495,41 +2495,42 @@ _gtk_style_property_register (GParamSpec *pspec, const GValue * initial_value) { GtkStyleProperty *node; + GValue initial_fallback = { 0, }; - node = g_object_new (GTK_TYPE_CSS_STYLE_PROPERTY, - "name", pspec->name, - "value-type", pspec->value_type, - NULL); - node->flags = flags; - node->pspec = pspec; - node->property_parse_func = property_parse_func; - node->parse_func = parse_func; - node->print_func = print_func; - - /* initialize the initial value */ - if (initial_value) - { - g_value_init (&node->initial_value, G_VALUE_TYPE (initial_value)); - g_value_copy (initial_value, &node->initial_value); - } - else + if (initial_value == NULL) { - g_value_init (&node->initial_value, pspec->value_type); + g_value_init (&initial_fallback, pspec->value_type); if (pspec->value_type == GTK_TYPE_THEMING_ENGINE) - g_value_set_object (&node->initial_value, gtk_theming_engine_load (NULL)); + g_value_set_object (&initial_fallback, gtk_theming_engine_load (NULL)); else if (pspec->value_type == PANGO_TYPE_FONT_DESCRIPTION) - g_value_take_boxed (&node->initial_value, pango_font_description_from_string ("Sans 10")); + g_value_take_boxed (&initial_fallback, pango_font_description_from_string ("Sans 10")); else if (pspec->value_type == GDK_TYPE_RGBA) { GdkRGBA color; gdk_rgba_parse (&color, "pink"); - g_value_set_boxed (&node->initial_value, &color); + g_value_set_boxed (&initial_fallback, &color); } else if (pspec->value_type == GTK_TYPE_BORDER) { - g_value_take_boxed (&node->initial_value, gtk_border_new ()); + g_value_take_boxed (&initial_fallback, gtk_border_new ()); } else - g_param_value_set_default (pspec, &node->initial_value); + g_param_value_set_default (pspec, &initial_fallback); + + initial_value = &initial_fallback; } + + node = g_object_new (GTK_TYPE_CSS_STYLE_PROPERTY, + "inherit", (flags & GTK_STYLE_PROPERTY_INHERIT) ? TRUE : FALSE, + "initial-value", initial_value, + "name", pspec->name, + "value-type", pspec->value_type, + NULL); + node->pspec = pspec; + node->property_parse_func = property_parse_func; + node->parse_func = parse_func; + node->print_func = print_func; + + if (G_IS_VALUE (&initial_fallback)) + g_value_unset (&initial_fallback); } |