summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2011-05-21 21:19:57 +0200
committerBenjamin Otte <otte@redhat.com>2011-05-22 01:25:16 +0200
commit70e654f1a5b8ec7ac86012cb9910c7ebbc6da849 (patch)
tree068f284660b11df478ed8884f8a89d0e7d4a8001
parent73c39f5b1681f2efe5ddf3fb3c7fa6e071ac6039 (diff)
downloadgtk+-70e654f1a5b8ec7ac86012cb9910c7ebbc6da849.tar.gz
stylepropertis: Use set_by_property() in set_valist()
... instead of duplicating code. This causes an extra g_value_copy(). If that turns out to be a performance issue, we can invent something that handles this (like passing a gboolean take_value). The reason for this duplication deletion is that we want to complicate the setting code to handle shorthands by unpacking them and storing the separate values.
-rw-r--r--gtk/gtkstyleproperties.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/gtk/gtkstyleproperties.c b/gtk/gtkstyleproperties.c
index 946347f795..1c5f0d9565 100644
--- a/gtk/gtkstyleproperties.c
+++ b/gtk/gtkstyleproperties.c
@@ -600,9 +600,8 @@ gtk_style_properties_set_valist (GtkStyleProperties *props,
while (property_name)
{
const GtkStyleProperty *node;
- PropertyData *prop;
gchar *error = NULL;
- GValue *val;
+ GValue val;
node = _gtk_style_property_lookup (property_name);
@@ -612,30 +611,19 @@ gtk_style_properties_set_valist (GtkStyleProperties *props,
break;
}
- prop = g_hash_table_lookup (priv->properties, node->pspec);
-
- if (!prop)
- {
- prop = property_data_new ();
- g_hash_table_insert (priv->properties, node->pspec, prop);
- }
-
- val = property_data_get_value (prop, state);
-
- if (G_IS_VALUE (val))
- g_value_unset (val);
-
- G_VALUE_COLLECT_INIT (val, node->pspec->value_type,
+ G_VALUE_COLLECT_INIT (&val, node->pspec->value_type,
args, 0, &error);
- g_param_value_validate (node->pspec, val);
if (error)
{
g_warning ("Could not set style property \"%s\": %s", property_name, error);
- g_value_unset (val);
+ g_value_unset (&val);
g_free (error);
break;
}
+ _gtk_style_properties_set_property_by_property (props, node, state, &val);
+ g_value_unset (&val);
+
property_name = va_arg (args, const gchar *);
}
}