diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c index 0aed216340..a545ed6118 100644 --- a/gtk/gtkstyleproperty.c +++ b/gtk/gtkstyleproperty.c @@ -32,6 +32,7 @@ #include "gtkcssprovider.h" #include "gtkcssparserprivate.h" #include "gtkcsstypesprivate.h" +#include "gtkprivatetypebuiltins.h" /* the actual parsers we have */ #include "gtkanimationdescription.h" @@ -1205,14 +1206,10 @@ background_repeat_value_parse (GtkCssParser *parser, GValue *value) { GtkCssBackgroundRepeat repeat; - GtkCssBackgroundRepeatStyle style; + int style; - if (_gtk_css_parser_try (parser, "repeat", TRUE)) - style = GTK_CSS_BACKGROUND_REPEAT_STYLE_REPEAT; - else if (_gtk_css_parser_try (parser, "no-repeat", TRUE)) - style = GTK_CSS_BACKGROUND_REPEAT_STYLE_NO_REPEAT; - else - style = GTK_CSS_BACKGROUND_REPEAT_STYLE_NONE; + if (!enum_parse (parser, GTK_TYPE_CSS_BACKGROUND_REPEAT_STYLE, &style)) + return FALSE; repeat.repeat = style; @@ -1221,20 +1218,6 @@ background_repeat_value_parse (GtkCssParser *parser, return TRUE; } -static const gchar * -background_repeat_style_to_string (GtkCssBackgroundRepeatStyle repeat) -{ - switch (repeat) - { - case GTK_CSS_BACKGROUND_REPEAT_STYLE_REPEAT: - return "repeat"; - case GTK_CSS_BACKGROUND_REPEAT_STYLE_NO_REPEAT: - return "no-repeat"; - default: - return NULL; - } -} - static void background_repeat_value_print (const GValue *value, GString *string) @@ -1243,7 +1226,7 @@ background_repeat_value_print (const GValue *value, repeat = g_value_get_boxed (value); - g_string_append (string, background_repeat_style_to_string (repeat->repeat)); + enum_print (repeat->repeat, GTK_TYPE_CSS_BACKGROUND_REPEAT_STYLE, string); } static gboolean