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-leaf.c | 38 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'widgets/e-table/e-table-group-leaf.c') diff --git a/widgets/e-table/e-table-group-leaf.c b/widgets/e-table/e-table-group-leaf.c index 08c4c4a475..f6b540cdae 100644 --- a/widgets/e-table/e-table-group-leaf.c +++ b/widgets/e-table/e-table-group-leaf.c @@ -31,6 +31,7 @@ enum { ARG_TABLE_DRAW_FOCUS, ARG_CURSOR_MODE, ARG_LENGTH_THRESHOLD, + ARG_TABLE_SELECTION_MODEL, }; static void etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); @@ -44,6 +45,8 @@ etgl_destroy (GtkObject *object) gtk_object_unref (GTK_OBJECT(etgl->subset)); if (etgl->item) gtk_object_destroy (GTK_OBJECT(etgl->item)); + if (etgl->table_selection_model) + gtk_object_unref (GTK_OBJECT(etgl->table_selection_model)); if (GTK_OBJECT_CLASS (etgl_parent_class)->destroy) GTK_OBJECT_CLASS (etgl_parent_class)->destroy (object); } @@ -80,13 +83,6 @@ e_table_group_leaf_new (GnomeCanvasGroup *parent, return E_TABLE_GROUP (etgl); } -static void -etgl_row_selection (GtkObject *object, gint row, gboolean selected, ETableGroupLeaf *etgl) -{ - if (row < E_TABLE_SUBSET(etgl->subset)->n_map) - e_table_group_row_selection (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->subset)->map_table[row], selected); -} - static void etgl_cursor_change (GtkObject *object, gint row, ETableGroupLeaf *etgl) { @@ -149,10 +145,9 @@ etgl_realize (GnomeCanvasItem *item) "cursor_mode", etgl->cursor_mode, "minimum_width", etgl->minimum_width, "length_threshold", etgl->length_threshold, + "table_selection_model", etgl->table_selection_model, NULL)); - gtk_signal_connect (GTK_OBJECT(etgl->item), "row_selection", - GTK_SIGNAL_FUNC(etgl_row_selection), etgl); gtk_signal_connect (GTK_OBJECT(etgl->item), "cursor_change", GTK_SIGNAL_FUNC(etgl_cursor_change), etgl); gtk_signal_connect (GTK_OBJECT(etgl->item), "double_click", @@ -244,15 +239,6 @@ etgl_get_printable (ETableGroup *etg) return e_table_item_get_printable (etgl->item); } -static void -etgl_selected_row_foreach(ETableGroup *etg, - ETableForeachFunc func, - gpointer closure) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - e_table_item_selected_row_foreach (etgl->item, func, closure); -} - static void etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) { @@ -284,6 +270,17 @@ etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) NULL); } break; + case ARG_TABLE_SELECTION_MODEL: + if (etgl->table_selection_model) + gtk_object_unref(GTK_OBJECT(etgl->table_selection_model)); + etgl->table_selection_model = E_TABLE_SELECTION_MODEL(GTK_VALUE_OBJECT (*arg)); + if (etgl->table_selection_model) + gtk_object_ref(GTK_OBJECT(etgl->table_selection_model)); + if (etgl->item) { + gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item), + "table_selection_model", etgl->table_selection_model, + NULL); + } case ARG_TABLE_DRAW_GRID: etgl->draw_grid = GTK_VALUE_BOOL (*arg); @@ -365,7 +362,6 @@ etgl_class_init (GtkObjectClass *object_class) e_group_class->get_cursor_row = etgl_get_cursor_row; e_group_class->get_focus_column = etgl_get_focus_column; e_group_class->get_printable = etgl_get_printable; - e_group_class->selected_row_foreach = etgl_selected_row_foreach; gtk_object_add_arg_type ("ETableGroupLeaf::drawgrid", GTK_TYPE_BOOL, GTK_ARG_WRITABLE, ARG_TABLE_DRAW_GRID); @@ -375,6 +371,8 @@ etgl_class_init (GtkObjectClass *object_class) GTK_ARG_WRITABLE, ARG_CURSOR_MODE); gtk_object_add_arg_type ("ETableGroupLeaf::length_threshold", GTK_TYPE_INT, GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD); + gtk_object_add_arg_type ("ETableGroupLeaf::table_selection_model", GTK_TYPE_OBJECT, + GTK_ARG_WRITABLE, ARG_TABLE_SELECTION_MODEL); gtk_object_add_arg_type ("ETableGroupLeaf::height", GTK_TYPE_DOUBLE, GTK_ARG_READABLE, ARG_HEIGHT); @@ -403,6 +401,8 @@ etgl_init (GtkObject *object) etgl->cursor_mode = E_TABLE_CURSOR_SIMPLE; etgl->length_threshold = -1; + etgl->table_selection_model = NULL; + e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM(object), etgl_reflow); } -- cgit v1.2.3