[evolution] Bug #710337 - Define ETree/ETable "alternating-row-colors" style property



commit 10c05bd15f77d2eb743352848bc6b2ee80c88815
Author: Milan Crha <mcrha redhat com>
Date:   Thu Mar 13 19:22:05 2014 +0100

    Bug #710337 - Define ETree/ETable "alternating-row-colors" style property

 e-util/e-table.c |   22 +++++++++++++++++++++-
 e-util/e-tree.c  |   23 ++++++++++++++++++++++-
 2 files changed, 43 insertions(+), 2 deletions(-)
---
diff --git a/e-util/e-table.c b/e-util/e-table.c
index ecffb57..0dd02a2 100644
--- a/e-util/e-table.c
+++ b/e-util/e-table.c
@@ -1083,6 +1083,7 @@ static void
 et_build_groups (ETable *et)
 {
        gboolean was_grouped = et->is_grouped;
+       gboolean alternating_row_colors;
 
        et->is_grouped = e_table_sort_info_grouping_get_count (et->sort_info) > 0;
 
@@ -1103,9 +1104,19 @@ et_build_groups (ETable *et)
                        E_CANVAS_VBOX (et->canvas_vbox),
                        GNOME_CANVAS_ITEM (et->group));
 
+       alternating_row_colors = et->alternating_row_colors;
+       if (alternating_row_colors) {
+               gboolean bvalue = TRUE;
+
+               /* user can only disable this option, if it's enabled by the specification */
+               gtk_widget_style_get (GTK_WIDGET (et), "alternating-row-colors", &bvalue, NULL);
+
+               alternating_row_colors = bvalue ? 1 : 0;
+       }
+
        gnome_canvas_item_set (
                GNOME_CANVAS_ITEM (et->group),
-               "alternating_row_colors", et->alternating_row_colors,
+               "alternating_row_colors", alternating_row_colors,
                "horizontal_draw_grid", et->horizontal_draw_grid,
                "vertical_draw_grid", et->vertical_draw_grid,
                "drawfocus", et->draw_focus,
@@ -3458,6 +3469,15 @@ e_table_class_init (ETableClass *class)
                        G_PARAM_READABLE |
                        G_PARAM_STATIC_STRINGS));
 
+       gtk_widget_class_install_style_property (
+               widget_class,
+               g_param_spec_boolean (
+                       "alternating-row-colors",
+                       "Alternating Row Colors",
+                       "Whether to use alternating row colors",
+                       TRUE,
+                       G_PARAM_READABLE));
+
        /* Scrollable interface */
        g_object_class_override_property (
                object_class, PROP_HADJUSTMENT, "hadjustment");
diff --git a/e-util/e-tree.c b/e-util/e-tree.c
index 87d85e1..d56456b 100644
--- a/e-util/e-tree.c
+++ b/e-util/e-tree.c
@@ -1116,6 +1116,18 @@ et_selection_model_selection_row_changed (ETableSelectionModel *etsm,
 static void
 et_build_item (ETree *tree)
 {
+       gboolean alternating_row_colors;
+
+       alternating_row_colors = tree->priv->alternating_row_colors;
+       if (alternating_row_colors) {
+               gboolean bvalue = TRUE;
+
+               /* user can only disable this option, if it's enabled by the specification */
+               gtk_widget_style_get (GTK_WIDGET (tree), "alternating-row-colors", &bvalue, NULL);
+
+               alternating_row_colors = bvalue ? 1 : 0;
+       }
+
        tree->priv->item = gnome_canvas_item_new (
                GNOME_CANVAS_GROUP (
                        gnome_canvas_root (tree->priv->table_canvas)),
@@ -1123,7 +1135,7 @@ et_build_item (ETree *tree)
                "ETableHeader", tree->priv->header,
                "ETableModel", tree->priv->etta,
                "selection_model", tree->priv->selection,
-               "alternating_row_colors", tree->priv->alternating_row_colors,
+               "alternating_row_colors", alternating_row_colors,
                "horizontal_draw_grid", tree->priv->horizontal_draw_grid,
                "vertical_draw_grid", tree->priv->vertical_draw_grid,
                "drawfocus", tree->priv->draw_focus,
@@ -3136,6 +3148,15 @@ e_tree_class_init (ETreeClass *class)
                        G_PARAM_READABLE |
                        G_PARAM_STATIC_STRINGS));
 
+       gtk_widget_class_install_style_property (
+               widget_class,
+               g_param_spec_boolean (
+                       "alternating-row-colors",
+                       "Alternating Row Colors",
+                       "Whether to use alternating row colors",
+                       TRUE,
+                       G_PARAM_READABLE));
+
        /* Scrollable interface */
        g_object_class_override_property (
                object_class, PROP_HADJUSTMENT, "hadjustment");


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