Commit 4b7ca960 authored by Benjamin Otte's avatar Benjamin Otte

background: Simplify background-repeat

It used to be a struct, now it's just an enum
parent 07aa7f6b
......@@ -1061,35 +1061,6 @@ shadow_value_compute (GValue *computed,
g_value_take_boxed (computed, shadow);
}
static gboolean
background_repeat_value_parse (GtkCssParser *parser,
GFile *file,
GValue *value)
{
GtkCssBackgroundRepeat repeat;
int style;
if (!enum_parse (parser, GTK_TYPE_CSS_BACKGROUND_REPEAT_STYLE, &style))
return FALSE;
repeat.repeat = style;
g_value_set_boxed (value, &repeat);
return TRUE;
}
static void
background_repeat_value_print (const GValue *value,
GString *string)
{
GtkCssBackgroundRepeat *repeat;
repeat = g_value_get_boxed (value);
enum_print (repeat->repeat, GTK_TYPE_CSS_BACKGROUND_REPEAT_STYLE, string);
}
static gboolean
border_image_repeat_value_parse (GtkCssParser *parser,
GFile *file,
......@@ -1319,10 +1290,6 @@ gtk_css_style_funcs_init (void)
flags_value_parse,
flags_value_print,
NULL);
register_conversion_function (GTK_TYPE_CSS_BACKGROUND_REPEAT,
background_repeat_value_parse,
background_repeat_value_print,
NULL);
}
/**
......
......@@ -448,7 +448,6 @@ _gtk_css_style_property_init_properties (void)
GdkRGBA rgba;
GtkCssBorderCornerRadius no_corner_radius = { 0, };
GtkBorder border_of_ones = { 1, 1, 1, 1 };
GtkCssBackgroundRepeat background_repeat = { GTK_CSS_BACKGROUND_REPEAT_STYLE_REPEAT };
GtkCssBorderImageRepeat border_image_repeat = { GTK_CSS_REPEAT_STYLE_STRETCH, GTK_CSS_REPEAT_STYLE_STRETCH };
/* Initialize "color" and "font-size" first,
......@@ -711,7 +710,7 @@ _gtk_css_style_property_init_properties (void)
NULL,
NULL,
NULL,
&background_repeat);
GTK_CSS_BACKGROUND_REPEAT);
g_value_init (&value, GTK_TYPE_CSS_IMAGE);
_gtk_style_property_register ("background-image",
CAIRO_GOBJECT_TYPE_PATTERN,
......
......@@ -31,7 +31,5 @@ type_name ## _copy (const TypeName *foo) \
\
G_DEFINE_BOXED_TYPE (TypeName, type_name, type_name ## _copy, g_free)
DEFINE_BOXED_TYPE_WITH_COPY_FUNC (GtkCssBackgroundRepeat, _gtk_css_background_repeat)
DEFINE_BOXED_TYPE_WITH_COPY_FUNC (GtkCssBorderCornerRadius, _gtk_css_border_corner_radius)
DEFINE_BOXED_TYPE_WITH_COPY_FUNC (GtkCssBorderImageRepeat, _gtk_css_border_image_repeat)
......@@ -31,9 +31,9 @@ typedef enum {
} GtkCssSpecialValue;
typedef enum {
GTK_CSS_BACKGROUND_REPEAT_STYLE_REPEAT,
GTK_CSS_BACKGROUND_REPEAT_STYLE_NO_REPEAT,
} GtkCssBackgroundRepeatStyle;
GTK_CSS_BACKGROUND_REPEAT,
GTK_CSS_BACKGROUND_NO_REPEAT,
} GtkCssBackgroundRepeat;
typedef enum {
GTK_CSS_REPEAT_STYLE_STRETCH,
......@@ -48,16 +48,9 @@ typedef enum {
GTK_CSS_AREA_CONTENT_BOX
} GtkCssArea;
typedef struct _GtkCssBackgroundRepeat GtkCssBackgroundRepeat;
typedef struct _GtkCssBorderCornerRadius GtkCssBorderCornerRadius;
typedef struct _GtkCssBorderImageRepeat GtkCssBorderImageRepeat;
struct _GtkCssBackgroundRepeat {
/* FIXME: will have vrepeat and hrepeat instead */
GtkCssBackgroundRepeatStyle repeat;
};
struct _GtkCssBorderCornerRadius {
double horizontal;
double vertical;
......@@ -68,14 +61,10 @@ struct _GtkCssBorderImageRepeat {
GtkCssBorderRepeatStyle hrepeat;
};
#define GTK_TYPE_CSS_BACKGROUND_REPEAT _gtk_css_background_repeat_get_type ()
#define GTK_TYPE_CSS_BORDER_CORNER_RADIUS _gtk_css_border_corner_radius_get_type ()
#define GTK_TYPE_CSS_BORDER_RADIUS _gtk_css_border_radius_get_type ()
#define GTK_TYPE_CSS_BORDER_IMAGE_REPEAT _gtk_css_border_image_repeat_get_type ()
GType _gtk_css_background_repeat_get_type (void);
GType _gtk_css_border_corner_radius_get_type (void);
GType _gtk_css_border_radius_get_type (void);
GType _gtk_css_border_image_repeat_get_type (void);
......
......@@ -116,7 +116,7 @@ _gtk_theming_background_paint (GtkThemingBackground *bg,
if (bg->image)
{
GtkCssBackgroundRepeat *repeat;
GtkCssBackgroundRepeat repeat;
double image_width, image_height;
gtk_theming_engine_get (bg->engine, bg->flags,
......
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