Commit 3e7f74c4 authored by Benjamin Otte's avatar Benjamin Otte
Browse files

styleproperty: Change _css_value_to_string()

Name it _gtk_style_property_print_value() and actually pass it the style
property. This way, we can later change it to use custom print functions
for different style properties.
parent 02a9cb5b
......@@ -2976,7 +2976,6 @@ gtk_css_ruleset_print (const GtkCssRuleset *ruleset,
GString *str)
GList *keys, *walk;
char *s;
_gtk_css_selector_print (ruleset->selector, str);
......@@ -2996,9 +2995,7 @@ gtk_css_ruleset_print (const GtkCssRuleset *ruleset,
g_string_append (str, " ");
g_string_append (str, prop->pspec->name);
g_string_append (str, ": ");
s = _gtk_css_value_to_string (value);
g_string_append (str, s);
g_free (s);
_gtk_style_property_print_value (prop, value, str);
g_string_append (str, ";\n");
......@@ -1403,8 +1403,10 @@ _gtk_css_value_parse (GValue *value,
return (*func) (parser, base, value);
char *
_gtk_css_value_to_string (const GValue *value)
_gtk_style_property_print_value (const GtkStyleProperty *property,
const GValue *value,
GString *string)
PrintFunc func;
......@@ -1416,14 +1418,15 @@ _gtk_css_value_to_string (const GValue *value)
func = g_hash_table_lookup (print_funcs,
GSIZE_TO_POINTER (g_type_fundamental (G_VALUE_TYPE (value))));
if (func)
if (func == NULL)
GString *string = g_string_new (NULL);
func (value, string);
return g_string_free (string, FALSE);
char *s = g_strdup_value_contents (value);
g_string_append (string, s);
g_free (s);
return g_strdup_value_contents (value);
func (value, string);
......@@ -59,7 +59,9 @@ void _gtk_style_property_pack (const GtkStyleProper
gboolean _gtk_css_value_parse (GValue *value,
GtkCssParser *parser,
GFile *base);
char * _gtk_css_value_to_string (const GValue *value);
void _gtk_style_property_print_value (const GtkStyleProperty *property,
const GValue *value,
GString *string);
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