Commit 42393d3d authored by Daniel Elstner's avatar Daniel Elstner
Browse files

:prev_match_file): As it turns out keeping track of the parent iterator

* src/filetree.cc (FileTree::prev_match_file): As it turns out
keeping track of the parent iterator does have some merit.  While
there was nothing wrong with the previous change, I discovered
that the parent's children can be indexed in order to obtain an
iterator pointing to the previous row.  At least for deep trees
this is likely to be faster than resolving the whole path via
Gtk::TreeModel::get_iter().
parent 2a02038b
2004-06-01 Daniel Elstner <daniel.elstner@gmx.net>
* src/filetree.cc (FileTree::prev_match_file): As it turns out
keeping track of the parent iterator does have some merit. While
there was nothing wrong with the previous change, I discovered
that the parent's children can be indexed in order to obtain an
iterator pointing to the previous row. At least for deep trees
this is likely to be faster than resolving the whole path via
Gtk::TreeModel::get_iter().
2004-06-01 Daniel Elstner <daniel.elstner@gmx.net>
* src/filetree.cc (FileTree::prev_match_file): There is no need to
......
......@@ -698,18 +698,20 @@ bool FileTree::prev_match_file(Gtk::TreeModel::iterator& iter,
g_return_val_if_fail(iter, false);
const FileTreeColumns& columns = FileTreeColumns::instance();
Gtk::TreeModel::iterator parent = iter->parent();
Gtk::TreePath path (iter);
for (;;)
{
if (path.prev())
{
iter = treestore_->get_iter(path);
iter = parent->children()[path.back()];
if ((*iter)[columns.matchcount] > 0)
{
if (const Gtk::TreeModel::Children& children = iter->children()) // directory?
{
parent = iter;
path.push_back(children.size());
continue;
}
......@@ -717,8 +719,9 @@ bool FileTree::prev_match_file(Gtk::TreeModel::iterator& iter,
return true;
}
}
else if (path.size() > 1)
else if (parent)
{
parent = parent->parent();
path.up();
if (collapse_stack && row_expanded(path))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment