Commit 11de3d52 authored by Daniel Elstner's avatar Daniel Elstner

[ merge from HEAD ]

* src/filetree.{cc,h} (FileTree::on_treestore_rows_reordered):
New signal handler which updates the match boundaries defined by
the [path_match_first_, path_match_last_] range.  Previously this
has been handled in on_treestore_sort_column_changed(), which is
unfortunately called before the actual sorting takes place.
(FileTree::on_treestore_sort_column_changed): Remove.
(FileTree::FileTree): Connect to signal_rows_reordered() instead
of signal_sort_column_changed().
parent 662d206e
2004-06-01 Daniel Elstner <daniel.elstner@gmx.net>
[ merge from HEAD ]
* src/filetree.{cc,h} (FileTree::on_treestore_rows_reordered):
New signal handler which updates the match boundaries defined by
the [path_match_first_, path_match_last_] range. Previously this
has been handled in on_treestore_sort_column_changed(), which is
unfortunately called before the actual sorting takes place.
(FileTree::on_treestore_sort_column_changed): Remove.
(FileTree::FileTree): Connect to signal_rows_reordered() instead
of signal_sort_column_changed().
2004-05-30 Daniel Elstner <daniel.elstner@gmx.net>
[ merge from HEAD ]
......
......@@ -53,8 +53,8 @@ FileTree::FileTree()
treestore_->set_sort_func(model_columns.collatekey, &collatekey_sort_func);
treestore_->set_sort_column_id(TreeStore::DEFAULT_SORT_COLUMN_ID, SORT_ASCENDING);
treestore_->signal_sort_column_changed().connect(
SigC::slot(*this, &FileTree::on_treestore_sort_column_changed));
treestore_->signal_rows_reordered().connect(
SigC::slot(*this, &FileTree::on_treestore_rows_reordered));
{
Column *const column = new Column(_("File"));
......@@ -720,38 +720,50 @@ void FileTree::expand_and_select(const Gtk::TreePath& path)
scroll_to_row(path); // lazy scrolling implemented since GTK+ 2.1.4
}
void FileTree::on_treestore_sort_column_changed()
void FileTree::on_treestore_rows_reordered(const Gtk::TreeModel::Path& path,
const Gtk::TreeModel::iterator& iter, int*)
{
const FileTreeColumns& columns = filetree_columns();
if (sum_matches_ > 0)
{
Gtk::TreeModel::iterator first = treestore_->children().begin();
const FileTreeColumns& columns = filetree_columns();
bool bounds_changed = false;
while (first->children() && (*first)[columns.matchcount] > 0)
first = first->children().begin();
if ((*first)[columns.matchcount] == 0)
if (path.is_ancestor(path_match_first_))
{
const bool found_first = next_match_file(first);
g_return_if_fail(found_first);
}
Gtk::TreeModel::iterator first = iter->children().begin();
Gtk::TreeModel::iterator last = treestore_->children()[treestore_->children().size() - 1];
while (first->children() && (*first)[columns.matchcount] > 0)
first = first->children().begin();
while (last->children() && (*last)[columns.matchcount] > 0)
last = last->children()[last->children().size() - 1];
if ((*first)[columns.matchcount] == 0)
{
const bool found_first = next_match_file(first);
g_return_if_fail(found_first);
}
if ((*last)[columns.matchcount] == 0)
{
const bool found_last = prev_match_file(last);
g_return_if_fail(found_last);
path_match_first_ = first;
bounds_changed = true;
}
path_match_first_ = first;
path_match_last_ = last;
if (path.is_ancestor(path_match_last_))
{
Gtk::TreeModel::iterator last = iter->children()[iter->children().size() - 1];
signal_bound_state_changed(); // emit
while (last->children() && (*last)[columns.matchcount] > 0)
last = last->children()[last->children().size() - 1];
if ((*last)[columns.matchcount] == 0)
{
const bool found_last = prev_match_file(last);
g_return_if_fail(found_last);
}
path_match_last_ = last;
bounds_changed = true;
}
if (bounds_changed)
signal_bound_state_changed(); // emit
}
}
......
......@@ -139,7 +139,8 @@ private:
void expand_and_select(const Gtk::TreePath& path);
void on_treestore_sort_column_changed();
void on_treestore_rows_reordered(const Gtk::TreeModel::Path& path,
const Gtk::TreeModel::iterator& iter, int* order);
void on_selection_changed();
void on_buffer_match_count_changed();
void on_buffer_modified_changed();
......
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