diff options
author | Christopher James Lahey <clahey@ximian.com> | 2002-01-31 16:38:03 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2002-01-31 16:38:03 +0800 |
commit | 6d22aa7bd1818288f4428398d1268102f615c5c7 (patch) | |
tree | 9eb7fc1ba4a567d4184080e5b7f877d831261356 /widgets/table/e-tree.c | |
parent | e2defdb06fc9bf7a73bb5ec0d4abcfd2c71a658d (diff) | |
download | gsoc2013-evolution-6d22aa7bd1818288f4428398d1268102f615c5c7.tar.gz 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/table/e-tree.c')
-rw-r--r-- | widgets/table/e-tree.c | 36 |
1 files changed, 36 insertions, 0 deletions
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) { |