css: Return GArrays from shorthand parsing

GValueArray is deprecated now.
This commit is contained in:
Benjamin Otte 2012-01-25 18:28:26 +01:00
parent fd4f701c50
commit 8da4c2affa
2 changed files with 14 additions and 13 deletions

View File

@ -1194,17 +1194,18 @@ gtk_css_ruleset_add (GtkCssRuleset *ruleset,
if (GTK_IS_CSS_SHORTHAND_PROPERTY (prop))
{
GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (prop);
GValueArray *array = g_value_get_boxed (&value->value);
GArray *array = g_value_get_boxed (&value->value);
guint i;
for (i = 0; i < _gtk_css_shorthand_property_get_n_subproperties (shorthand); i++)
{
GtkCssStyleProperty *child = _gtk_css_shorthand_property_get_subproperty (shorthand, i);
const GValue *sub = &g_array_index (array, GValue, i);
PropertyValue *val;
val = property_value_new (value->section);
g_value_init (&val->value, G_VALUE_TYPE (g_value_array_get_nth (array, i)));
g_value_copy (g_value_array_get_nth (array, i), &val->value);
g_value_init (&val->value, G_VALUE_TYPE (sub));
g_value_copy (sub, &val->value);
gtk_css_ruleset_add (ruleset, GTK_STYLE_PROPERTY (child), val);
}
property_value_free (value);

View File

@ -91,12 +91,12 @@ gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
GFile *base)
{
GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (property);
GValueArray *array;
GArray *array;
guint i;
array = g_value_array_new (shorthand->subproperties->len);
for (i = 0; i < shorthand->subproperties->len; i++)
g_value_array_append (array, NULL);
array = g_array_new (FALSE, TRUE, sizeof (GValue));
g_array_set_clear_func (array, (GDestroyNotify) g_value_unset);
g_array_set_size (array, shorthand->subproperties->len);
if (_gtk_css_parser_try (parser, "initial", TRUE))
{
@ -105,7 +105,7 @@ gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
*/
for (i = 0; i < shorthand->subproperties->len; i++)
{
GValue *val = g_value_array_get_nth (array, i);
GValue *val = &g_array_index (array, GValue, i);
g_value_init (val, GTK_TYPE_CSS_SPECIAL_VALUE);
g_value_set_enum (val, GTK_CSS_INITIAL);
}
@ -120,14 +120,14 @@ gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
*/
for (i = 0; i < shorthand->subproperties->len; i++)
{
GValue *val = g_value_array_get_nth (array, i);
GValue *val = &g_array_index (array, GValue, i);
g_value_init (val, GTK_TYPE_CSS_SPECIAL_VALUE);
g_value_set_enum (val, GTK_CSS_INHERIT);
}
}
else if (!shorthand->parse (shorthand, array->values, parser, base))
else if (!shorthand->parse (shorthand, (GValue *) array->data, parser, base))
{
g_value_array_free (array);
g_array_free (array, TRUE);
return FALSE;
}
@ -136,14 +136,14 @@ gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
* XXX: Is the default always initial or can it be inherit? */
for (i = 0; i < shorthand->subproperties->len; i++)
{
GValue *val = g_value_array_get_nth (array, i);
GValue *val = &g_array_index (array, GValue, i);
if (G_IS_VALUE (val))
continue;
g_value_init (val, GTK_TYPE_CSS_SPECIAL_VALUE);
g_value_set_enum (val, GTK_CSS_INITIAL);
}
g_value_init (value, G_TYPE_VALUE_ARRAY);
g_value_init (value, G_TYPE_ARRAY);
g_value_take_boxed (value, array);
return TRUE;
}