commit d056048c62be72a4e8391fb0c4c943c5185eab09
Author: Szilárd Pfeiffer <mailbox@pfeifferszilard.hu>
Date:   Mon Aug 16 12:42:23 2010 +0200

    Implemented iter_prev function for sort model.

diff --git a/gtk/gtktreemodelsort.c b/gtk/gtktreemodelsort.c
index ddb355c..4e64a03 100644
--- a/gtk/gtktreemodelsort.c
+++ b/gtk/gtktreemodelsort.c
@@ -163,6 +163,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_prev          (GtkTreeModel          *tree_model,
+                                                            GtkTreeIter           *iter);
 static gboolean     gtk_tree_model_sort_iter_children      (GtkTreeModel          *tree_model,
                                                             GtkTreeIter           *iter,
                                                             GtkTreeIter           *parent);
@@ -291,6 +293,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_prev = gtk_tree_model_sort_iter_prev;
   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;
@@ -1039,6 +1042,30 @@ gtk_tree_model_sort_iter_next (GtkTreeModel *tree_model,
 }
 
 static gboolean
+gtk_tree_model_sort_iter_prev (GtkTreeModel *tree_model,
+			       GtkTreeIter  *iter)
+{
+  GtkTreeModelSort *tree_model_sort = (GtkTreeModelSort *) tree_model;
+  SortLevel *level;
+  SortElt *elt;
+
+  g_return_val_if_fail (tree_model_sort->child_model != NULL, FALSE);
+  g_return_val_if_fail (tree_model_sort->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)
