From b0ab0a15e0e0971dd276390a56e8ba36422dfa94 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Fri, 26 Oct 2001 11:48:53 +0000 Subject: Document allow-grouping attribute. 2001-10-26 Christopher James Lahey * docs/etablexml.txt: Document allow-grouping attribute. * tests/test-table-1.c (SPEC): Updated this to test the allow_grouping=\"false\" attribute. From gal/e-table/ChangeLog: 2001-10-26 Christopher James Lahey * e-table-config.c (config_group_info_update, config_fields_info_update): Added some checks for NULL labels here. * e-table-specification.c, e-table-specification.h: Added allow_grouping field. Fixes Ximian bug #13412. * e-table.c, e-table.h: Added allow_grouping field. Set this field for the sort infos from state objects. svn path=/trunk/; revision=14134 --- widgets/table/e-table-config.c | 15 ++++++++++----- widgets/table/e-table-specification.c | 14 +++++++++----- widgets/table/e-table-specification.h | 1 + widgets/table/e-table.c | 3 +++ widgets/table/e-table.h | 1 + 5 files changed, 24 insertions(+), 10 deletions(-) (limited to 'widgets/table') diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index b87859ef39..70621dc741 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -285,6 +285,9 @@ config_group_info_update (ETableConfig *config) GString *res; int count, i; + if (!e_table_sort_info_get_can_group (info)) + return; + count = e_table_sort_info_grouping_get_count (info); res = g_string_new (""); @@ -310,7 +313,7 @@ config_group_info_update (ETableConfig *config) } if (res->str [0] == 0) g_string_append (res, _("No grouping")); - + gtk_label_set_text (GTK_LABEL (config->group_label), res->str); g_string_free (res, TRUE); } @@ -322,6 +325,8 @@ config_fields_info_update (ETableConfig *config) GString *res = g_string_new (""); int i; + return; + for (i = 0; i < config->state->col_count; i++){ for (column = config->source_spec->columns; *column; column++){ @@ -403,13 +408,13 @@ do_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort) config_group_info_update (config); } -#if 0 -static GtkWidget * +GtkWidget *e_table_proxy_etable_new (void); + +GtkWidget * e_table_proxy_etable_new (void) { - return gtk_label_new ("Waiting for the ETable/ETree\nmerger to be commited"); + return gtk_label_new ("Field selection dialog not\nimplemented here yet."); } -#endif static void config_button_fields (GtkWidget *widget, ETableConfig *config) diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c index 1a2aefd9c9..014eb972a6 100644 --- a/widgets/table/e-table-specification.c +++ b/widgets/table/e-table-specification.c @@ -59,8 +59,8 @@ etsp_class_init (GtkObjectClass *klass) static void etsp_init (ETableSpecification *etsp) { - etsp->columns = NULL; - etsp->state = NULL; + etsp->columns = NULL; + etsp->state = NULL; etsp->alternating_row_colors = TRUE; etsp->no_headers = FALSE; @@ -70,11 +70,12 @@ etsp_init (ETableSpecification *etsp) etsp->vertical_draw_grid = FALSE; etsp->draw_focus = TRUE; etsp->horizontal_scrolling = FALSE; + etsp->allow_grouping = TRUE; - etsp->cursor_mode = E_CURSOR_SIMPLE; - etsp->selection_mode = GTK_SELECTION_MULTIPLE; + etsp->cursor_mode = E_CURSOR_SIMPLE; + etsp->selection_mode = GTK_SELECTION_MULTIPLE; - etsp->click_to_add_message = NULL; + etsp->click_to_add_message = NULL; } E_MAKE_TYPE (e_table_specification, "ETableSpecification", ETableSpecification, etsp_class_init, etsp_init, PARENT_TYPE); @@ -177,6 +178,7 @@ e_table_specification_load_from_node (ETableSpecification *specification, } specification->draw_focus = e_xml_get_bool_prop_by_name_with_default (node, "draw-focus", TRUE); specification->horizontal_scrolling = e_xml_get_bool_prop_by_name_with_default (node, "horizontal-scrolling", FALSE); + specification->allow_grouping = e_xml_get_bool_prop_by_name_with_default (node, "allow-grouping", TRUE); specification->selection_mode = GTK_SELECTION_MULTIPLE; temp = e_xml_get_string_prop_by_name (node, "selection-mode"); @@ -223,6 +225,7 @@ e_table_specification_load_from_node (ETableSpecification *specification, } else if (specification->state == NULL && !strcmp (children->name, "ETableState")) { specification->state = e_table_state_new (); e_table_state_load_from_node (specification->state, children); + e_table_sort_info_set_can_group (specification->state->sort_info, specification->allow_grouping); } } @@ -319,6 +322,7 @@ e_table_specification_save_to_node (ETableSpecification *specification, 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); e_xml_set_bool_prop_by_name (node, "horizontal-scrolling", specification->horizontal_scrolling); + e_xml_set_bool_prop_by_name (node, "allow-grouping", specification->allow_grouping); switch (specification->selection_mode){ case GTK_SELECTION_SINGLE: diff --git a/widgets/table/e-table-specification.h b/widgets/table/e-table-specification.h index c50989eeb0..f2cc361c29 100644 --- a/widgets/table/e-table-specification.h +++ b/widgets/table/e-table-specification.h @@ -33,6 +33,7 @@ typedef struct { guint vertical_draw_grid : 1; guint draw_focus : 1; guint horizontal_scrolling : 1; + guint allow_grouping : 1; GtkSelectionMode selection_mode; ECursorMode cursor_mode; diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 04e6c57e03..9da76869b4 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -896,6 +896,7 @@ e_table_set_state_object(ETable *e_table, ETableState *state) } if (state->sort_info) { e_table->sort_info = e_table_sort_info_duplicate(state->sort_info); + e_table_sort_info_set_can_group (e_table->sort_info, e_table->allow_grouping); e_table->group_info_change_id = gtk_signal_connect (GTK_OBJECT (e_table->sort_info), "group_info_changed", @@ -1087,9 +1088,11 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, e_table->header = e_table_state_to_header (GTK_WIDGET(e_table), e_table->full_header, state); e_table->horizontal_scrolling = specification->horizontal_scrolling; + e_table->allow_grouping = specification->allow_grouping; e_table->sort_info = state->sort_info; gtk_object_ref (GTK_OBJECT (state->sort_info)); + e_table_sort_info_set_can_group (e_table->sort_info, e_table->allow_grouping); e_table->group_info_change_id = gtk_signal_connect (GTK_OBJECT (e_table->sort_info), "group_info_changed", diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h index d331dda053..1d3b7c50e3 100644 --- a/widgets/table/e-table.h +++ b/widgets/table/e-table.h @@ -90,6 +90,7 @@ typedef struct { guint do_drag : 1; guint uniform_row_height : 1; + guint allow_grouping : 1; char *click_to_add_message; GnomeCanvasItem *click_to_add; -- cgit v1.2.3