[gtk+/wip/colorchooser-v2: 50/77] color-widget: add LEFT/RIGHT/TOP/BOTTOM style classes to the swatches



commit f4cb8a29e74e3f47b3cf7ebde0d4a54cc0949ee4
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Feb 8 17:38:20 2012 -0500

    color-widget: add LEFT/RIGHT/TOP/BOTTOM style classes to the swatches
    
    As we add them to the grid, for setting theming properties.

 gtk/gtkcolorchooserwidget.c |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkcolorchooserwidget.c b/gtk/gtkcolorchooserwidget.c
index f51242a..530eca4 100644
--- a/gtk/gtkcolorchooserwidget.c
+++ b/gtk/gtkcolorchooserwidget.c
@@ -296,24 +296,21 @@ add_palette (GtkColorChooserWidget *cc,
 
       if (horizontal)
         {
-            gtk_grid_attach (GTK_GRID (grid), p, pos, line, 1, 1);
             if (pos == left)
-              gtk_color_swatch_set_corner_radii (GTK_COLOR_SWATCH (p), 10, 1, 1, 10);
+              gtk_style_context_add_class (gtk_widget_get_style_context (p), GTK_STYLE_CLASS_LEFT);
             else if (pos == right)
-              gtk_color_swatch_set_corner_radii (GTK_COLOR_SWATCH (p), 1, 10, 10, 1);
-            else
-              gtk_color_swatch_set_corner_radii (GTK_COLOR_SWATCH (p), 1, 1, 1, 1);
+              gtk_style_context_add_class (gtk_widget_get_style_context (p), GTK_STYLE_CLASS_RIGHT);
+
+            gtk_grid_attach (GTK_GRID (grid), p, pos, line, 1, 1);
         }
       else
         {
-          gtk_grid_attach (GTK_GRID (grid), p, line, pos, 1, 1);
-
           if (pos == 0)
-            gtk_color_swatch_set_corner_radii (GTK_COLOR_SWATCH (p), 10, 10, 1, 1);
+            gtk_style_context_add_class (gtk_widget_get_style_context (p), GTK_STYLE_CLASS_TOP);
           else if (pos == colors_per_line - 1)
-            gtk_color_swatch_set_corner_radii (GTK_COLOR_SWATCH (p), 1, 1, 10, 10);
-          else
-            gtk_color_swatch_set_corner_radii (GTK_COLOR_SWATCH (p), 1, 1, 1, 1);
+            gtk_style_context_add_class (gtk_widget_get_style_context (p), GTK_STYLE_CLASS_BOTTOM);
+
+          gtk_grid_attach (GTK_GRID (grid), p, line, pos, 1, 1);
        }
     }
 



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