aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2014-03-14 02:22:05 +0800
committerMilan Crha <mcrha@redhat.com>2014-03-14 02:22:05 +0800
commit10c05bd15f77d2eb743352848bc6b2ee80c88815 (patch)
treeccc4a3f0178cecdcb9b26137d2e99f5e1d36e71c
parentec79e62d981c5cefd36d4d40693b25117d236365 (diff)
downloadgsoc2013-evolution-10c05bd15f77d2eb743352848bc6b2ee80c88815.tar
gsoc2013-evolution-10c05bd15f77d2eb743352848bc6b2ee80c88815.tar.gz
gsoc2013-evolution-10c05bd15f77d2eb743352848bc6b2ee80c88815.tar.bz2
gsoc2013-evolution-10c05bd15f77d2eb743352848bc6b2ee80c88815.tar.lz
gsoc2013-evolution-10c05bd15f77d2eb743352848bc6b2ee80c88815.tar.xz
gsoc2013-evolution-10c05bd15f77d2eb743352848bc6b2ee80c88815.tar.zst
gsoc2013-evolution-10c05bd15f77d2eb743352848bc6b2ee80c88815.zip
Bug #710337 - Define ETree/ETable "alternating-row-colors" style property
-rw-r--r--e-util/e-table.c22
-rw-r--r--e-util/e-tree.c23
2 files changed, 43 insertions, 2 deletions
diff --git a/e-util/e-table.c b/e-util/e-table.c
index ecffb57367..0dd02a2422 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 87d85e16ef..d56456b4ad 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");