diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-03-30 16:52:04 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-03-30 16:52:04 +0800 |
commit | 0e347fdbe179247d7e641af57bb6046477fe5449 (patch) | |
tree | e424cb5bb32a85e6bde18d93bd571ec194c63c69 /widgets/table | |
parent | e0ba87c430049a2f18464abcdf091af4a5010957 (diff) | |
download | gsoc2013-evolution-0e347fdbe179247d7e641af57bb6046477fe5449.tar.gz gsoc2013-evolution-0e347fdbe179247d7e641af57bb6046477fe5449.tar.zst gsoc2013-evolution-0e347fdbe179247d7e641af57bb6046477fe5449.zip |
Changed the signal "table_selection_model" to just be "selection_model"
2001-03-30 Christopher James Lahey <clahey@ximian.com>
* e-table-group-container.c, e-table-group-container.h,
e-table-group-leaf.c, e-table-group-leaf.h, e-table-item.c,
e-table-item.h, e-table.c, e-tree.c: Changed the signal
"table_selection_model" to just be "selection_model" everywhere
and made it be ESelectionModels instead of ETableSelectionModels
for generality.
* e-table-item.c (eti_event): Make right arrow and left arrow
accessible as events that can be caught.
* e-tree-sorted.c, e-tree-sorted.h (e_tree_sorted_orig_position):
Added this function.
svn path=/trunk/; revision=9041
Diffstat (limited to 'widgets/table')
-rw-r--r-- | widgets/table/e-table-group-container.c | 30 | ||||
-rw-r--r-- | widgets/table/e-table-group-container.h | 2 | ||||
-rw-r--r-- | widgets/table/e-table-group-leaf.c | 28 | ||||
-rw-r--r-- | widgets/table/e-table-group-leaf.h | 2 | ||||
-rw-r--r-- | widgets/table/e-table-item.c | 44 | ||||
-rw-r--r-- | widgets/table/e-table-item.h | 4 | ||||
-rw-r--r-- | widgets/table/e-table.c | 2 | ||||
-rw-r--r-- | widgets/table/e-tree-sorted.c | 7 | ||||
-rw-r--r-- | widgets/table/e-tree-sorted.h | 3 | ||||
-rw-r--r-- | widgets/table/e-tree.c | 2 |
10 files changed, 69 insertions, 55 deletions
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index 5ab6cdc754..540bec0645 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -38,7 +38,7 @@ enum { ARG_TABLE_VERTICAL_DRAW_GRID, ARG_TABLE_DRAW_FOCUS, ARG_CURSOR_MODE, - ARG_TABLE_SELECTION_MODEL, + ARG_SELECTION_MODEL, ARG_LENGTH_THRESHOLD, }; @@ -99,8 +99,8 @@ 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->selection_model) + gtk_object_unref (GTK_OBJECT(etgc->selection_model)); if (etgc->rect) gtk_object_destroy (GTK_OBJECT(etgc->rect)); @@ -415,7 +415,7 @@ create_child_node (ETableGroupContainer *etgc, void *val) "vertical_draw_grid", etgc->vertical_draw_grid, "drawfocus", etgc->draw_focus, "cursor_mode", etgc->cursor_mode, - "table_selection_model", etgc->table_selection_model, + "selection_model", etgc->selection_model, "length_threshold", etgc->length_threshold, "minimum_width", etgc->minimum_width - GROUP_INDENT, NULL); @@ -535,7 +535,7 @@ static void etgc_add_all (ETableGroup *etg) { ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); - ESorter *sorter = E_SELECTION_MODEL(etgc->table_selection_model)->sorter; + ESorter *sorter = etgc->selection_model->sorter; int *array; int count; @@ -706,16 +706,16 @@ 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)); + case ARG_SELECTION_MODEL: + if (etgc->selection_model) + gtk_object_unref(GTK_OBJECT(etgc->selection_model)); + etgc->selection_model = E_SELECTION_MODEL(GTK_VALUE_OBJECT (*arg)); + if (etgc->selection_model) + gtk_object_ref(GTK_OBJECT(etgc->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, + "selection_model", etgc->selection_model, NULL); } break; @@ -825,8 +825,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::selection_model", E_SELECTION_MODEL_TYPE, + GTK_ARG_WRITABLE, ARG_SELECTION_MODEL); gtk_object_add_arg_type ("ETableGroupContainer::length_threshold", GTK_TYPE_INT, GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD); @@ -934,7 +934,7 @@ etgc_init (GtkObject *object) container->draw_focus = 1; container->cursor_mode = E_CURSOR_SIMPLE; container->length_threshold = -1; - container->table_selection_model = NULL; + container->selection_model = NULL; } E_MAKE_TYPE (e_table_group_container, "ETableGroupContainer", ETableGroupContainer, etgc_class_init, etgc_init, PARENT_TYPE); diff --git a/widgets/table/e-table-group-container.h b/widgets/table/e-table-group-container.h index e4c659993e..c57224d563 100644 --- a/widgets/table/e-table-group-container.h +++ b/widgets/table/e-table-group-container.h @@ -43,7 +43,7 @@ typedef struct { int n; int length_threshold; - ETableSelectionModel *table_selection_model; + ESelectionModel *selection_model; guint horizontal_draw_grid : 1; guint vertical_draw_grid : 1; diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c index 314d80e3de..b1a91ad67e 100644 --- a/widgets/table/e-table-group-leaf.c +++ b/widgets/table/e-table-group-leaf.c @@ -34,7 +34,7 @@ enum { ARG_TABLE_DRAW_FOCUS, ARG_CURSOR_MODE, ARG_LENGTH_THRESHOLD, - ARG_TABLE_SELECTION_MODEL, + ARG_SELECTION_MODEL, }; static void etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); @@ -48,8 +48,8 @@ etgl_destroy (GtkObject *object) gtk_object_unref (GTK_OBJECT(etgl->ets)); 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 (etgl->selection_model) + gtk_object_unref (GTK_OBJECT(etgl->selection_model)); if (GTK_OBJECT_CLASS (etgl_parent_class)->destroy) GTK_OBJECT_CLASS (etgl_parent_class)->destroy (object); } @@ -182,7 +182,7 @@ 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, + "selection_model", etgl->selection_model, NULL)); gtk_signal_connect (GTK_OBJECT(etgl->item), "cursor_change", @@ -325,15 +325,15 @@ 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)); + case ARG_SELECTION_MODEL: + if (etgl->selection_model) + gtk_object_unref(GTK_OBJECT(etgl->selection_model)); + etgl->selection_model = E_SELECTION_MODEL(GTK_VALUE_OBJECT (*arg)); + if (etgl->selection_model) + gtk_object_ref(GTK_OBJECT(etgl->selection_model)); if (etgl->item) { gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item), - "table_selection_model", etgl->table_selection_model, + "selection_model", etgl->selection_model, NULL); } @@ -438,8 +438,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::selection_model", E_SELECTION_MODEL_TYPE, + GTK_ARG_WRITABLE, ARG_SELECTION_MODEL); gtk_object_add_arg_type ("ETableGroupLeaf::height", GTK_TYPE_DOUBLE, GTK_ARG_READABLE, ARG_HEIGHT); @@ -469,7 +469,7 @@ etgl_init (GtkObject *object) etgl->cursor_mode = E_CURSOR_SIMPLE; etgl->length_threshold = -1; - etgl->table_selection_model = NULL; + etgl->selection_model = NULL; e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM(object), etgl_reflow); } diff --git a/widgets/table/e-table-group-leaf.h b/widgets/table/e-table-group-leaf.h index 27407148b9..fad13c4b18 100644 --- a/widgets/table/e-table-group-leaf.h +++ b/widgets/table/e-table-group-leaf.h @@ -37,7 +37,7 @@ typedef struct { guint draw_focus : 1; ECursorMode cursor_mode; - ETableSelectionModel *table_selection_model; + ESelectionModel *selection_model; } ETableGroupLeaf; typedef struct { diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index bd308a24e7..2605d5a7a4 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -50,7 +50,7 @@ enum { ARG_0, ARG_TABLE_HEADER, ARG_TABLE_MODEL, - ARG_TABLE_SELECTION_MODEL, + ARG_SELECTION_MODEL, ARG_TABLE_HORIZONTAL_DRAW_GRID, ARG_TABLE_VERTICAL_DRAW_GRID, ARG_TABLE_DRAW_FOCUS, @@ -70,9 +70,9 @@ enum { static int eti_get_height (ETableItem *eti); static int eti_row_height (ETableItem *eti, int row); static void e_table_item_focus (ETableItem *eti, int col, int row, GdkModifierType state); -static void eti_cursor_change (ETableSelectionModel *selection, int row, int col, ETableItem *eti); -static void eti_cursor_activated (ETableSelectionModel *selection, int row, int col, ETableItem *eti); -static void eti_selection_change (ETableSelectionModel *selection, ETableItem *eti); +static void eti_cursor_change (ESelectionModel *selection, int row, int col, ETableItem *eti); +static void eti_cursor_activated (ESelectionModel *selection, int row, int col, ETableItem *eti); +static void eti_selection_change (ESelectionModel *selection, ETableItem *eti); #if 0 static void eti_request_region_show (ETableItem *eti, int start_col, int start_row, @@ -352,7 +352,7 @@ eti_remove_table_model (ETableItem *eti) * Invoked to release the table model associated with this ETableItem */ static void -eti_remove_table_selection_model (ETableItem *eti) +eti_remove_selection_model (ETableItem *eti) { if (!eti->selection) return; @@ -841,7 +841,7 @@ eti_add_table_model (ETableItem *eti, ETableModel *table_model) } static void -eti_add_table_selection_model (ETableItem *eti, ETableSelectionModel *selection) +eti_add_selection_model (ETableItem *eti, ESelectionModel *selection) { g_assert (eti->selection == NULL); @@ -945,7 +945,7 @@ eti_destroy (GtkObject *object) eti_remove_header_model (eti); eti_remove_table_model (eti); - eti_remove_table_selection_model (eti); + eti_remove_selection_model (eti); if (eti->height_cache_idle_id) g_source_remove(eti->height_cache_idle_id); @@ -988,10 +988,10 @@ eti_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) eti_add_table_model (eti, E_TABLE_MODEL(GTK_VALUE_OBJECT (*arg))); break; - case ARG_TABLE_SELECTION_MODEL: - eti_remove_table_selection_model (eti); + case ARG_SELECTION_MODEL: + eti_remove_selection_model (eti); if (GTK_VALUE_OBJECT (*arg)) - eti_add_table_selection_model (eti, E_TABLE_SELECTION_MODEL(GTK_VALUE_OBJECT (*arg))); + eti_add_selection_model (eti, E_SELECTION_MODEL(GTK_VALUE_OBJECT (*arg))); break; case ARG_LENGTH_THRESHOLD: @@ -1703,7 +1703,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) if (cursor_row == view_to_model_row(eti, row) && cursor_col == view_to_model_col(eti, col)){ - if ((!eti_editing(eti)) && e_table_model_is_cell_editable(eti->selection->model, cursor_col, cursor_row)) { + if ((!eti_editing(eti)) && e_table_model_is_cell_editable(eti->table_model, col, row)) { e_table_item_enter_edit (eti, col, row); } @@ -1889,7 +1889,9 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) break; } - if (eti->cursor_mode != E_CURSOR_LINE && cursor_col != view_to_model_col(eti, 0)) + gtk_signal_emit (GTK_OBJECT (eti), eti_signals [KEY_PRESS], + model_to_view_row(eti, cursor_row), cursor_col, e, &return_val); + if ((!return_val) && eti->cursor_mode != E_CURSOR_LINE && cursor_col != view_to_model_col(eti, 0)) eti_cursor_move_left (eti); break; @@ -1899,7 +1901,9 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) break; } - if (eti->cursor_mode != E_CURSOR_LINE && cursor_col != view_to_model_col(eti, eti->cols - 1)) + gtk_signal_emit (GTK_OBJECT (eti), eti_signals [KEY_PRESS], + model_to_view_row(eti, cursor_row), cursor_col, e, &return_val); + if ((!return_val) && eti->cursor_mode != E_CURSOR_LINE && cursor_col != view_to_model_col(eti, eti->cols - 1)) eti_cursor_move_right (eti); break; @@ -1964,7 +1968,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) NULL); if (cursor_col >= 0 && cursor_row >= 0 && return_val && - (!eti_editing(eti)) && e_table_model_is_cell_editable(eti->selection->model, cursor_col, cursor_row)) { + (!eti_editing(eti)) && e_table_model_is_cell_editable(eti->table_model, model_to_view_col(eti, cursor_col), model_to_view_row(eti, cursor_row))) { e_table_item_enter_edit (eti, model_to_view_col(eti, cursor_col), model_to_view_row(eti, cursor_row)); } break; @@ -2002,7 +2006,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) gint col, row; row = model_to_view_row(eti, cursor_row); col = model_to_view_col(eti, cursor_col); - if (col != -1 && row != -1 && e_table_model_is_cell_editable(eti->selection->model, cursor_col, cursor_row)) { + if (col != -1 && row != -1 && e_table_model_is_cell_editable(eti->table_model, col, row)) { e_table_item_enter_edit (eti, col, row); } } @@ -2093,8 +2097,8 @@ eti_class_init (GtkObjectClass *object_class) GTK_ARG_WRITABLE, ARG_TABLE_HEADER); gtk_object_add_arg_type ("ETableItem::ETableModel", E_TABLE_MODEL_TYPE, GTK_ARG_WRITABLE, ARG_TABLE_MODEL); - gtk_object_add_arg_type ("ETableItem::table_selection_model", E_TABLE_SELECTION_MODEL_TYPE, - GTK_ARG_WRITABLE, ARG_TABLE_SELECTION_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::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, @@ -2249,7 +2253,7 @@ e_table_item_get_focused_column (ETableItem *eti) } static void -eti_cursor_change (ETableSelectionModel *selection, int row, int col, ETableItem *eti) +eti_cursor_change (ESelectionModel *selection, int row, int col, ETableItem *eti) { int view_row; int view_col; @@ -2281,7 +2285,7 @@ eti_cursor_change (ETableSelectionModel *selection, int row, int col, ETableItem } static void -eti_cursor_activated (ETableSelectionModel *selection, int row, int col, ETableItem *eti) +eti_cursor_activated (ESelectionModel *selection, int row, int col, ETableItem *eti) { int view_row; int view_col; @@ -2304,7 +2308,7 @@ eti_cursor_activated (ETableSelectionModel *selection, int row, int col, ETableI } static void -eti_selection_change (ETableSelectionModel *selection, ETableItem *eti) +eti_selection_change (ESelectionModel *selection, ETableItem *eti) { if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) return; diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h index 5e9ea2eb99..c5281b5185 100644 --- a/widgets/table/e-table-item.h +++ b/widgets/table/e-table-item.h @@ -5,9 +5,9 @@ #include <libgnomeui/gnome-canvas.h> #include <gal/e-table/e-table-model.h> #include <gal/e-table/e-table-header.h> -#include <gal/e-table/e-table-selection-model.h> #include <gal/e-table/e-table-defines.h> #include <gal/e-table/e-table-tooltip.h> +#include <gal/widgets/e-selection-model.h> #include <gal/widgets/e-printable.h> BEGIN_GNOME_DECLS @@ -24,7 +24,7 @@ typedef struct { ETableHeader *header; ETableModel *source_model; - ETableSelectionModel *selection; + ESelectionModel *selection; int x1, y1; int minimum_width, width, height; diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index a61ec0fea9..2dcd6e7c25 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -590,7 +590,7 @@ et_build_groups (ETable *et) "drawfocus", et->draw_focus, "cursor_mode", et->cursor_mode, "length_threshold", et->length_threshold, - "table_selection_model", et->selection, + "selection_model", et->selection, NULL); gtk_signal_connect (GTK_OBJECT (et->group), "cursor_change", diff --git a/widgets/table/e-tree-sorted.c b/widgets/table/e-tree-sorted.c index 1ebfbe7846..a5e5e751f5 100644 --- a/widgets/table/e-tree-sorted.c +++ b/widgets/table/e-tree-sorted.c @@ -1166,3 +1166,10 @@ e_tree_sorted_model_to_view_path (ETreeSorted *ets, return path; } +int +e_tree_sorted_orig_position (ETreeSorted *ets, + ETreePath path) +{ + ETreeSortedPath *sorted_path = path; + return sorted_path->orig_position; +} diff --git a/widgets/table/e-tree-sorted.h b/widgets/table/e-tree-sorted.h index 87094e89a6..3b81e2dcab 100644 --- a/widgets/table/e-tree-sorted.h +++ b/widgets/table/e-tree-sorted.h @@ -32,6 +32,7 @@ struct ETreeSortedClass { ETreeModelClass parent_class; }; + GtkType e_tree_sorted_get_type (void); void e_tree_sorted_construct (ETreeSorted *etree, ETreeModel *source, @@ -45,6 +46,8 @@ ETreePath e_tree_sorted_view_to_model_path (ETreeSorted *ets, ETreePath view_path); ETreePath e_tree_sorted_model_to_view_path (ETreeSorted *ets, ETreePath model_path); +int e_tree_sorted_orig_position (ETreeSorted *ets, + ETreePath path); #ifdef __cplusplus } diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index 5263271557..03a439ed2f 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -472,7 +472,7 @@ et_build_item (ETree *et) e_table_item_get_type(), "ETableHeader", et->header, "ETableModel", et->etta, - "table_selection_model", et->selection, + "selection_model", et->selection, "horizontal_draw_grid", et->horizontal_draw_grid, "vertical_draw_grid", et->vertical_draw_grid, "drawfocus", et->draw_focus, |