aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-08-05 21:21:39 +0800
committerChris Lahey <clahey@src.gnome.org>2000-08-05 21:21:39 +0800
commit93460327277096268eed463400a11f7843cb518d (patch)
tree26df6aa29e970974f9433a7c89d961d8b60ea9eb
parentcab78cd062fbf93003014bc1d5825a24897b3106 (diff)
downloadgsoc2013-evolution-93460327277096268eed463400a11f7843cb518d.tar
gsoc2013-evolution-93460327277096268eed463400a11f7843cb518d.tar.gz
gsoc2013-evolution-93460327277096268eed463400a11f7843cb518d.tar.bz2
gsoc2013-evolution-93460327277096268eed463400a11f7843cb518d.tar.lz
gsoc2013-evolution-93460327277096268eed463400a11f7843cb518d.tar.xz
gsoc2013-evolution-93460327277096268eed463400a11f7843cb518d.tar.zst
gsoc2013-evolution-93460327277096268eed463400a11f7843cb518d.zip
Added a function to get the next row with sorting taken into account.
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. svn path=/trunk/; revision=4549
-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 */