summaryrefslogtreecommitdiff
path: root/gtk/gtktreemodelsort.c
diff options
context:
space:
mode:
authorSzilárd Pfeiffer <mailbox@pfeifferszilard.hu>2011-01-05 23:39:11 -0500
committerMatthias Clasen <mclasen@redhat.com>2011-01-05 23:39:11 -0500
commit8219ed3a26ef4e2a824d8070eb39e3aa95489fd8 (patch)
tree8335513cd1ff9487b9f5584d8ec44a42bec09185 /gtk/gtktreemodelsort.c
parent072023e57b6c894436f1a480797621f3740f6413 (diff)
downloadgtk+-8219ed3a26ef4e2a824d8070eb39e3aa95489fd8.tar.gz
Add gtk_tree_model_iter_previous() vfunc
https://bugzilla.gnome.org/show_bug.cgi?id=128058
Diffstat (limited to 'gtk/gtktreemodelsort.c')
-rw-r--r--gtk/gtktreemodelsort.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gtk/gtktreemodelsort.c b/gtk/gtktreemodelsort.c
index 5582da781e..1fc52266ed 100644
--- a/gtk/gtktreemodelsort.c
+++ b/gtk/gtktreemodelsort.c
@@ -189,6 +189,8 @@ static void gtk_tree_model_sort_get_value (GtkTreeModel
GValue *value);
static gboolean gtk_tree_model_sort_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter);
+static gboolean gtk_tree_model_sort_iter_previous (GtkTreeModel *tree_model,
+ GtkTreeIter *iter);
static gboolean gtk_tree_model_sort_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent);
@@ -325,6 +327,7 @@ gtk_tree_model_sort_tree_model_init (GtkTreeModelIface *iface)
iface->get_path = gtk_tree_model_sort_get_path;
iface->get_value = gtk_tree_model_sort_get_value;
iface->iter_next = gtk_tree_model_sort_iter_next;
+ iface->iter_previous = gtk_tree_model_sort_iter_previous;
iface->iter_children = gtk_tree_model_sort_iter_children;
iface->iter_has_child = gtk_tree_model_sort_iter_has_child;
iface->iter_n_children = gtk_tree_model_sort_iter_n_children;
@@ -1081,6 +1084,31 @@ gtk_tree_model_sort_iter_next (GtkTreeModel *tree_model,
}
static gboolean
+gtk_tree_model_sort_iter_previous (GtkTreeModel *tree_model,
+ GtkTreeIter *iter)
+{
+ GtkTreeModelSort *tree_model_sort = (GtkTreeModelSort *) tree_model;
+ GtkTreeModelSortPrivate *priv = tree_model_sort->priv;
+ SortLevel *level;
+ SortElt *elt;
+
+ g_return_val_if_fail (priv->child_model != NULL, FALSE);
+ g_return_val_if_fail (priv->stamp == iter->stamp, FALSE);
+
+ level = iter->user_data;
+ elt = iter->user_data2;
+
+ if (elt == (SortElt *)level->array->data)
+ {
+ iter->stamp = 0;
+ return FALSE;
+ }
+ iter->user_data2 = elt - 1;
+
+ return TRUE;
+}
+
+static gboolean
gtk_tree_model_sort_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent)