summaryrefslogtreecommitdiff
path: root/gtk/gtktreestore.c
diff options
context:
space:
mode:
authorKristian Rietveld <kris@gtk.org>2006-06-26 15:49:43 +0000
committerKristian Rietveld <kristian@src.gnome.org>2006-06-26 15:49:43 +0000
commitcc7f4fdedabdc386093255e3a306dcad1125f554 (patch)
tree8e0ac191666231a5746f72fb4778e190520598da /gtk/gtktreestore.c
parentd7603343d8aa75b14fccdec2ee1f6d69cd71c0cf (diff)
downloadgtk+-cc7f4fdedabdc386093255e3a306dcad1125f554.tar.gz
Make the insert and set functions somewhat more convenient. (#343841,
2006-06-26 Kristian Rietveld <kris@gtk.org> Make the insert and set functions somewhat more convenient. (#343841, David Necas). * gtk/gtkliststore.c (gtk_list_store_insert_with_values): allow a NULL iter, (gtk_list_store_insert_with_valuesv): likewise. * gtk/gtktreestore.c (gtk_tree_store_insert_with_values): ditto, (gtk_tree_store_insert_with_valuesv): likewise.
Diffstat (limited to 'gtk/gtktreestore.c')
-rw-r--r--gtk/gtktreestore.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/gtk/gtktreestore.c b/gtk/gtktreestore.c
index 03dd170a31..f13c5ec74a 100644
--- a/gtk/gtktreestore.c
+++ b/gtk/gtktreestore.c
@@ -1277,7 +1277,7 @@ gtk_tree_store_insert_after (GtkTreeStore *tree_store,
/**
* gtk_tree_store_insert_with_values:
* @tree_store: A #GtkTreeStore
- * @iter: An unset #GtkTreeIter to set the new row
+ * @iter: An unset #GtkTreeIter to set the new row, or %NULL.
* @parent: A valid #GtkTreeIter, or %NULL
* @position: position to insert the new row
* @Varargs: pairs of column number and value, terminated with -1
@@ -1313,12 +1313,16 @@ gtk_tree_store_insert_with_values (GtkTreeStore *tree_store,
GtkTreePath *path;
GNode *parent_node;
GNode *new_node;
+ GtkTreeIter tmp_iter;
va_list var_args;
gboolean changed = FALSE;
gboolean maybe_need_sort = FALSE;
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
- g_return_if_fail (iter != NULL);
+
+ if (!iter)
+ iter = &tmp_iter;
+
if (parent)
g_return_if_fail (VALID_ITER (parent, tree_store));
@@ -1364,7 +1368,7 @@ gtk_tree_store_insert_with_values (GtkTreeStore *tree_store,
/**
* gtk_tree_store_insert_with_valuesv:
* @tree_store: A #GtkTreeStore
- * @iter: An unset #GtkTreeIter to set the new row
+ * @iter: An unset #GtkTreeIter to set the new row, or %NULL.
* @parent: A valid #GtkTreeIter, or %NULL
* @position: position to insert the new row
* @columns: an array of column numbers
@@ -1389,13 +1393,17 @@ gtk_tree_store_insert_with_valuesv (GtkTreeStore *tree_store,
GtkTreePath *path;
GNode *parent_node;
GNode *new_node;
+ GtkTreeIter tmp_iter;
gboolean changed = FALSE;
gboolean maybe_need_sort = FALSE;
GtkTreeIterCompareFunc func = NULL;
gint i;
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
- g_return_if_fail (iter != NULL);
+
+ if (!iter)
+ iter = &tmp_iter;
+
if (parent)
g_return_if_fail (VALID_ITER (parent, tree_store));