diff options
author | Benjamin Otte <otte@redhat.com> | 2011-12-31 01:05:50 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-01-09 18:37:51 +0100 |
commit | 2573e72f496fe252c452ca9bdff03b70c6926d2a (patch) | |
tree | d935926877f87ce7699d31d0f37ed12f645fc5cf /gtk/gtkstyleproperties.c | |
parent | 38e1c0a2d631f133ee0f010a4d03131821898cef (diff) | |
download | gtk+-2573e72f496fe252c452ca9bdff03b70c6926d2a.tar.gz |
styleproperties: Add _gtk_style_properties_peek_property()
Diffstat (limited to 'gtk/gtkstyleproperties.c')
-rw-r--r-- | gtk/gtkstyleproperties.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/gtk/gtkstyleproperties.c b/gtk/gtkstyleproperties.c index 26a966563b..08ed39bcf9 100644 --- a/gtk/gtkstyleproperties.c +++ b/gtk/gtkstyleproperties.c @@ -717,6 +717,25 @@ gtk_style_properties_set (GtkStyleProperties *props, va_end (args); } +const GValue * +_gtk_style_properties_peek_property (GtkStyleProperties *props, + const GtkStyleProperty *property, + GtkStateFlags state) +{ + GtkStylePropertiesPrivate *priv; + PropertyData *prop; + + g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE); + g_return_val_if_fail (property != NULL, FALSE); + + priv = props->priv; + prop = g_hash_table_lookup (priv->properties, property); + if (prop == NULL) + return NULL; + + return property_data_match_state (prop, state); +} + gboolean _gtk_style_properties_get_property (GtkStyleProperties *props, const gchar *property, @@ -724,10 +743,8 @@ _gtk_style_properties_get_property (GtkStyleProperties *props, GtkStylePropertyContext *context, GValue *value) { - GtkStylePropertiesPrivate *priv; const GtkStyleProperty *node; - PropertyData *prop; - GValue *val = NULL; + const GValue *val; g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE); g_return_val_if_fail (property != NULL, FALSE); @@ -740,21 +757,11 @@ _gtk_style_properties_get_property (GtkStyleProperties *props, return FALSE; } - priv = props->priv; - prop = g_hash_table_lookup (priv->properties, node); - - val = NULL; - - if (prop) - { - /* NB: Will return NULL for shorthands */ - val = property_data_match_state (prop, state); - } - + val = _gtk_style_properties_peek_property (props, node, state); g_value_init (value, node->pspec->value_type); if (val) - _gtk_style_property_resolve (node, props, state, context, val, value); + _gtk_style_property_resolve (node, props, state, context, (GValue *) val, value); else if (_gtk_style_property_is_shorthand (node)) _gtk_style_property_pack (node, props, state, context, value); else |