+/**
+ * gtk_tree_model_sort_convert_child_path_to_path:
+ * @tree_model_sort: A #GtkTreeModelSort
+ * @child_path: A #GtkTreePath to convert
+ *
+ * Converts @child_path to a path relative to @tree_model_sort. That is,
+ * @child_path points to a path in the child model. The returned path will
+ * point to the same row in the sorted model. If @child_path isn't a valid
+ * path on the child model, then %NULL is returned.
+ *
+ * Return value: A newly allocated #GtkTreePath, or %NULL
+ **/
+GtkTreePath *
+gtk_tree_model_sort_convert_child_path_to_path (GtkTreeModelSort *tree_model_sort,
+ GtkTreePath *child_path)
+{
+ g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT (tree_model_sort), NULL);
+ g_return_val_if_fail (tree_model_sort->child_model != NULL, NULL);
+ g_return_val_if_fail (child_path != NULL, NULL);
+
+ return gtk_real_tree_model_sort_convert_child_path_to_path (tree_model_sort, child_path, TRUE);
+}
+
+/**
+ * gtk_tree_model_sort_convert_child_iter_to_iter:
+ * @tree_model_sort: A #GtkTreeModelSort
+ * @sort_iter: An uninitialized #GtkTreeIter.
+ * @child_iter: A valid #GtkTreeIter pointing to a row on the child model
+ *
+ * Sets @sort_iter to point to the row in @tree_model_sort that corresponds to
+ * the row pointed at by @child_iter.
+ **/
+void
+gtk_tree_model_sort_convert_child_iter_to_iter (GtkTreeModelSort *tree_model_sort,
+ GtkTreeIter *sort_iter,
+ GtkTreeIter *child_iter)
+{
+ GtkTreePath *child_path, *path;
+
+ g_return_if_fail (GTK_IS_TREE_MODEL_SORT (tree_model_sort));
+ g_return_if_fail (tree_model_sort->child_model != NULL);
+ g_return_if_fail (sort_iter != NULL);
+ g_return_if_fail (child_iter != NULL);
+
+ sort_iter->stamp = 0;
+
+ child_path = gtk_tree_model_get_path (tree_model_sort->child_model, child_iter);
+ g_return_if_fail (child_path != NULL);
+
+ path = gtk_tree_model_sort_convert_child_path_to_path (tree_model_sort, child_path);
+ gtk_tree_path_free (child_path);
+ g_return_if_fail (path != NULL);
+
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_model_sort), sort_iter, path);
+ gtk_tree_path_free (path);
+}
+
+/**
+ * gtk_tree_model_sort_convert_path_to_child_path:
+ * @tree_model_sort: A #GtkTreeModelSort
+ * @sorted_path: A #GtkTreePath to convert
+ *
+ * Converts @sorted_path to a path on the child model of @tree_model_sort.
+ * That is, @sorted_path points to a location in @tree_model_sort. The
+ * returned path will point to the same location in the model not being
+ * sorted. If @sorted_path does not point to a location in the child model,
+ * %NULL is returned.
+ *
+ * Return value: A newly allocated #GtkTreePath, or %NULL
+ **/
+GtkTreePath *
+gtk_tree_model_sort_convert_path_to_child_path (GtkTreeModelSort *tree_model_sort,
+ GtkTreePath *sorted_path)
+{
+ gint *sorted_indices;
+ GtkTreePath *retval;
+ SortLevel *level;
+ gint i;
+
+ g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT (tree_model_sort), NULL);
+ g_return_val_if_fail (tree_model_sort->child_model != NULL, NULL);
+ g_return_val_if_fail (sorted_path != NULL, NULL);
+
+ retval = gtk_tree_path_new ();
+ sorted_indices = gtk_tree_path_get_indices (sorted_path);
+ if (tree_model_sort->root == NULL)
+ gtk_tree_model_sort_build_level (tree_model_sort, NULL, NULL);
+ level = SORT_LEVEL (tree_model_sort->root);
+
+ for (i = 0; i < gtk_tree_path_get_depth (sorted_path); i++)
+ {
+ gint count = sorted_indices[i];