From 32c3d29bbc14cc1d4c054eb9d6538b0199e90c61 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Wed, 26 Jul 2000 20:33:39 +0000 Subject: Added "table_selection_model" argument. Removed foreach function and 2000-07-26 Christopher James Lahey * e-table-group-container.c, e-table-group-container.h, e-table-group-leaf.c, e-table-group-leaf.h: Added "table_selection_model" argument. Removed foreach function and selection notification. * e-table-group.c, e-table-group.h: Removed foreach function and selection notification. * e-table-header.c: Fixed header width calculation to include the last column. * e-table-item.c, e-table-item.h: Fixed this to use the new selection model. * e-table-scrolled.c, e-table-scrolled.h: Removed selection notification. * e-table-selection-model.c, e-table-selection-model.h: Finished notification signals and fixed a bunch of bit manipulations. Implemented do_something method. * e-table.c, e-table.h: Create an ETableSelectionModel and use it properly. svn path=/trunk/; revision=4363 --- widgets/e-table/e-table-group-container.c | 55 +++++++++++++------------------ 1 file changed, 22 insertions(+), 33 deletions(-) (limited to 'widgets/e-table/e-table-group-container.c') diff --git a/widgets/e-table/e-table-group-container.c b/widgets/e-table/e-table-group-container.c index f4e10917fb..f3788f154f 100644 --- a/widgets/e-table/e-table-group-container.c +++ b/widgets/e-table/e-table-group-container.c @@ -37,6 +37,7 @@ enum { ARG_TABLE_DRAW_GRID, ARG_TABLE_DRAW_FOCUS, ARG_CURSOR_MODE, + ARG_TABLE_SELECTION_MODEL, ARG_LENGTH_THRESHOLD, }; @@ -97,6 +98,9 @@ etgc_destroy (GtkObject *object) if (etgc->sort_info) gtk_object_unref (GTK_OBJECT(etgc->sort_info)); + if (etgc->table_selection_model) + gtk_object_unref (GTK_OBJECT(etgc->table_selection_model)); + if (etgc->rect) gtk_object_destroy (GTK_OBJECT(etgc->rect)); @@ -315,13 +319,6 @@ compute_text (ETableGroupContainer *etgc, ETableGroupContainerChildNode *child_n g_free (text); } -static void -child_row_selection (ETableGroup *etg, int row, gboolean selected, - ETableGroupContainer *etgc) -{ - e_table_group_row_selection (E_TABLE_GROUP (etgc), row, selected); -} - static void child_cursor_change (ETableGroup *etg, int row, ETableGroupContainer *etgc) @@ -395,10 +392,9 @@ etgc_add (ETableGroup *etg, gint row) "drawgrid", etgc->draw_grid, "drawfocus", etgc->draw_focus, "cursor_mode", etgc->cursor_mode, + "table_selection_model", etgc->table_selection_model, "length_threshold", etgc->length_threshold, NULL); - gtk_signal_connect (GTK_OBJECT (child), "row_selection", - GTK_SIGNAL_FUNC (child_row_selection), etgc); gtk_signal_connect (GTK_OBJECT (child), "cursor_change", GTK_SIGNAL_FUNC (child_cursor_change), etgc); gtk_signal_connect (GTK_OBJECT (child), "double_click", @@ -546,29 +542,6 @@ etgc_get_focus_column (ETableGroup *etg) return 0; } -static void -etgc_selected_row_foreach (ETableGroup *etg, - ETableForeachFunc func, - gpointer closure) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - if (etgc->children) { - GList *list; - for (list = etgc->children; list; list = list->next) { - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; - ETableGroup *child = child_node->child; - e_table_group_selected_row_foreach (child, func, closure); - } - } -} - - - - - - - - static void etgc_thaw (ETableGroup *etg) { @@ -612,6 +585,20 @@ etgc_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) } break; + case ARG_TABLE_SELECTION_MODEL: + if (etgc->table_selection_model) + gtk_object_unref(GTK_OBJECT(etgc->table_selection_model)); + etgc->table_selection_model = E_TABLE_SELECTION_MODEL(GTK_VALUE_OBJECT (*arg)); + if (etgc->table_selection_model) + gtk_object_ref(GTK_OBJECT(etgc->table_selection_model)); + for (list = etgc->children; list; list = g_list_next (list)) { + ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; + gtk_object_set (GTK_OBJECT(child_node->child), + "table_selection_model", etgc->table_selection_model, + NULL); + } + break; + case ARG_TABLE_DRAW_GRID: etgc->draw_grid = GTK_VALUE_BOOL (*arg); for (list = etgc->children; list; list = g_list_next (list)) { @@ -697,7 +684,6 @@ etgc_class_init (GtkObjectClass *object_class) e_group_class->get_cursor_row = etgc_get_cursor_row; e_group_class->get_focus_column = etgc_get_focus_column; e_group_class->get_printable = etgc_get_printable; - e_group_class->selected_row_foreach = etgc_selected_row_foreach; gtk_object_add_arg_type ("ETableGroupContainer::drawgrid", GTK_TYPE_BOOL, GTK_ARG_WRITABLE, ARG_TABLE_DRAW_GRID); @@ -705,6 +691,8 @@ etgc_class_init (GtkObjectClass *object_class) GTK_ARG_WRITABLE, ARG_TABLE_DRAW_FOCUS); gtk_object_add_arg_type ("ETableGroupContainer::cursor_mode", GTK_TYPE_INT, GTK_ARG_WRITABLE, ARG_CURSOR_MODE); + gtk_object_add_arg_type ("ETableGroupContainer::table_selection_model", GTK_TYPE_OBJECT, + GTK_ARG_WRITABLE, ARG_TABLE_SELECTION_MODEL); gtk_object_add_arg_type ("ETableGroupContainer::length_threshold", GTK_TYPE_INT, GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD); @@ -811,6 +799,7 @@ etgc_init (GtkObject *object) container->draw_focus = 1; container->cursor_mode = E_TABLE_CURSOR_SIMPLE; container->length_threshold = -1; + container->table_selection_model = NULL; } E_MAKE_TYPE (e_table_group_container, "ETableGroupContainer", ETableGroupContainer, etgc_class_init, etgc_init, PARENT_TYPE); -- cgit v1.2.3