diff options
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/table/e-table-group-container.c | 15 | ||||
-rw-r--r-- | widgets/table/e-table-group-container.h | 1 | ||||
-rw-r--r-- | widgets/table/e-table-group-leaf.c | 16 | ||||
-rw-r--r-- | widgets/table/e-table-group-leaf.h | 1 | ||||
-rw-r--r-- | widgets/table/e-table-item.c | 26 | ||||
-rw-r--r-- | widgets/table/e-table-item.h | 1 | ||||
-rw-r--r-- | widgets/table/e-table-specification.c | 15 | ||||
-rw-r--r-- | widgets/table/e-table-specification.h | 1 | ||||
-rw-r--r-- | widgets/table/e-table.c | 3 | ||||
-rw-r--r-- | widgets/table/e-table.h | 1 | ||||
-rw-r--r-- | widgets/table/e-tree.c | 4 |
11 files changed, 67 insertions, 17 deletions
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index 5812910643..5d55d17415 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -35,6 +35,7 @@ enum { ARG_WIDTH, ARG_MINIMUM_WIDTH, ARG_FROZEN, + ARG_TABLE_ALTERNATING_ROW_COLORS, ARG_TABLE_HORIZONTAL_DRAW_GRID, ARG_TABLE_VERTICAL_DRAW_GRID, ARG_TABLE_DRAW_FOCUS, @@ -412,6 +413,7 @@ create_child_node (ETableGroupContainer *etgc, void *val) child = e_table_group_new (GNOME_CANVAS_GROUP (etgc), etg->full_header, etg->header, etg->model, etgc->sort_info, etgc->n + 1); gnome_canvas_item_set(GNOME_CANVAS_ITEM(child), + "alternating_row_colors", etgc->alternating_row_colors, "horizontal_draw_grid", etgc->horizontal_draw_grid, "vertical_draw_grid", etgc->vertical_draw_grid, "drawfocus", etgc->draw_focus, @@ -749,6 +751,16 @@ etgc_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) } break; + case ARG_TABLE_ALTERNATING_ROW_COLORS: + etgc->alternating_row_colors = GTK_VALUE_BOOL (*arg); + for (list = etgc->children; list; list = g_list_next (list)) { + ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; + gtk_object_set (GTK_OBJECT(child_node->child), + "alternating_row_colors", GTK_VALUE_BOOL (*arg), + NULL); + } + break; + case ARG_TABLE_HORIZONTAL_DRAW_GRID: etgc->horizontal_draw_grid = GTK_VALUE_BOOL (*arg); for (list = etgc->children; list; list = g_list_next (list)) { @@ -847,6 +859,8 @@ etgc_class_init (GtkObjectClass *object_class) e_group_class->compute_location = etgc_compute_location; e_group_class->get_cell_geometry = etgc_get_cell_geometry; + gtk_object_add_arg_type ("ETableGroupContainer::alternating_row_colors", GTK_TYPE_BOOL, + GTK_ARG_WRITABLE, ARG_TABLE_ALTERNATING_ROW_COLORS); gtk_object_add_arg_type ("ETableGroupContainer::horizontal_draw_grid", GTK_TYPE_BOOL, GTK_ARG_WRITABLE, ARG_TABLE_HORIZONTAL_DRAW_GRID); gtk_object_add_arg_type ("ETableGroupContainer::vertical_draw_grid", GTK_TYPE_BOOL, @@ -959,6 +973,7 @@ etgc_init (GtkObject *object) e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM(object), etgc_reflow); + container->alternating_row_colors = 1; container->horizontal_draw_grid = 1; container->vertical_draw_grid = 1; container->draw_focus = 1; diff --git a/widgets/table/e-table-group-container.h b/widgets/table/e-table-group-container.h index c57224d563..d7e314d517 100644 --- a/widgets/table/e-table-group-container.h +++ b/widgets/table/e-table-group-container.h @@ -45,6 +45,7 @@ typedef struct { ESelectionModel *selection_model; + guint alternating_row_colors : 1; guint horizontal_draw_grid : 1; guint vertical_draw_grid : 1; guint draw_focus : 1; diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c index f3a5630b30..bbc3b663ac 100644 --- a/widgets/table/e-table-group-leaf.c +++ b/widgets/table/e-table-group-leaf.c @@ -29,6 +29,7 @@ enum { ARG_WIDTH, ARG_MINIMUM_WIDTH, ARG_FROZEN, + ARG_TABLE_ALTERNATING_ROW_COLORS, ARG_TABLE_HORIZONTAL_DRAW_GRID, ARG_TABLE_VERTICAL_DRAW_GRID, ARG_TABLE_DRAW_FOCUS, @@ -176,6 +177,7 @@ etgl_realize (GnomeCanvasItem *item) e_table_item_get_type (), "ETableHeader", E_TABLE_GROUP(etgl)->header, "ETableModel", etgl->ets, + "alternating_row_colors", etgl->alternating_row_colors, "horizontal_draw_grid", etgl->horizontal_draw_grid, "vertical_draw_grid", etgl->vertical_draw_grid, "drawfocus", etgl->draw_focus, @@ -345,6 +347,15 @@ etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) } break; + case ARG_TABLE_ALTERNATING_ROW_COLORS: + etgl->alternating_row_colors = GTK_VALUE_BOOL (*arg); + if (etgl->item) { + gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item), + "alternating_row_colors", GTK_VALUE_BOOL (*arg), + NULL); + } + break; + case ARG_TABLE_HORIZONTAL_DRAW_GRID: etgl->horizontal_draw_grid = GTK_VALUE_BOOL (*arg); if (etgl->item) { @@ -436,7 +447,9 @@ etgl_class_init (GtkObjectClass *object_class) e_group_class->get_printable = etgl_get_printable; e_group_class->compute_location = etgl_compute_location; e_group_class->get_cell_geometry = etgl_get_cell_geometry; - + + gtk_object_add_arg_type ("ETableGroupLeaf::alternating_row_colors", GTK_TYPE_BOOL, + GTK_ARG_WRITABLE, ARG_TABLE_ALTERNATING_ROW_COLORS); gtk_object_add_arg_type ("ETableGroupLeaf::horizontal_draw_grid", GTK_TYPE_BOOL, GTK_ARG_WRITABLE, ARG_TABLE_HORIZONTAL_DRAW_GRID); gtk_object_add_arg_type ("ETableGroupLeaf::vertical_draw_grid", GTK_TYPE_BOOL, @@ -472,6 +485,7 @@ etgl_init (GtkObject *object) etgl->ets = NULL; etgl->item = NULL; + etgl->alternating_row_colors = 1; etgl->horizontal_draw_grid = 1; etgl->vertical_draw_grid = 1; etgl->draw_focus = 1; diff --git a/widgets/table/e-table-group-leaf.h b/widgets/table/e-table-group-leaf.h index fad13c4b18..de6a63013b 100644 --- a/widgets/table/e-table-group-leaf.h +++ b/widgets/table/e-table-group-leaf.h @@ -32,6 +32,7 @@ typedef struct { ETableSubset *ets; guint is_grouped : 1; + guint alternating_row_colors : 1; guint horizontal_draw_grid : 1; guint vertical_draw_grid : 1; guint draw_focus : 1; diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 2509299fe2..86bc45e323 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -33,7 +33,6 @@ #define FOCUSED_BORDER 2 #define DO_TOOLTIPS 1 -#define ALTERNATE_COLORS 1 #define d(x) @@ -60,6 +59,7 @@ enum { ARG_TABLE_HEADER, ARG_TABLE_MODEL, ARG_SELECTION_MODEL, + ARG_TABLE_ALTERNATING_ROW_COLORS, ARG_TABLE_HORIZONTAL_DRAW_GRID, ARG_TABLE_VERTICAL_DRAW_GRID, ARG_TABLE_DRAW_FOCUS, @@ -168,17 +168,17 @@ eti_get_cell_background_color (ETableItem *eti, int row, int col, gboolean selec background = &canvas->style->base [GTK_STATE_NORMAL]; } -#ifdef ALTERNATE_COLORS - if (row % 2) { + if (eti->alternating_row_colors) { + if (row % 2) { - } else { - if (allocated) - *allocated = TRUE; - background = gdk_color_copy (background); - e_hsv_tweak (background, 0.0f, 0.0f, -0.05f); - gdk_color_alloc (gtk_widget_get_colormap (GTK_WIDGET (canvas)), background); + } else { + if (allocated) + *allocated = TRUE; + background = gdk_color_copy (background); + e_hsv_tweak (background, 0.0f, 0.0f, -0.05f); + gdk_color_alloc (gtk_widget_get_colormap (GTK_WIDGET (canvas)), background); + } } -#endif return background; } @@ -1064,6 +1064,10 @@ eti_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) eti->length_threshold = GTK_VALUE_INT (*arg); break; + case ARG_TABLE_ALTERNATING_ROW_COLORS: + eti->alternating_row_colors = GTK_VALUE_BOOL (*arg); + break; + case ARG_TABLE_HORIZONTAL_DRAW_GRID: eti->horizontal_draw_grid = GTK_VALUE_BOOL (*arg); break; @@ -2106,6 +2110,8 @@ eti_class_init (GtkObjectClass *object_class) GTK_ARG_WRITABLE, ARG_TABLE_MODEL); gtk_object_add_arg_type ("ETableItem::selection_model", E_SELECTION_MODEL_TYPE, GTK_ARG_WRITABLE, ARG_SELECTION_MODEL); + gtk_object_add_arg_type ("ETableItem::alternating_row_colors", GTK_TYPE_BOOL, + GTK_ARG_WRITABLE, ARG_TABLE_ALTERNATING_ROW_COLORS); gtk_object_add_arg_type ("ETableItem::horizontal_draw_grid", GTK_TYPE_BOOL, GTK_ARG_WRITABLE, ARG_TABLE_HORIZONTAL_DRAW_GRID); gtk_object_add_arg_type ("ETableItem::vertical_draw_grid", GTK_TYPE_BOOL, diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h index 2b0d5a11cc..ff785e0068 100644 --- a/widgets/table/e-table-item.h +++ b/widgets/table/e-table-item.h @@ -53,6 +53,7 @@ typedef struct { GdkGC *focus_gc; GdkBitmap *stipple; + guint alternating_row_colors:1; guint horizontal_draw_grid:1; guint vertical_draw_grid:1; guint draw_focus:1; diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c index e4a7df56c9..b5acc017e3 100644 --- a/widgets/table/e-table-specification.c +++ b/widgets/table/e-table-specification.c @@ -61,12 +61,13 @@ etsp_init (ETableSpecification *etsp) etsp->columns = NULL; etsp->state = NULL; - etsp->no_headers = FALSE; - etsp->click_to_add = FALSE; - etsp->horizontal_draw_grid = FALSE; - etsp->vertical_draw_grid = FALSE; - etsp->draw_focus = TRUE; - etsp->horizontal_scrolling = FALSE; + etsp->alternating_row_colors = TRUE; + etsp->no_headers = FALSE; + etsp->click_to_add = FALSE; + etsp->horizontal_draw_grid = FALSE; + etsp->vertical_draw_grid = FALSE; + etsp->draw_focus = TRUE; + etsp->horizontal_scrolling = FALSE; etsp->cursor_mode = E_CURSOR_SIMPLE; etsp->selection_mode = GTK_SELECTION_MULTIPLE; @@ -163,6 +164,7 @@ e_table_specification_load_from_node (ETableSpecification *specification, specification->no_headers = e_xml_get_bool_prop_by_name (node, "no-headers"); specification->click_to_add = e_xml_get_bool_prop_by_name (node, "click-to-add"); + specification->alternating_row_colors = e_xml_get_bool_prop_by_name_with_default (node, "alternating-row-colors", TRUE); specification->horizontal_draw_grid = e_xml_get_bool_prop_by_name (node, "horizontal-draw-grid"); specification->vertical_draw_grid = e_xml_get_bool_prop_by_name (node, "vertical-draw-grid"); if (e_xml_get_bool_prop_by_name_with_default(node, "draw-grid", TRUE) == @@ -308,6 +310,7 @@ e_table_specification_save_to_node (ETableSpecification *specification, node = xmlNewNode (NULL, "ETableSpecification"); e_xml_set_bool_prop_by_name (node, "no-headers", specification->no_headers); e_xml_set_bool_prop_by_name (node, "click-to-add", specification->click_to_add); + e_xml_set_bool_prop_by_name (node, "alternating-row-colors", specification->alternating_row_colors); e_xml_set_bool_prop_by_name (node, "horizontal-draw-grid", specification->horizontal_draw_grid); e_xml_set_bool_prop_by_name (node, "vertical-draw-grid", specification->vertical_draw_grid); e_xml_set_bool_prop_by_name (node, "draw-focus", specification->draw_focus); diff --git a/widgets/table/e-table-specification.h b/widgets/table/e-table-specification.h index ebf42a6f8d..b2941f38d3 100644 --- a/widgets/table/e-table-specification.h +++ b/widgets/table/e-table-specification.h @@ -25,6 +25,7 @@ typedef struct { ETableColumnSpecification **columns; ETableState *state; + guint alternating_row_colors : 1; guint no_headers : 1; guint click_to_add : 1; guint horizontal_draw_grid : 1; diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index ab0af124bc..cf70454eff 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -208,6 +208,7 @@ e_table_init (GtkObject *object) e_table->group_info_change_id = 0; e_table->reflow_idle_id = 0; + e_table->alternating_row_colors = 1; e_table->horizontal_draw_grid = 1; e_table->vertical_draw_grid = 1; e_table->draw_focus = 1; @@ -594,6 +595,7 @@ et_build_groups (ETable *et) 0); e_canvas_vbox_add_item(E_CANVAS_VBOX(et->canvas_vbox), GNOME_CANVAS_ITEM(et->group)); gnome_canvas_item_set(GNOME_CANVAS_ITEM(et->group), + "alternating_row_colors", et->alternating_row_colors, "horizontal_draw_grid", et->horizontal_draw_grid, "vertical_draw_grid", et->vertical_draw_grid, "drawfocus", et->draw_focus, @@ -970,6 +972,7 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, e_table->use_click_to_add = specification->click_to_add; e_table->click_to_add_message = e_utf8_from_locale_string (gettext (specification->click_to_add_message)); + e_table->alternating_row_colors = specification->alternating_row_colors; e_table->horizontal_draw_grid = specification->horizontal_draw_grid; e_table->vertical_draw_grid = specification->vertical_draw_grid; e_table->draw_focus = specification->draw_focus; diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h index 8f489f3439..829b8ffcaf 100644 --- a/widgets/table/e-table.h +++ b/widgets/table/e-table.h @@ -73,6 +73,7 @@ typedef struct { /* * Configuration settings */ + guint alternating_row_colors : 1; guint horizontal_draw_grid : 1; guint vertical_draw_grid : 1; guint draw_focus : 1; diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index cd6e90e4f6..49fcc0732f 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -109,6 +109,7 @@ struct ETreePriv { /* * Configuration settings */ + guint alternating_row_colors : 1; guint horizontal_draw_grid : 1; guint vertical_draw_grid : 1; guint draw_focus : 1; @@ -267,6 +268,7 @@ e_tree_init (GtkObject *object) e_tree->priv->sorter = NULL; e_tree->priv->reflow_idle_id = 0; + e_tree->priv->alternating_row_colors = 1; e_tree->priv->horizontal_draw_grid = 1; e_tree->priv->vertical_draw_grid = 1; e_tree->priv->draw_focus = 1; @@ -605,6 +607,7 @@ et_build_item (ETree *et) "ETableHeader", et->priv->header, "ETableModel", et->priv->etta, "selection_model", et->priv->selection, + "alternating_row_colors", et->priv->alternating_row_colors, "horizontal_draw_grid", et->priv->horizontal_draw_grid, "vertical_draw_grid", et->priv->vertical_draw_grid, "drawfocus", et->priv->draw_focus, @@ -930,6 +933,7 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, else ete = e_table_extras_new(); + e_tree->priv->alternating_row_colors = specification->alternating_row_colors; e_tree->priv->horizontal_draw_grid = specification->horizontal_draw_grid; e_tree->priv->vertical_draw_grid = specification->vertical_draw_grid; e_tree->priv->draw_focus = specification->draw_focus; |