aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-01-31 16:38:03 +0800
committerChris Lahey <clahey@src.gnome.org>2002-01-31 16:38:03 +0800
commit6d22aa7bd1818288f4428398d1268102f615c5c7 (patch)
tree9eb7fc1ba4a567d4184080e5b7f877d831261356 /widgets
parente2defdb06fc9bf7a73bb5ec0d4abcfd2c71a658d (diff)
downloadgsoc2013-evolution-6d22aa7bd1818288f4428398d1268102f615c5c7.tar
gsoc2013-evolution-6d22aa7bd1818288f4428398d1268102f615c5c7.tar.gz
gsoc2013-evolution-6d22aa7bd1818288f4428398d1268102f615c5c7.tar.bz2
gsoc2013-evolution-6d22aa7bd1818288f4428398d1268102f615c5c7.tar.lz
gsoc2013-evolution-6d22aa7bd1818288f4428398d1268102f615c5c7.tar.xz
gsoc2013-evolution-6d22aa7bd1818288f4428398d1268102f615c5c7.tar.zst
gsoc2013-evolution-6d22aa7bd1818288f4428398d1268102f615c5c7.zip
Added this simple accessor function.
2002-01-31 Christopher James Lahey <clahey@ximian.com> * e-tree-selection-model.c, e-tree-selection-model.h (e_tree_selection_model_get_cursor): Added this simple accessor function. * e-tree.c, e-tree.h (e_tree_find_next): Searches from the cursor given the search parameters and moves the cursor if it ever matches. svn path=/trunk/; revision=15537
Diffstat (limited to 'widgets')
-rw-r--r--widgets/table/e-tree-selection-model.c6
-rw-r--r--widgets/table/e-tree-selection-model.h1
-rw-r--r--widgets/table/e-tree.c36
-rw-r--r--widgets/table/e-tree.h6
4 files changed, 49 insertions, 0 deletions
diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c
index 04e74c0f96..49835f847a 100644
--- a/widgets/table/e-tree-selection-model.c
+++ b/widgets/table/e-tree-selection-model.c
@@ -1294,6 +1294,12 @@ e_tree_selection_model_change_cursor (ETreeSelectionModel *etsm, ETreePath path)
e_selection_model_cursor_activated(E_SELECTION_MODEL(etsm), row, etsm->priv->cursor_col);
}
+ETreePath
+e_tree_selection_model_get_cursor (ETreeSelectionModel *etsm)
+{
+ return etsm->priv->cursor_path;
+}
+
static void
e_tree_selection_model_init (ETreeSelectionModel *etsm)
diff --git a/widgets/table/e-tree-selection-model.h b/widgets/table/e-tree-selection-model.h
index f71c0afc35..ef396c237c 100644
--- a/widgets/table/e-tree-selection-model.h
+++ b/widgets/table/e-tree-selection-model.h
@@ -67,6 +67,7 @@ void e_tree_selection_model_add_to_selection (ETreeSelectionModel
ETreePath path);
void e_tree_selection_model_change_cursor (ETreeSelectionModel *etsm,
ETreePath path);
+ETreePath e_tree_selection_model_get_cursor (ETreeSelectionModel *etsm);
#ifdef __cplusplus
}
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
index 4e1154f44f..d50eef2b3b 100644
--- a/widgets/table/e-tree.c
+++ b/widgets/table/e-tree.c
@@ -1408,6 +1408,9 @@ e_tree_set_cursor (ETree *e_tree, ETreePath path)
ETreePath
e_tree_get_cursor (ETree *e_tree)
{
+#ifdef E_TREE_USE_TREE_SELECTION
+ return e_tree_selection_model_get_cursor (E_TREE_SELECTION_MODEL(e_tree->priv->selection));
+#else
int row;
ETreePath path;
g_return_val_if_fail(e_tree != NULL, NULL);
@@ -1421,6 +1424,7 @@ e_tree_get_cursor (ETree *e_tree)
path = e_tree_table_adapter_node_at_row(E_TREE_TABLE_ADAPTER(e_tree->priv->etta), row);
path = e_tree_sorted_view_to_model_path(e_tree->priv->sorted, path);
return path;
+#endif
}
void
@@ -1733,6 +1737,38 @@ e_tree_get_tooltip (ETree *et)
return E_CANVAS(et->priv->table_canvas)->tooltip_window;
}
+gboolean
+e_tree_find_next (ETree *et, gboolean forward_direction, gboolean wrap, ETreePathFunc func, gpointer data)
+{
+ ETreePath cursor;
+ ETreePath found;
+
+ cursor = e_tree_get_cursor (et);
+ cursor = e_tree_sorted_model_to_view_path (et->priv->sorted, cursor);
+
+ found = e_tree_model_node_find (E_TREE_MODEL (et->priv->sorted), cursor, NULL, forward_direction, func, data);
+
+ if (found) {
+ e_tree_table_adapter_show_node (et->priv->etta, found);
+ cursor = e_tree_sorted_view_to_model_path (et->priv->sorted, found);
+ e_tree_set_cursor (et, cursor);
+ return TRUE;
+ }
+
+ if (wrap) {
+ found = e_tree_model_node_find (E_TREE_MODEL (et->priv->sorted), NULL, cursor, forward_direction, func, data);
+
+ if (found && found != cursor) {
+ e_tree_table_adapter_show_node (et->priv->etta, found);
+ cursor = e_tree_sorted_view_to_model_path (et->priv->sorted, found);
+ e_tree_set_cursor (et, cursor);
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
void
e_tree_right_click_up (ETree *et)
{
diff --git a/widgets/table/e-tree.h b/widgets/table/e-tree.h
index ccd899ece4..f42e22eb87 100644
--- a/widgets/table/e-tree.h
+++ b/widgets/table/e-tree.h
@@ -281,10 +281,16 @@ void e_tree_load_expanded_state (ETree *et,
char *filename);
int e_tree_row_count (ETree *et);
GtkWidget *e_tree_get_tooltip (ETree *et);
+gboolean e_tree_find_next (ETree *et,
+ gboolean forward_direction,
+ gboolean wrap,
+ ETreePathFunc func,
+ gpointer data);
/* This function is only needed in single_selection_mode. */
void e_tree_right_click_up (ETree *et);
+
END_GNOME_DECLS
#endif /* _E_TREE_H_ */