aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorMike Kestner <mkestner@ximian.com>2003-02-13 04:26:15 +0800
committerMike Kestner <mkestner@src.gnome.org>2003-02-13 04:26:15 +0800
commit1ebf9b6fd1996bdec796414f551839542b3dd323 (patch)
tree0a46a8ffa4acbe5521252a6483226f78902fe0e1 /widgets
parent8fea59137c050e70515e590fef16f9457ef278f5 (diff)
downloadgsoc2013-evolution-1ebf9b6fd1996bdec796414f551839542b3dd323.tar
gsoc2013-evolution-1ebf9b6fd1996bdec796414f551839542b3dd323.tar.gz
gsoc2013-evolution-1ebf9b6fd1996bdec796414f551839542b3dd323.tar.bz2
gsoc2013-evolution-1ebf9b6fd1996bdec796414f551839542b3dd323.tar.lz
gsoc2013-evolution-1ebf9b6fd1996bdec796414f551839542b3dd323.tar.xz
gsoc2013-evolution-1ebf9b6fd1996bdec796414f551839542b3dd323.tar.zst
gsoc2013-evolution-1ebf9b6fd1996bdec796414f551839542b3dd323.zip
handle reverse searches (find_prev_in_range): reverse search impl
2003-02-12 Mike Kestner <mkestner@ximian.com> * e-tree.c (e_tree_find_next): handle reverse searches (find_prev_in_range): reverse search impl (et_real_construct): kill warnings svn path=/trunk/; revision=19897
Diffstat (limited to 'widgets')
-rw-r--r--widgets/table/e-tree.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
index 318564e42b..a0432b8f68 100644
--- a/widgets/table/e-tree.c
+++ b/widgets/table/e-tree.c
@@ -1362,7 +1362,6 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete,
ETableSpecification *specification, ETableState *state)
{
int row = 0;
- int i, col_count;
if (ete)
g_object_ref(ete);
@@ -2048,6 +2047,21 @@ find_next_in_range (ETree *et, gint start, gint end, ETreePathFunc func, gpointe
return NULL;
}
+static ETreePath
+find_prev_in_range (ETree *et, gint start, gint end, ETreePathFunc func, gpointer data)
+{
+ ETreePath path;
+ gint row;
+
+ for (row = start; row >= end; row--) {
+ path = e_tree_table_adapter_node_at_row (et->priv->etta, row);
+ if (func (et->priv->model, path, data))
+ return path;
+ }
+
+ return NULL;
+}
+
gboolean
e_tree_find_next (ETree *et, ETreeFindNextParams params, ETreePathFunc func, gpointer data)
{
@@ -2060,7 +2074,10 @@ e_tree_find_next (ETree *et, ETreeFindNextParams params, ETreePathFunc func, gpo
if (row == -1)
row = 0;
- found = find_next_in_range (et, row + 1, row_count - 1, func, data);
+ if (params & E_TREE_FIND_NEXT_FORWARD)
+ found = find_next_in_range (et, row + 1, row_count - 1, func, data);
+ else
+ found = find_prev_in_range (et, row - 1, 0, func, data);
if (found) {
e_tree_table_adapter_show_node (et->priv->etta, found);
@@ -2068,8 +2085,11 @@ e_tree_find_next (ETree *et, ETreeFindNextParams params, ETreePathFunc func, gpo
return TRUE;
}
- if ((params & E_TREE_FIND_NEXT_WRAP) && (row > 0)) {
- found = find_next_in_range (et, 0, row, func, data);
+ if (params & E_TREE_FIND_NEXT_WRAP) {
+ if (params & E_TREE_FIND_NEXT_FORWARD)
+ found = find_next_in_range (et, 0, row, func, data);
+ else
+ found = find_prev_in_range (et, row_count - 1, row, func, data);
if (found && found != cursor) {
e_tree_table_adapter_show_node (et->priv->etta, found);