aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-table.c35
-rw-r--r--widgets/table/e-table.h5
2 files changed, 40 insertions, 0 deletions
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index c6fffffd3d..c56d4ff931 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -925,6 +925,41 @@ set_scroll_adjustments (ETable *table,
hadjustment);
}
+gint
+e_table_get_next_row_sorted (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)) {
+ i++;
+ return e_table_sorter_sorted_to_model(e_table->sorter, model_row);
+ } else
+ return -1;
+ } else
+ if (model_row < e_table_model_row_count(e_table->model))
+ return model_row + 1;
+ else
+ return -1;
+}
+
+gint
+e_table_get_prev_row_sorted (ETable *e_table,
+ gint model_row)
+{
+ if (e_table->sorter) {
+ int i;
+ i = e_table_sorter_model_to_sorted(e_table->sorter, model_row);
+ i--;
+ if (i >= 0)
+ return e_table_sorter_sorted_to_model(e_table->sorter, model_row);
+ else
+ return -1;
+ } else
+ return model_row - 1;
+}
+
struct _ETableDragSourceSite
{
GdkModifierType start_button_mask;
diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h
index a418a284a6..b0e3cd174a 100644
--- a/widgets/table/e-table.h
+++ b/widgets/table/e-table.h
@@ -182,6 +182,11 @@ void e_table_selected_row_foreach (ETable *e_table,
gpointer closure);
EPrintable *e_table_get_printable (ETable *e_table);
+gint e_table_get_next_row_sorted (ETable *e_table,
+ gint model_row);
+gint e_table_get_prev_row_sorted (ETable *e_table,
+ gint model_row);
+
/* Drag & drop stuff. */
/* Target */