aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-08-06 07:00:41 +0800
committerChris Lahey <clahey@src.gnome.org>2000-08-06 07:00:41 +0800
commitc115cff69df04b7580fd8a50e087c7bd53614cec (patch)
tree2cd51ac2167577ed803dc4b6b4aea4a79c041b88 /widgets/table/e-table.c
parent089f42f8dd81428b578939f385eb143254a83644 (diff)
downloadgsoc2013-evolution-c115cff69df04b7580fd8a50e087c7bd53614cec.tar
gsoc2013-evolution-c115cff69df04b7580fd8a50e087c7bd53614cec.tar.gz
gsoc2013-evolution-c115cff69df04b7580fd8a50e087c7bd53614cec.tar.bz2
gsoc2013-evolution-c115cff69df04b7580fd8a50e087c7bd53614cec.tar.lz
gsoc2013-evolution-c115cff69df04b7580fd8a50e087c7bd53614cec.tar.xz
gsoc2013-evolution-c115cff69df04b7580fd8a50e087c7bd53614cec.tar.zst
gsoc2013-evolution-c115cff69df04b7580fd8a50e087c7bd53614cec.zip
Added functions to convert from view row to model row or from model row to
2000-08-05 Christopher James Lahey <clahey@helixcode.com> * e-table.c, e-table.h: Added functions to convert from view row to model row or from model row to view row. Also changed e_table_set_cursor_row and e_table_get_cursor_row to take a model row as this works better with the rest of the model. Changed the name of e_table_get_next_row_sorted and e_table_get_prev_row_sorted. (Dropped the _sorted.) svn path=/trunk/; revision=4556
Diffstat (limited to 'widgets/table/e-table.c')
-rw-r--r--widgets/table/e-table.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index d9cbbc4779..ca26678607 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -803,13 +803,17 @@ e_table_save_specification (ETable *e_table, gchar *filename)
void
e_table_set_cursor_row (ETable *e_table, int row)
{
- e_table_group_set_cursor_row(e_table->group, row);
+ row = e_table_sorter_model_to_sorted(e_table->sorter, row);
+ if (row != -1)
+ e_table_group_set_cursor_row(e_table->group, row);
}
int
e_table_get_cursor_row (ETable *e_table)
{
- return e_table_group_get_cursor_row(e_table->group);
+ int row = e_table_group_get_cursor_row(e_table->group);
+ row = e_table_sorter_sorted_to_model(e_table->sorter, row);
+ return row;
}
void
@@ -926,27 +930,27 @@ set_scroll_adjustments (ETable *table,
}
gint
-e_table_get_next_row_sorted (ETable *e_table,
- gint model_row)
+e_table_get_next_row (ETable *e_table,
+ gint model_row)
{
if (e_table->sorter) {
int i;
i = e_table_sorter_model_to_sorted(e_table->sorter, model_row);
- if (i < e_table_model_row_count(e_table->model) - 1) {
- i++;
+ i++;
+ if (i < e_table_model_row_count(e_table->model)) {
return e_table_sorter_sorted_to_model(e_table->sorter, i);
} else
return -1;
} else
- if (model_row < e_table_model_row_count(e_table->model))
+ if (model_row < e_table_model_row_count(e_table->model) - 1)
return model_row + 1;
else
return -1;
}
gint
-e_table_get_prev_row_sorted (ETable *e_table,
- gint model_row)
+e_table_get_prev_row (ETable *e_table,
+ gint model_row)
{
if (e_table->sorter) {
int i;
@@ -960,6 +964,26 @@ e_table_get_prev_row_sorted (ETable *e_table,
return model_row - 1;
}
+gint
+e_table_model_to_view_row (ETable *e_table,
+ gint model_row)
+{
+ if (e_table->sorter)
+ return e_table_sorter_model_to_sorted(e_table->sorter, model_row);
+ else
+ return model_row;
+}
+
+gint
+e_table_view_to_model_row (ETable *e_table,
+ gint view_row)
+{
+ if (e_table->sorter)
+ return e_table_sorter_sorted_to_model(e_table->sorter, view_row);
+ else
+ return view_row;
+}
+
struct _ETableDragSourceSite
{
GdkModifierType start_button_mask;