Commit 842bd708 authored by Daniel Elstner's avatar Daniel Elstner
Browse files

:expand_and_select): Replace the calls to TreeSelection::select() and

* src/filetree.cc (FileTree::expand_and_select): Replace the
calls to TreeSelection::select() and TreeView::scroll_to_row()
by a single TreeView::set_cursor() call.
(FileTree::find_files): After the tree has been filled in, the
first call to expand_and_select() doesn't always scroll to the
selected row (no matter if set_cursor() or scroll_to_row() is
used there).  Explicitely scroll to the first row after filling
the tree to work around this problem.
parent 2b354ed3
2004-06-01 Daniel Elstner <daniel.elstner@gmx.net>
* src/filetree.cc (FileTree::expand_and_select): Replace the
calls to TreeSelection::select() and TreeView::scroll_to_row()
by a single TreeView::set_cursor() call.
(FileTree::find_files): After the tree has been filled in, the
first call to expand_and_select() doesn't always scroll to the
selected row (no matter if set_cursor() or scroll_to_row() is
used there). Explicitely scroll to the first row after filling
the tree to work around this problem.
2004-06-01 Daniel Elstner <daniel.elstner@gmx.net>
* regexxer.desktop.in (Categories): Prepend GNOME to the list.
......
......@@ -155,6 +155,13 @@ void FileTree::find_files(const std::string& dirname, Pcre::Pattern& pattern,
find_data.error_list->push_back(error.what()); // collect errors but don't fail
}
// Work around a strange misbehavior: the tree is kept sorted while the
// file search is in progress, which causes the scroll offset to change
// slightly. This in turn confuses TreeView::set_cursor() -- the first
// call after the tree was completely filled just doesn't scroll.
if (toplevel_.file_count > 0)
scroll_to_row(Gtk::TreePath(1));
signal_bound_state_changed(); // emit
if (!find_data.error_list->empty())
......@@ -737,9 +744,7 @@ bool FileTree::prev_match_file(Gtk::TreeModel::iterator& iter,
void FileTree::expand_and_select(const Gtk::TreePath& path)
{
expand_to_path(path);
get_selection()->select(path);
scroll_to_row(path); // lazy scrolling implemented since GTK+ 2.1.4
set_cursor(path);
}
void FileTree::on_treestore_rows_reordered(const Gtk::TreeModel::Path& 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