aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-tree.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-02-01 04:23:00 +0800
committerChris Lahey <clahey@src.gnome.org>2002-02-01 04:23:00 +0800
commita3bd2634b10cbeaa0dd82cdb37c9007476977050 (patch)
tree5a55e4d3945578c19e5483c9aa9c4cd8a9491d83 /widgets/table/e-tree.c
parent81762a26a3409b65c1d7a45e024eaba88242f103 (diff)
downloadgsoc2013-evolution-a3bd2634b10cbeaa0dd82cdb37c9007476977050.tar.gz
gsoc2013-evolution-a3bd2634b10cbeaa0dd82cdb37c9007476977050.tar.zst
gsoc2013-evolution-a3bd2634b10cbeaa0dd82cdb37c9007476977050.zip
Made this function much more readable. Got rid of all the gotos. Fixed a
2002-01-31 Christopher James Lahey <clahey@ximian.com> * e-tree-model.c (e_tree_model_node_find): Made this function much more readable. Got rid of all the gotos. Fixed a case where going backwards during a root search checked the root node first. (e_tree_model_node_real_traverse): Made backwards traversals be postorder, as they should be, instead of preorder. * e-tree.c (find_next_callback): Use an extra callback function here to go from sorted path to model path. svn path=/trunk/; revision=15543
Diffstat (limited to 'widgets/table/e-tree.c')
-rw-r--r--widgets/table/e-tree.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
index 26a6751b75..0796e1bb25 100644
--- a/widgets/table/e-tree.c
+++ b/widgets/table/e-tree.c
@@ -1737,16 +1737,38 @@ e_tree_get_tooltip (ETree *et)
return E_CANVAS(et->priv->table_canvas)->tooltip_window;
}
+typedef struct {
+ ETreePathFunc func;
+ gpointer data;
+ ETree *et;
+} FindNextCallback;
+
+static gboolean
+find_next_callback (ETreeModel *model, ETreePath path, gpointer data)
+{
+ FindNextCallback *cb_data = data;
+ ETree *et = cb_data->et;
+
+ path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
+
+ return cb_data->func (et->priv->model, path, cb_data->data);
+}
+
gboolean
e_tree_find_next (ETree *et, ETreeFindNextParams params, ETreePathFunc func, gpointer data)
{
ETreePath cursor;
ETreePath found;
+ FindNextCallback cb_data;
+
+ cb_data.func = func;
+ cb_data.data = data;
+ cb_data.et = et;
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, params & E_TREE_FIND_NEXT_FORWARD, func, data);
+ found = e_tree_model_node_find (E_TREE_MODEL (et->priv->sorted), cursor, NULL, params & E_TREE_FIND_NEXT_FORWARD, find_next_callback, &cb_data);
if (found) {
e_tree_table_adapter_show_node (et->priv->etta, found);
@@ -1756,7 +1778,7 @@ e_tree_find_next (ETree *et, ETreeFindNextParams params, ETreePathFunc func, gpo
}
if (params & E_TREE_FIND_NEXT_WRAP) {
- found = e_tree_model_node_find (E_TREE_MODEL (et->priv->sorted), NULL, cursor, params & E_TREE_FIND_NEXT_FORWARD, func, data);
+ found = e_tree_model_node_find (E_TREE_MODEL (et->priv->sorted), NULL, cursor, params & E_TREE_FIND_NEXT_FORWARD, find_next_callback, &cb_data);
if (found && found != cursor) {
e_tree_table_adapter_show_node (et->priv->etta, found);