[libgd] view: Add support for sort models as well
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgd] view: Add support for sort models as well
- Date: Wed, 22 Jan 2014 17:33:38 +0000 (UTC)
commit 2c8646476b651905dbc0d1a65c612a4b802e363e
Author: Bastien Nocera <hadess hadess net>
Date: Wed Jan 22 15:27:03 2014 +0100
view: Add support for sort models as well
libgd/gd-main-view.c | 28 ++++++++++++++++++++++------
1 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/libgd/gd-main-view.c b/libgd/gd-main-view.c
index 4211122..1bdfee1 100644
--- a/libgd/gd-main-view.c
+++ b/libgd/gd-main-view.c
@@ -341,18 +341,34 @@ do_select_row (GdMainView *self,
gboolean value)
{
GtkTreeModel *model;
- GtkTreeModelFilter *filter;
- GtkTreeIter my_iter, child_iter;
+ GtkTreeIter my_iter;
GtkTreePath *path;
model = self->priv->model;
my_iter = *iter;
- while (GTK_IS_TREE_MODEL_FILTER (model))
+ while (GTK_IS_TREE_MODEL_FILTER (model) ||
+ GTK_IS_TREE_MODEL_SORT (model))
{
- filter = GTK_TREE_MODEL_FILTER (model);
- gtk_tree_model_filter_convert_iter_to_child_iter (filter, &child_iter, &my_iter);
- model = gtk_tree_model_filter_get_model (filter);
+ GtkTreeIter child_iter;
+
+ if (GTK_IS_TREE_MODEL_FILTER (model))
+ {
+ GtkTreeModelFilter *filter;
+
+ filter = GTK_TREE_MODEL_FILTER (model);
+ gtk_tree_model_filter_convert_iter_to_child_iter (filter, &child_iter, &my_iter);
+ model = gtk_tree_model_filter_get_model (filter);
+ }
+ else
+ {
+ GtkTreeModelSort *sort;
+
+ sort = GTK_TREE_MODEL_SORT (model);
+ gtk_tree_model_sort_convert_iter_to_child_iter (sort, &child_iter, &my_iter);
+ model = gtk_tree_model_sort_get_model (sort);
+ }
+
my_iter = child_iter;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]