[gtk+/wip/multiple-backgrounds: 1/8] styleproperty: make background-clip and background-area array properties



commit 5cefa5f0918d21a27762a70803957b3563d74dc5
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu May 10 10:25:33 2012 -0400

    styleproperty: make background-clip and background-area array properties
    
    Right now just make them arrays, but don't consider values after the
    first.

 gtk/gtkcssstylepropertyimpl.c |   16 +++++++++++-----
 gtk/gtkthemingbackground.c    |    8 ++++----
 2 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 1e10bee..c742c09 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -418,9 +418,7 @@ assign_border_style (GtkCssStyleProperty *property,
 }
 
 static GtkCssValue *
-parse_css_area (GtkCssStyleProperty *property,
-                GtkCssParser        *parser,
-                GFile               *base)
+parse_css_area_one (GtkCssParser *parser)
 {
   GtkCssValue *value = _gtk_css_area_value_try_parse (parser);
   
@@ -431,6 +429,14 @@ parse_css_area (GtkCssStyleProperty *property,
 }
 
 static GtkCssValue *
+parse_css_area (GtkCssStyleProperty *property,
+                GtkCssParser        *parser,
+                GFile               *base)
+{
+  return _gtk_css_array_value_parse (parser, parse_css_area_one, FALSE);
+}
+
+static GtkCssValue *
 bindings_value_parse_one (GtkCssParser *parser)
 {
   char *name;
@@ -1279,7 +1285,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
-                                          _gtk_css_area_value_new (GTK_CSS_AREA_BORDER_BOX));
+                                          _gtk_css_array_value_new (_gtk_css_area_value_new (GTK_CSS_AREA_BORDER_BOX)));
   gtk_css_style_property_register        ("background-origin",
                                           GTK_CSS_PROPERTY_BACKGROUND_ORIGIN,
                                           G_TYPE_NONE,
@@ -1289,7 +1295,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
-                                          _gtk_css_area_value_new (GTK_CSS_AREA_PADDING_BOX));
+                                          _gtk_css_array_value_new (_gtk_css_area_value_new (GTK_CSS_AREA_PADDING_BOX)));
   gtk_css_style_property_register        ("background-size",
                                           GTK_CSS_PROPERTY_BACKGROUND_SIZE,
                                           G_TYPE_NONE,
diff --git a/gtk/gtkthemingbackground.c b/gtk/gtkthemingbackground.c
index 158ac32..4c7e44b 100644
--- a/gtk/gtkthemingbackground.c
+++ b/gtk/gtkthemingbackground.c
@@ -57,10 +57,9 @@ _gtk_theming_background_apply_window_background (GtkThemingBackground *bg,
 static void
 _gtk_theming_background_apply_origin (GtkThemingBackground *bg)
 {
-  GtkCssArea origin;
   cairo_rectangle_t image_rect;
-
-  origin = _gtk_css_area_value_get (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_ORIGIN));
+  GtkCssValue *value = _gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_ORIGIN);
+  GtkCssArea origin = _gtk_css_area_value_get (_gtk_css_array_value_get_nth (value, 0));
 
   /* The default size of the background image depends on the
      background-origin value as this affects the top left
@@ -95,7 +94,8 @@ _gtk_theming_background_apply_origin (GtkThemingBackground *bg)
 static void
 _gtk_theming_background_apply_clip (GtkThemingBackground *bg)
 {
-  GtkCssArea clip = _gtk_css_area_value_get (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_CLIP));
+  GtkCssValue *value = _gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_CLIP);
+  GtkCssArea clip = _gtk_css_area_value_get (_gtk_css_array_value_get_nth (value, 0));
 
   if (clip == GTK_CSS_AREA_PADDING_BOX)
     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]