Commit 2573e72f authored by Benjamin Otte's avatar Benjamin Otte

styleproperties: Add _gtk_style_properties_peek_property()

parent 38e1c0a2
......@@ -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
......
......@@ -39,6 +39,9 @@ void _gtk_style_properties_get_valist (GtkStylePropertie
GtkStylePropertyContext *context,
va_list args);
const GValue * _gtk_style_properties_peek_property (GtkStyleProperties *props,
const GtkStyleProperty *property,
GtkStateFlags state);
void _gtk_style_properties_set_property_by_property (GtkStyleProperties *props,
const GtkStyleProperty *property,
GtkStateFlags state,
......
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