diff options
-rw-r--r-- | widgets/table/e-table-group-container.c | 34 | ||||
-rw-r--r-- | widgets/table/e-table-group-leaf.c | 24 | ||||
-rw-r--r-- | widgets/table/e-table-group.c | 25 | ||||
-rw-r--r-- | widgets/table/e-table-group.h | 5 | ||||
-rw-r--r-- | widgets/table/e-table.c | 11 |
5 files changed, 6 insertions, 93 deletions
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index 66eff91b85..5e2b86c800 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -500,38 +500,6 @@ etgc_decrement (ETableGroup *etg, gint position, gint amount) } static void -etgc_set_cursor_row (ETableGroup *etg, gint row) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - GList *list; - for (list = etgc->children; list; list = g_list_next(list)) { - ETableGroup *group = ((ETableGroupContainerChildNode *)list->data)->child; - gint this_count = e_table_group_row_count(group); - if (row < this_count) { - e_table_group_set_cursor_row(group, row); - return; - } - row -= this_count; - } -} - -static int -etgc_get_cursor_row (ETableGroup *etg) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - GList *list; - int count = 0; - for (list = etgc->children; list; list = g_list_next(list)) { - ETableGroup *group = ((ETableGroupContainerChildNode *)list->data)->child; - int row = e_table_group_get_cursor_row(group); - if (row != -1) - return count + row; - count += e_table_group_row_count(group); - } - return -1; -} - -static void etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col) { ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); @@ -726,8 +694,6 @@ etgc_class_init (GtkObjectClass *object_class) e_group_class->decrement = etgc_decrement; e_group_class->row_count = etgc_row_count; e_group_class->set_focus = etgc_set_focus; - e_group_class->set_cursor_row = etgc_set_cursor_row; - 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->compute_location = etgc_compute_location; diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c index 2a21f167d6..81add818d2 100644 --- a/widgets/table/e-table-group-leaf.c +++ b/widgets/table/e-table-group-leaf.c @@ -223,28 +223,6 @@ etgl_set_focus (ETableGroup *etg, EFocus direction, gint view_col) } } -static void -etgl_set_cursor_row (ETableGroup *etg, gint row) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - - if (etgl->item != NULL) - gnome_canvas_item_set(GNOME_CANVAS_ITEM(etgl->item), - "cursor_row", row, - NULL); -} - -static int -etgl_get_cursor_row (ETableGroup *etg) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - int row; - gtk_object_get(GTK_OBJECT(etgl->item), - "cursor_row", &row, - NULL); - return row; -} - static gint etgl_get_focus_column (ETableGroup *etg) { @@ -386,8 +364,6 @@ etgl_class_init (GtkObjectClass *object_class) e_group_class->decrement = etgl_decrement; e_group_class->row_count = etgl_row_count; e_group_class->set_focus = etgl_set_focus; - e_group_class->set_cursor_row = etgl_set_cursor_row; - 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->compute_location = etgl_compute_location; diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c index c1eee7322c..664e8ec3fc 100644 --- a/widgets/table/e-table-group.c +++ b/widgets/table/e-table-group.c @@ -180,29 +180,6 @@ e_table_group_set_focus (ETableGroup *etg, ETG_CLASS (etg)->set_focus (etg, direction, row); } -void -e_table_group_set_cursor_row (ETableGroup *etg, - gint row) -{ - g_return_if_fail (etg != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - - if (ETG_CLASS (etg)->set_cursor_row) - ETG_CLASS (etg)->set_cursor_row (etg, row); -} - -int -e_table_group_get_cursor_row (ETableGroup *etg) -{ - g_return_val_if_fail (etg != NULL, -1); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), -1); - - if (ETG_CLASS (etg)->get_cursor_row) - return ETG_CLASS (etg)->get_cursor_row (etg); - else - return -1; -} - gboolean e_table_group_get_focus (ETableGroup *etg) { @@ -390,8 +367,6 @@ etg_class_init (GtkObjectClass *object_class) klass->increment = NULL; klass->decrement = NULL; klass->set_focus = NULL; - klass->set_cursor_row = NULL; - klass->get_cursor_row = NULL; klass->get_focus = etg_get_focus; klass->get_ecol = NULL; klass->get_printable = NULL; diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h index 1791d08aee..06775c9b2d 100644 --- a/widgets/table/e-table-group.h +++ b/widgets/table/e-table-group.h @@ -60,8 +60,6 @@ typedef struct { void (*increment) (ETableGroup *etg, gint position, gint amount); void (*decrement) (ETableGroup *etg, gint position, gint amount); void (*set_focus) (ETableGroup *etg, EFocus direction, gint view_col); - void (*set_cursor_row) (ETableGroup *etg, gint row); - int (*get_cursor_row) (ETableGroup *etg); gboolean (*get_focus) (ETableGroup *etg); gint (*get_focus_column) (ETableGroup *etg); ETableCol *(*get_ecol) (ETableGroup *etg); @@ -87,9 +85,6 @@ gint e_table_group_row_count (ETableGroup *etg); void e_table_group_set_focus (ETableGroup *etg, EFocus direction, gint view_col); -void e_table_group_set_cursor_row (ETableGroup *etg, - gint row); -int e_table_group_get_cursor_row (ETableGroup *etg); gboolean e_table_group_get_focus (ETableGroup *etg); gint e_table_group_get_focus_column (ETableGroup *etg); ETableHeader *e_table_group_get_header (ETableGroup *etg); diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index dbf301994b..12a23bfdd7 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -1203,9 +1203,9 @@ e_table_set_cursor_row (ETable *e_table, int row) g_return_if_fail(E_IS_TABLE(e_table)); g_return_if_fail(row >= 0); - row = e_table_sorter_model_to_sorted(e_table->sorter, row); - if (row != -1) - e_table_group_set_cursor_row(e_table->group, row); + gtk_object_set(GTK_OBJECT(e_table->selection), + "cursor_row", row, + NULL); } int @@ -1215,8 +1215,9 @@ e_table_get_cursor_row (ETable *e_table) g_return_val_if_fail(e_table != NULL, -1); g_return_val_if_fail(E_IS_TABLE(e_table), -1); - row = e_table_group_get_cursor_row(e_table->group); - row = e_table_sorter_sorted_to_model(e_table->sorter, row); + gtk_object_get(GTK_OBJECT(e_table->selection), + "cursor_row", &row, + NULL); return row; } |