lib: TreeIter cleanups
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
ad584900fa
commit
cba07b5957
|
@ -25,6 +25,11 @@ void QueueModel::increment_stamp()
|
||||||
} while (stamp == 0);
|
} while (stamp == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QueueModel::check_iter_validity(const Gtk::TreeIter &iter) const
|
||||||
|
{
|
||||||
|
return stamp == iter.get_stamp();
|
||||||
|
}
|
||||||
|
|
||||||
void QueueModel::on_row_inserted(unsigned int row)
|
void QueueModel::on_row_inserted(unsigned int row)
|
||||||
{
|
{
|
||||||
Gtk::TreePath path;
|
Gtk::TreePath path;
|
||||||
|
@ -143,13 +148,12 @@ void QueueModel::get_value_vfunc(const Gtk::TreeIter &iter, int column,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QueueModel::iter_next_vfunc(const Gtk::TreeIter &iter,
|
bool QueueModel::iter_next_vfunc(const Gtk::TreeIter &iter,
|
||||||
Gtk::TreeIter &iter_next) const
|
Gtk::TreeIter &next) const
|
||||||
{
|
{
|
||||||
if (!check_iter_validity(iter)) {
|
next = Gtk::TreeIter();
|
||||||
iter_next = Gtk::TreeIter();
|
if (check_iter_validity(iter))
|
||||||
return false;
|
return iter_nth_root_child_vfunc(iter_to_id(iter) + 1, next);
|
||||||
}
|
return false;
|
||||||
return iter_nth_root_child_vfunc(iter_to_id(iter) + 1, iter_next);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int QueueModel::iter_n_root_children_vfunc() const
|
int QueueModel::iter_n_root_children_vfunc() const
|
||||||
|
@ -171,7 +175,6 @@ bool QueueModel::iter_nth_root_child_vfunc(int n, Gtk::TreeIter &iter) const
|
||||||
Gtk::TreeModel::Path QueueModel::get_path_vfunc(const Gtk::TreeIter &iter) const
|
Gtk::TreeModel::Path QueueModel::get_path_vfunc(const Gtk::TreeIter &iter) const
|
||||||
{
|
{
|
||||||
Gtk::TreeModel::Path path;
|
Gtk::TreeModel::Path path;
|
||||||
|
|
||||||
if (check_iter_validity(iter))
|
if (check_iter_validity(iter))
|
||||||
path.push_back(iter_to_id(iter));
|
path.push_back(iter_to_id(iter));
|
||||||
return path;
|
return path;
|
||||||
|
@ -180,14 +183,8 @@ Gtk::TreeModel::Path QueueModel::get_path_vfunc(const Gtk::TreeIter &iter) const
|
||||||
bool QueueModel::get_iter_vfunc(const Gtk::TreePath &path,
|
bool QueueModel::get_iter_vfunc(const Gtk::TreePath &path,
|
||||||
Gtk::TreeIter &iter) const
|
Gtk::TreeIter &iter) const
|
||||||
{
|
{
|
||||||
if (path.size() != 1) {
|
iter = Gtk::TreeIter();
|
||||||
iter = Gtk::TreeIter();
|
if (path.size() == 1)
|
||||||
return false;
|
return iter_nth_root_child_vfunc(path[0], iter);
|
||||||
}
|
return false;
|
||||||
return iter_nth_root_child_vfunc(path[0], iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QueueModel::check_iter_validity(const Gtk::TreeIter &iter) const
|
|
||||||
{
|
|
||||||
return stamp == iter.get_stamp();
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue