aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widgets/e-table/ChangeLog5
-rw-r--r--widgets/e-table/e-table.c35
-rw-r--r--widgets/e-table/e-table.h5
-rw-r--r--widgets/table/e-table.c35
-rw-r--r--widgets/table/e-table.h5
5 files changed, 85 insertions, 0 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 8d404f0757..90230e3ceb 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,5 +1,10 @@
2000-08-05 Christopher James Lahey <clahey@helixcode.com>
+ * e-table.c: Added a function to get the next row with sorting
+ taken into account.
+
+2000-08-05 Christopher James Lahey <clahey@helixcode.com>
+
* e-table-sorter.c: Made it so that selection ranges work even if
the table is using grouping.
diff --git a/widgets/e-table/e-table.c b/widgets/e-table/e-table.c
index c6fffffd3d..c56d4ff931 100644
--- a/widgets/e-table/e-table.c
+++ b/widgets/e-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/e-table/e-table.h b/widgets/e-table/e-table.h
index a418a284a6..b0e3cd174a 100644
--- a/widgets/e-table/e-table.h
+++ b/widgets/e-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 */
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 */