mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-17 14:30:15 +00:00
css: Use enum parsing for background repeat style
This commit is contained in:
parent
8fb4b13730
commit
2a42fad145
@ -32,6 +32,7 @@
|
|||||||
#include "gtkcssprovider.h"
|
#include "gtkcssprovider.h"
|
||||||
#include "gtkcssparserprivate.h"
|
#include "gtkcssparserprivate.h"
|
||||||
#include "gtkcsstypesprivate.h"
|
#include "gtkcsstypesprivate.h"
|
||||||
|
#include "gtkprivatetypebuiltins.h"
|
||||||
|
|
||||||
/* the actual parsers we have */
|
/* the actual parsers we have */
|
||||||
#include "gtkanimationdescription.h"
|
#include "gtkanimationdescription.h"
|
||||||
@ -1205,14 +1206,10 @@ background_repeat_value_parse (GtkCssParser *parser,
|
|||||||
GValue *value)
|
GValue *value)
|
||||||
{
|
{
|
||||||
GtkCssBackgroundRepeat repeat;
|
GtkCssBackgroundRepeat repeat;
|
||||||
GtkCssBackgroundRepeatStyle style;
|
int style;
|
||||||
|
|
||||||
if (_gtk_css_parser_try (parser, "repeat", TRUE))
|
if (!enum_parse (parser, GTK_TYPE_CSS_BACKGROUND_REPEAT_STYLE, &style))
|
||||||
style = GTK_CSS_BACKGROUND_REPEAT_STYLE_REPEAT;
|
return FALSE;
|
||||||
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;
|
|
||||||
|
|
||||||
repeat.repeat = style;
|
repeat.repeat = style;
|
||||||
|
|
||||||
@ -1221,20 +1218,6 @@ background_repeat_value_parse (GtkCssParser *parser,
|
|||||||
return TRUE;
|
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
|
static void
|
||||||
background_repeat_value_print (const GValue *value,
|
background_repeat_value_print (const GValue *value,
|
||||||
GString *string)
|
GString *string)
|
||||||
@ -1243,7 +1226,7 @@ background_repeat_value_print (const GValue *value,
|
|||||||
|
|
||||||
repeat = g_value_get_boxed (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
|
static gboolean
|
||||||
|
Loading…
Reference in New Issue
Block a user