Commit a4a7652d authored by Jonathan Blandford's avatar Jonathan Blandford Committed by Jonathan Blandford

remove gtk_tree_model_get_first in favor of gtk_tree_model_get_iter_root.

Mon Jul  9 12:50:51 2001  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtktreemodel.c: remove gtk_tree_model_get_first in favor of
	gtk_tree_model_get_iter_root.

	* gtk/gtkliststore.c: Add a bunch of g_return statements.
	(gtk_list_store_iter_n_children): Fix up.

	* gtk/gtktreestore.c: Add a bunch of g_return statements.
parent ab28b938
Mon Jul 9 12:50:51 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c: remove gtk_tree_model_get_first in favor of
gtk_tree_model_get_iter_root.
* gtk/gtkliststore.c: Add a bunch of g_return statements.
(gtk_list_store_iter_n_children): Fix up.
* gtk/gtktreestore.c: Add a bunch of g_return statements.
Fri Jul 6 15:38:33 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_class_init):
......
Mon Jul 9 12:50:51 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c: remove gtk_tree_model_get_first in favor of
gtk_tree_model_get_iter_root.
* gtk/gtkliststore.c: Add a bunch of g_return statements.
(gtk_list_store_iter_n_children): Fix up.
* gtk/gtktreestore.c: Add a bunch of g_return statements.
Fri Jul 6 15:38:33 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_class_init):
......
Mon Jul 9 12:50:51 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c: remove gtk_tree_model_get_first in favor of
gtk_tree_model_get_iter_root.
* gtk/gtkliststore.c: Add a bunch of g_return statements.
(gtk_list_store_iter_n_children): Fix up.
* gtk/gtktreestore.c: Add a bunch of g_return statements.
Fri Jul 6 15:38:33 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_class_init):
......
Mon Jul 9 12:50:51 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c: remove gtk_tree_model_get_first in favor of
gtk_tree_model_get_iter_root.
* gtk/gtkliststore.c: Add a bunch of g_return statements.
(gtk_list_store_iter_n_children): Fix up.
* gtk/gtktreestore.c: Add a bunch of g_return statements.
Fri Jul 6 15:38:33 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_class_init):
......
Mon Jul 9 12:50:51 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c: remove gtk_tree_model_get_first in favor of
gtk_tree_model_get_iter_root.
* gtk/gtkliststore.c: Add a bunch of g_return statements.
(gtk_list_store_iter_n_children): Fix up.
* gtk/gtktreestore.c: Add a bunch of g_return statements.
Fri Jul 6 15:38:33 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_class_init):
......
Mon Jul 9 12:50:51 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c: remove gtk_tree_model_get_first in favor of
gtk_tree_model_get_iter_root.
* gtk/gtkliststore.c: Add a bunch of g_return statements.
(gtk_list_store_iter_n_children): Fix up.
* gtk/gtktreestore.c: Add a bunch of g_return statements.
Fri Jul 6 15:38:33 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_class_init):
......
Mon Jul 9 12:50:51 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c: remove gtk_tree_model_get_first in favor of
gtk_tree_model_get_iter_root.
* gtk/gtkliststore.c: Add a bunch of g_return statements.
(gtk_list_store_iter_n_children): Fix up.
* gtk/gtktreestore.c: Add a bunch of g_return statements.
Fri Jul 6 15:38:33 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_class_init):
......
......@@ -27,6 +27,7 @@
#define G_SLIST(x) ((GSList *) x)
#define GTK_LIST_STORE_IS_SORTED(list) (GTK_LIST_STORE (list)->sort_column_id != -1)
#define VALID_ITER(iter, list_store) (iter!= NULL && iter->user_data != NULL && list_store->stamp == iter->stamp)
static void gtk_list_store_init (GtkListStore *list_store);
static void gtk_list_store_class_init (GtkListStoreClass *class);
......@@ -328,7 +329,6 @@ gtk_list_store_set_n_columns (GtkListStore *list_store,
{
GType *new_columns;
g_return_if_fail (list_store != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (n_columns > 0);
......@@ -361,7 +361,6 @@ gtk_list_store_set_column_type (GtkListStore *list_store,
gint column,
GType type)
{
g_return_if_fail (list_store != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (column >=0 && column < list_store->n_columns);
if (!_gtk_tree_data_list_check_type (type))
......@@ -524,12 +523,12 @@ static gint
gtk_list_store_iter_n_children (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
g_return_val_if_fail (GTK_LIST_STORE (tree_model)->stamp == iter->stamp, -1);
if (iter->user_data == NULL)
g_return_val_if_fail (GTK_IS_LIST_STORE (tree_model), -1);
if (iter == NULL)
return GTK_LIST_STORE (tree_model)->length;
else
return 0;
g_return_val_if_fail (GTK_LIST_STORE (tree_model)->stamp == iter->stamp, -1);
return 0;
}
static gboolean
......@@ -596,7 +595,7 @@ gtk_list_store_set_value (GtkListStore *list_store,
gint orig_column = column;
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (iter != NULL);
g_return_if_fail (VALID_ITER (iter, list_store));
g_return_if_fail (column >= 0 && column < list_store->n_columns);
g_return_if_fail (G_IS_VALUE (value));
......@@ -697,6 +696,7 @@ gtk_list_store_set_valist (GtkListStore *list_store,
gint column;
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (VALID_ITER (iter, list_store));
column = va_arg (var_args, gint);
......@@ -757,6 +757,8 @@ gtk_list_store_set (GtkListStore *list_store,
va_list var_args;
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (iter != NULL);
g_return_if_fail (iter->stamp == list_store->stamp);
va_start (var_args, iter);
gtk_list_store_set_valist (list_store, iter, var_args);
......@@ -840,9 +842,8 @@ gtk_list_store_remove (GtkListStore *list_store,
{
GtkTreePath *path;
g_return_if_fail (list_store != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (iter->user_data != NULL);
g_return_if_fail (VALID_ITER (iter, list_store));
path = gtk_list_store_get_path (GTK_TREE_MODEL (list_store), iter);
......@@ -896,7 +897,6 @@ gtk_list_store_insert (GtkListStore *list_store,
GtkTreePath *path;
GSList *new_list;
g_return_if_fail (list_store != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (iter != NULL);
g_return_if_fail (position >= 0);
......@@ -951,9 +951,11 @@ gtk_list_store_insert_before (GtkListStore *list_store,
GSList *list, *prev, *new_list;
gint i = 0;
g_return_if_fail (list_store != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (iter != NULL);
if (sibling)
g_return_if_fail (VALID_ITER (sibling, list_store));
if (GTK_LIST_STORE_IS_SORTED (list_store))
{
......@@ -1036,11 +1038,10 @@ gtk_list_store_insert_after (GtkListStore *list_store,
GSList *list, *new_list;
gint i = 0;
g_return_if_fail (list_store != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (iter != NULL);
if (sibling)
g_return_if_fail (sibling->stamp == list_store->stamp);
g_return_if_fail (VALID_ITER (sibling, list_store));
if (sibling == NULL ||
GTK_LIST_STORE_IS_SORTED (list_store))
......@@ -1085,7 +1086,6 @@ gtk_list_store_prepend (GtkListStore *list_store,
{
GtkTreePath *path;
g_return_if_fail (list_store != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (iter != NULL);
......@@ -1124,7 +1124,6 @@ gtk_list_store_append (GtkListStore *list_store,
{
GtkTreePath *path;
g_return_if_fail (list_store != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (iter != NULL);
......
......@@ -604,7 +604,6 @@ gtk_tree_model_get_flags (GtkTreeModel *tree_model)
gint
gtk_tree_model_get_n_columns (GtkTreeModel *tree_model)
{
g_return_val_if_fail (tree_model != NULL, 0);
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), 0);
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->get_n_columns != NULL, 0);
......@@ -624,7 +623,6 @@ GType
gtk_tree_model_get_column_type (GtkTreeModel *tree_model,
gint index)
{
g_return_val_if_fail (tree_model != NULL, G_TYPE_INVALID);
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), G_TYPE_INVALID);
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->get_column_type != NULL, G_TYPE_INVALID);
g_return_val_if_fail (index >= 0, G_TYPE_INVALID);
......@@ -651,6 +649,7 @@ gtk_tree_model_get_iter (GtkTreeModel *tree_model,
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (path != NULL, FALSE);
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->get_iter != NULL, FALSE);
g_return_val_if_fail (path->depth > 0, FALSE);
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->get_iter) (tree_model, iter, path);
}
......@@ -661,7 +660,8 @@ gtk_tree_model_get_iter (GtkTreeModel *tree_model,
* @tree_model: A #GtkTreeModel.
* @iter: The uninitialized #GtkTreeIter.
*
* Gets the root iter, if it exists.
* Initialized @iter with the root iterator in the tree (the one at the root
* path) and returns %TRUE. Returns %FALSE if the tree is empty.
*
* Return value: TRUE, if @iter was set.
**/
......@@ -682,36 +682,6 @@ gtk_tree_model_get_iter_root (GtkTreeModel *tree_model,
return retval;
}
/**
* gtk_tree_model_get_first:
* @tree_model: a #GtkTreeModel
* @iter: iterator to initialize
*
* Initialized @iter with the first iterator in the tree (the one at the
* root path) and returns %TRUE, or returns %FALSE if there are no
* iterable locations in the model (i.e. the tree is empty).
*
* Return value: %TRUE if @iter was initialized
**/
gboolean
gtk_tree_model_get_first (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
gboolean retval;
GtkTreePath *path;
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
path = gtk_tree_path_new_root ();
retval = gtk_tree_model_get_iter (tree_model, iter, path);
gtk_tree_path_free (path);
return retval;
}
/**
* gtk_tree_model_get_path:
* @tree_model: A #GtkTreeModel.
......@@ -726,9 +696,8 @@ GtkTreePath *
gtk_tree_model_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
g_return_val_if_fail (tree_model != NULL, NULL);
g_return_val_if_fail (iter != NULL, NULL);
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), NULL);
g_return_val_if_fail (iter != NULL, NULL);
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->get_path != NULL, NULL);
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->get_path) (tree_model, iter);
......@@ -741,8 +710,8 @@ gtk_tree_model_get_path (GtkTreeModel *tree_model,
* @column: The column to lookup the value at.
* @value: An empty #GValue to set.
*
* Sets initializes and sets @value to that at @column. When done with value,
* #g_value_unset needs to be called on it.
* Sets initializes and sets @value to that at @column. When done with @value,
* #g_value_unset needs to be called to free any allocated memory.
**/
void
gtk_tree_model_get_value (GtkTreeModel *tree_model,
......@@ -750,9 +719,8 @@ gtk_tree_model_get_value (GtkTreeModel *tree_model,
gint column,
GValue *value)
{
g_return_if_fail (tree_model != NULL);
g_return_if_fail (iter != NULL);
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
g_return_if_fail (iter != NULL);
g_return_if_fail (value != NULL);
g_return_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->get_value != NULL);
......@@ -773,7 +741,6 @@ gboolean
gtk_tree_model_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
g_return_val_if_fail (tree_model != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_next != NULL, FALSE);
......@@ -819,7 +786,6 @@ gboolean
gtk_tree_model_iter_has_child (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
g_return_val_if_fail (tree_model != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_has_child != NULL, FALSE);
......@@ -832,8 +798,8 @@ gtk_tree_model_iter_has_child (GtkTreeModel *tree_model,
* @tree_model: A #GtkTreeModel.
* @iter: The #GtkTreeIter, or NULL.
*
* Returns the number of children that @iter has. If @iter is NULL, then the
* number of toplevel nodes is returned.
* Returns the number of children that @iter has. As a special case, if @iter
* is NULL, then the number of toplevel nodes is returned.
*
* Return value: The number of children of @iter.
**/
......@@ -856,10 +822,10 @@ gtk_tree_model_iter_n_children (GtkTreeModel *tree_model,
* @n: Then index of the desired child.
*
* Sets @iter to be the child of @parent, using the given index. The first
* index is 0. If the index is too big, or @parent has no children, @iter is
* set to an invalid iterator and FALSE is returned. @parent will remain a
* valid node after this function has been called. If @parent is NULL, then the
* root node is assumed.
* index is 0. If @index is too big, or @parent has no children, @iter is set
* to an invalid iterator and FALSE is returned. @parent will remain a valid
* node after this function has been called. As a special case, if @parent is
* NULL, then the nth root node is set.
*
* Return value: TRUE, if @parent has an nth child.
**/
......@@ -869,7 +835,6 @@ gtk_tree_model_iter_nth_child (GtkTreeModel *tree_model,
GtkTreeIter *parent,
gint n)
{
g_return_val_if_fail (tree_model != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (n >= 0, FALSE);
......@@ -896,7 +861,6 @@ gtk_tree_model_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *child)
{
g_return_val_if_fail (tree_model != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (child != NULL, FALSE);
......@@ -919,6 +883,9 @@ gtk_tree_model_iter_parent (GtkTreeModel *tree_model,
* node.) For example, a file-system based model would not want to keep the
* entire file-heirarchy in memory, just the sections that are currently being
* displayed by every current view.
*
* A model should be expected to be able to get an iter independent of it's
* reffed state.
**/
void
gtk_tree_model_ref_node (GtkTreeModel *tree_model,
......@@ -947,8 +914,8 @@ void
gtk_tree_model_unref_node (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
g_return_if_fail (tree_model != NULL);
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
g_return_if_fail (iter != NULL);
if (GTK_TREE_MODEL_GET_IFACE (tree_model)->unref_node)
(* GTK_TREE_MODEL_GET_IFACE (tree_model)->unref_node) (tree_model, iter);
......@@ -978,6 +945,7 @@ gtk_tree_model_get (GtkTreeModel *tree_model,
va_list var_args;
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
g_return_if_fail (iter != NULL);
va_start (var_args, iter);
gtk_tree_model_get_valist (tree_model, iter, var_args);
......@@ -990,9 +958,8 @@ gtk_tree_model_get (GtkTreeModel *tree_model,
* @iter: a row in @tree_model
* @var_args: va_list of column/return location pairs
*
* See gtk_tree_model_get(), this version takes a va_list for
* language bindings to use.
*
* See gtk_tree_model_get(), this version takes a va_list for language bindings
* to use.
**/
void
gtk_tree_model_get_valist (GtkTreeModel *tree_model,
......@@ -1002,6 +969,7 @@ gtk_tree_model_get_valist (GtkTreeModel *tree_model,
gint column;
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
g_return_if_fail (iter != NULL);
column = va_arg (var_args, gint);
......@@ -1044,7 +1012,6 @@ gtk_tree_model_range_changed (GtkTreeModel *tree_model,
GtkTreeIter *end_iter)
{
gint i;
g_return_if_fail (tree_model != NULL);
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
g_return_if_fail (start_path != NULL);
g_return_if_fail (start_iter != NULL);
......@@ -1070,7 +1037,6 @@ gtk_tree_model_inserted (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter)
{
g_return_if_fail (tree_model != NULL);
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
g_return_if_fail (path != NULL);
g_return_if_fail (iter != NULL);
......@@ -1083,7 +1049,6 @@ gtk_tree_model_has_child_toggled (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter)
{
g_return_if_fail (tree_model != NULL);
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
g_return_if_fail (path != NULL);
g_return_if_fail (iter != NULL);
......@@ -1095,7 +1060,6 @@ void
gtk_tree_model_deleted (GtkTreeModel *tree_model,
GtkTreePath *path)
{
g_return_if_fail (tree_model != NULL);
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
g_return_if_fail (path != NULL);
......@@ -1108,7 +1072,6 @@ gtk_tree_model_reordered (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gint *new_order)
{
g_return_if_fail (tree_model != NULL);
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
g_return_if_fail (new_order != NULL);
......@@ -1164,6 +1127,9 @@ gtk_tree_model_foreach (GtkTreeModel *model,
GtkTreePath *path;
GtkTreeIter iter;
g_return_if_fail (GTK_IS_TREE_MODEL (model));
g_return_if_fail (func != NULL);
path = gtk_tree_path_new_root ();
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_foreach_helper (model, &iter, path, func, user_data);
......
......@@ -180,8 +180,6 @@ gboolean gtk_tree_model_get_iter (GtkTreeModel *tree_model,
GtkTreePath *path);
gboolean gtk_tree_model_get_iter_root (GtkTreeModel *tree_model,
GtkTreeIter *iter);
gboolean gtk_tree_model_get_first (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GtkTreePath * gtk_tree_model_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter);
void gtk_tree_model_get_value (GtkTreeModel *tree_model,
......
......@@ -26,6 +26,7 @@
#define G_NODE(node) ((GNode *)node)
#define GTK_TREE_STORE_IS_SORTED(tree) (GTK_TREE_STORE (tree)->sort_column_id != -1)
#define VALID_ITER(iter, tree_store) (iter!= NULL && iter->user_data != NULL && tree_store->stamp == iter->stamp)
static void gtk_tree_store_init (GtkTreeStore *tree_store);
static void gtk_tree_store_class_init (GtkTreeStoreClass *tree_store_class);
......@@ -703,8 +704,7 @@ gtk_tree_store_set_value (GtkTreeStore *tree_store,
gint orig_column = column;
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
g_return_if_fail (iter != NULL);
g_return_if_fail (GTK_TREE_STORE (tree_store)->stamp == iter->stamp);
g_return_if_fail (VALID_ITER (iter, tree_store));
g_return_if_fail (column >= 0 && column < tree_store->n_columns);
g_return_if_fail (G_IS_VALUE (value));
......@@ -804,6 +804,7 @@ gtk_tree_store_set_valist (GtkTreeStore *tree_store,
gint column;
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
g_return_if_fail (VALID_ITER (iter, tree_store));
column = va_arg (var_args, gint);
......@@ -864,6 +865,7 @@ gtk_tree_store_set (GtkTreeStore *tree_store,
va_list var_args;
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
g_return_if_fail (VALID_ITER (iter, tree_store));
va_start (var_args, iter);
gtk_tree_store_set_valist (tree_store, iter, var_args);
......@@ -878,8 +880,8 @@ gtk_tree_store_remove (GtkTreeStore *model,
GtkTreeIter new_iter = {0,};
GNode *parent;
g_return_if_fail (model != NULL);
g_return_if_fail (GTK_IS_TREE_STORE (model));
g_return_if_fail (VALID_ITER (iter, model));
parent = G_NODE (iter->user_data)->parent;
......@@ -895,13 +897,29 @@ gtk_tree_store_remove (GtkTreeStore *model,
model->stamp++;
gtk_tree_model_deleted (GTK_TREE_MODEL (model), path);
if (parent != G_NODE (model->root) && parent->children == NULL)
if (parent != G_NODE (model->root))
{
gtk_tree_path_up (path);
/* child_toggled */
if (parent->children == NULL)
{
gtk_tree_path_up (path);
new_iter.stamp = model->stamp;
new_iter.user_data = parent;
gtk_tree_model_has_child_toggled (GTK_TREE_MODEL (model), path, &new_iter);
}
new_iter.stamp = model->stamp;
new_iter.user_data = parent;
gtk_tree_model_has_child_toggled (GTK_TREE_MODEL (model), path, &new_iter);
/* revalidate iter */
while (parent != G_NODE (model->root))
{
if (parent->next != NULL)
{
iter->stamp = model->stamp;
iter->user_data = parent->next;
break;
}
parent = parent->parent;
}
}
gtk_tree_path_free (path);
}
......@@ -915,8 +933,9 @@ gtk_tree_store_insert (GtkTreeStore *model,
GtkTreePath *path;
GNode *parent_node;
g_return_if_fail (model != NULL);
g_return_if_fail (GTK_IS_TREE_STORE (model));
if (parent)
g_return_if_fail (VALID_ITER (parent, model));
if (parent)
parent_node = parent->user_data;
......@@ -945,9 +964,12 @@ gtk_tree_store_insert_before (GtkTreeStore *model,
GNode *parent_node = NULL;
GNode *new_node;
g_return_if_fail (model != NULL);
g_return_if_fail (GTK_IS_TREE_STORE (model));
g_return_if_fail (iter != NULL);
if (parent != NULL)
g_return_if_fail (VALID_ITER (parent, model));
if (sibling != NULL)
g_return_if_fail (VALID_ITER (sibling, model));
new_node = g_node_new (NULL);
......@@ -959,8 +981,7 @@ gtk_tree_store_insert_before (GtkTreeStore *model,
parent_node = G_NODE (parent->user_data);
else
{
g_return_if_fail (G_NODE (sibling->user_data)->parent ==
G_NODE (parent->user_data));
g_return_if_fail (G_NODE (sibling->user_data)->parent == G_NODE (parent->user_data));
parent_node = G_NODE (parent->user_data);
}
......@@ -989,9 +1010,12 @@ gtk_tree_store_insert_after (GtkTreeStore *model,
GNode *parent_node;
GNode *new_node;
g_return_if_fail (model != NULL);
g_return_if_fail (GTK_IS_TREE_STORE (model));
g_return_if_fail (iter != NULL);
if (parent != NULL)
g_return_if_fail (VALID_ITER (parent, model));
if (sibling != NULL)
g_return_if_fail (VALID_ITER (sibling, model));
new_node = g_node_new (NULL);
......@@ -1031,9 +1055,10 @@ gtk_tree_store_prepend (GtkTreeStore *model,
{
GNode *parent_node;
g_return_if_fail (model != NULL);
g_return_if_fail (GTK_IS_TREE_STORE (model));
g_return_if_fail (iter != NULL);
if (parent != NULL)
g_return_if_fail (VALID_ITER (parent, model));
if (parent == NULL)
parent_node = model->root;
......@@ -1077,9 +1102,10 @@ gtk_tree_store_append (GtkTreeStore *model,
{
GNode *parent_node;
g_return_if_fail (model != NULL);
g_return_if_fail (GTK_IS_TREE_STORE (model));
g_return_if_fail (iter != NULL);
if (parent != NULL)
g_return_if_fail (VALID_ITER (parent, model));
if (parent == NULL)
parent_node = model->root;
......@@ -1122,10 +1148,9 @@ gtk_tree_store_is_ancestor (GtkTreeStore *model,
GtkTreeIter *iter,
GtkTreeIter *descendant)
{
g_return_val_if_fail (model != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE_STORE (model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (descendant != NULL, FALSE);
g_return_val_if_fail (VALID_ITER (iter, model), FALSE);
g_return_val_if_fail (VALID_ITER (descendant, model), FALSE);
return g_node_is_ancestor (G_NODE (iter->user_data),
</