summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorKristian Rietveld <kris@gtk.org>2002-06-04 17:12:15 +0000
committerKristian Rietveld <kristian@src.gnome.org>2002-06-04 17:12:15 +0000
commit46006990c8ffc336b090a52ad9c35cb9f96cd0ff (patch)
tree9c0e7e78a18b61632efa83a067790116547ba712 /gtk
parentba8f8b4dd85409cb5c2df2db7eedbe3b90827512 (diff)
downloadgdk-pixbuf-46006990c8ffc336b090a52ad9c35cb9f96cd0ff.tar.gz
add gtk_tree_model_get_string_from_iter (#74667).
Tue Jun 4 19:18:20 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtktreemodel.[ch]: add gtk_tree_model_get_string_from_iter (#74667).
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtktreemodel.c30
-rw-r--r--gtk/gtktreemodel.h2
2 files changed, 32 insertions, 0 deletions
diff --git a/gtk/gtktreemodel.c b/gtk/gtktreemodel.c
index d09f56c7e..37f782e43 100644
--- a/gtk/gtktreemodel.c
+++ b/gtk/gtktreemodel.c
@@ -721,6 +721,36 @@ gtk_tree_model_get_iter_from_string (GtkTreeModel *tree_model,
return retval;
}
+/**
+ * gtk_tree_model_get_string_from_iter:
+ * @tree_model: A #GtkTreeModel.
+ * @iter: An #GtkTreeIter.
+ *
+ * Generates a string representation of the iter. This string is a ':'
+ * separated list of numbers. For example, "4:10:0:3" would be an
+ * acceptable return value for this string.
+ *
+ * Return value: A newly-allocated string. Must be freed with g_free().
+ **/
+gchar *
+gtk_tree_model_get_string_from_iter (GtkTreeModel *tree_model,
+ GtkTreeIter *iter)
+{
+ GtkTreePath *path;
+ gchar *ret;
+
+ g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), NULL);
+ g_return_val_if_fail (iter != NULL, NULL);
+
+ path = gtk_tree_model_get_path (tree_model, iter);
+
+ g_return_val_if_fail (path != NULL, NULL);
+
+ ret = gtk_tree_path_to_string (path);
+ gtk_tree_path_free (path);
+
+ return ret;
+}
/**
* gtk_tree_model_get_iter_first:
diff --git a/gtk/gtktreemodel.h b/gtk/gtktreemodel.h
index e498a1460..a3f5e93cf 100644
--- a/gtk/gtktreemodel.h
+++ b/gtk/gtktreemodel.h
@@ -183,6 +183,8 @@ gboolean gtk_tree_model_get_iter (GtkTreeModel *tree_model,
gboolean gtk_tree_model_get_iter_from_string (GtkTreeModel *tree_model,
GtkTreeIter *iter,
const gchar *path_string);
+gchar * gtk_tree_model_get_string_from_iter (GtkTreeModel *tree_model,
+ GtkTreeIter *iter);
#define gtk_tree_model_get_iter_root(tree_model, iter) gtk_tree_model_get_iter_first(tree_model, iter)
gboolean gtk_tree_model_get_iter_first (GtkTreeModel *tree_model,
GtkTreeIter *iter);