Commit 881ea288 authored by Matthias Clasen's avatar Matthias Clasen

Remove sealed members from GtkTreeStore

parent 60953ae0
......@@ -62,10 +62,26 @@
* </refsect2>
*/
struct _GtkTreeStorePrivate
{
gint stamp;
gpointer root;
gpointer last;
gint n_columns;
gint sort_column_id;
GList *sort_list;
GtkSortType order;
GType *column_headers;
GtkTreeIterCompareFunc default_sort_func;
gpointer default_sort_data;
GDestroyNotify default_sort_destroy;
guint columns_dirty : 1;
};
#define G_NODE(node) ((GNode *)node)
#define GTK_TREE_STORE_IS_SORTED(tree) (((GtkTreeStore*)(tree))->sort_column_id != GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID)
#define VALID_ITER(iter, tree_store) ((iter)!= NULL && (iter)->user_data != NULL && ((GtkTreeStore*)(tree_store))->stamp == (iter)->stamp)
#define GTK_TREE_STORE_IS_SORTED(tree) (((GtkTreeStore*)(tree))->priv->sort_column_id != GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID)
#define VALID_ITER(iter, tree_store) ((iter)!= NULL && (iter)->user_data != NULL && ((GtkTreeStore*)(tree_store))->priv->stamp == (iter)->stamp)
static void gtk_tree_store_tree_model_init (GtkTreeModelIface *iface);
static void gtk_tree_store_drag_source_init(GtkTreeDragSourceIface *iface);
......@@ -180,9 +196,9 @@ validate_tree (GtkTreeStore *tree_store)
{
if (gtk_get_debug_flags () & GTK_DEBUG_TREE)
{
g_assert (G_NODE (tree_store->root)->parent == NULL);
g_assert (G_NODE (tree_store->priv->root)->parent == NULL);
validate_gnode (G_NODE (tree_store->root));
validate_gnode (G_NODE (tree_store->priv->root));
}
}
......@@ -260,18 +276,23 @@ gtk_tree_store_buildable_init (GtkBuildableIface *iface)
static void
gtk_tree_store_init (GtkTreeStore *tree_store)
{
tree_store->root = g_node_new (NULL);
/* While the odds are against us getting 0...
*/
GtkTreeStorePrivate *priv;
priv = G_TYPE_INSTANCE_GET_PRIVATE (tree_store,
GTK_TYPE_TREE_STORE,
GtkTreeStorePrivate);
tree_store->priv = priv;
priv->root = g_node_new (NULL);
/* While the odds are against us getting 0... */
do
{
tree_store->stamp = g_random_int ();
priv->stamp = g_random_int ();
}
while (tree_store->stamp == 0);
while (priv->stamp == 0);
tree_store->sort_list = NULL;
tree_store->sort_column_id = GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID;
tree_store->columns_dirty = FALSE;
priv->sort_list = NULL;
priv->sort_column_id = GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID;
priv->columns_dirty = FALSE;
}
/**
......@@ -375,7 +396,7 @@ gtk_tree_store_set_column_types (GtkTreeStore *tree_store,
gint i;
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
g_return_if_fail (tree_store->columns_dirty == 0);
g_return_if_fail (tree_store->priv->columns_dirty == 0);
gtk_tree_store_set_n_columns (tree_store, n_columns);
for (i = 0; i < n_columns; i++)
......@@ -393,20 +414,21 @@ static void
gtk_tree_store_set_n_columns (GtkTreeStore *tree_store,
gint n_columns)
{
GtkTreeStorePrivate *priv = tree_store->priv;
int i;
if (tree_store->n_columns == n_columns)
if (priv->n_columns == n_columns)
return;
tree_store->column_headers = g_renew (GType, tree_store->column_headers, n_columns);
for (i = tree_store->n_columns; i < n_columns; i++)
tree_store->column_headers[i] = G_TYPE_INVALID;
tree_store->n_columns = n_columns;
priv->column_headers = g_renew (GType, priv->column_headers, n_columns);
for (i = priv->n_columns; i < n_columns; i++)
priv->column_headers[i] = G_TYPE_INVALID;
priv->n_columns = n_columns;
if (tree_store->sort_list)
_gtk_tree_data_list_header_free (tree_store->sort_list);
if (priv->sort_list)
_gtk_tree_data_list_header_free (priv->sort_list);
tree_store->sort_list = _gtk_tree_data_list_header_new (n_columns, tree_store->column_headers);
priv->sort_list = _gtk_tree_data_list_header_new (n_columns, priv->column_headers);
}
/**
......@@ -426,12 +448,14 @@ gtk_tree_store_set_column_type (GtkTreeStore *tree_store,
gint column,
GType type)
{
GtkTreeStorePrivate *priv = tree_store->priv;
if (!_gtk_tree_data_list_check_type (type))
{
g_warning ("%s: Invalid type %s\n", G_STRLOC, g_type_name (type));
return;
}
tree_store->column_headers[column] = type;
priv->column_headers[column] = type;
}
static gboolean
......@@ -448,20 +472,21 @@ static void
gtk_tree_store_finalize (GObject *object)
{
GtkTreeStore *tree_store = GTK_TREE_STORE (object);
GtkTreeStorePrivate *priv = tree_store->priv;
g_node_traverse (tree_store->root, G_POST_ORDER, G_TRAVERSE_ALL, -1,
node_free, tree_store->column_headers);
g_node_destroy (tree_store->root);
_gtk_tree_data_list_header_free (tree_store->sort_list);
g_free (tree_store->column_headers);
g_node_traverse (priv->root, G_POST_ORDER, G_TRAVERSE_ALL, -1,
node_free, priv->column_headers);
g_node_destroy (priv->root);
_gtk_tree_data_list_header_free (priv->sort_list);
g_free (priv->column_headers);
if (tree_store->default_sort_destroy)
if (priv->default_sort_destroy)
{
GDestroyNotify d = tree_store->default_sort_destroy;
GDestroyNotify d = priv->default_sort_destroy;
tree_store->default_sort_destroy = NULL;
d (tree_store->default_sort_data);
tree_store->default_sort_data = NULL;
priv->default_sort_destroy = NULL;
d (priv->default_sort_data);
priv->default_sort_data = NULL;
}
/* must chain up */
......@@ -485,10 +510,11 @@ static gint
gtk_tree_store_get_n_columns (GtkTreeModel *tree_model)
{
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
GtkTreeStorePrivate *priv = tree_store->priv;
tree_store->columns_dirty = TRUE;
priv->columns_dirty = TRUE;
return tree_store->n_columns;
return priv->n_columns;
}
static GType
......@@ -496,12 +522,13 @@ gtk_tree_store_get_column_type (GtkTreeModel *tree_model,
gint index)
{
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
GtkTreeStorePrivate *priv = tree_store->priv;
g_return_val_if_fail (index < tree_store->n_columns, G_TYPE_INVALID);
g_return_val_if_fail (index < priv->n_columns, G_TYPE_INVALID);
tree_store->columns_dirty = TRUE;
priv->columns_dirty = TRUE;
return tree_store->column_headers[index];
return priv->column_headers[index];
}
static gboolean
......@@ -510,19 +537,20 @@ gtk_tree_store_get_iter (GtkTreeModel *tree_model,
GtkTreePath *path)
{
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
GtkTreeStorePrivate *priv = tree_store->priv;
GtkTreeIter parent;
gint *indices;
gint depth, i;
tree_store->columns_dirty = TRUE;
priv->columns_dirty = TRUE;
indices = gtk_tree_path_get_indices (path);
depth = gtk_tree_path_get_depth (path);
g_return_val_if_fail (depth > 0, FALSE);
parent.stamp = tree_store->stamp;
parent.user_data = tree_store->root;
parent.stamp = priv->stamp;
parent.user_data = priv->root;
if (!gtk_tree_store_iter_nth_child (tree_model, iter, &parent, indices[0]))
return FALSE;
......@@ -542,24 +570,25 @@ gtk_tree_store_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
GtkTreeStorePrivate *priv = tree_store->priv;
GtkTreePath *retval;
GNode *tmp_node;
gint i = 0;
g_return_val_if_fail (iter->user_data != NULL, NULL);
g_return_val_if_fail (iter->stamp == tree_store->stamp, NULL);
g_return_val_if_fail (iter->stamp == priv->stamp, NULL);
validate_tree (tree_store);
if (G_NODE (iter->user_data)->parent == NULL &&
G_NODE (iter->user_data) == tree_store->root)
G_NODE (iter->user_data) == priv->root)
return gtk_tree_path_new ();
g_assert (G_NODE (iter->user_data)->parent != NULL);
if (G_NODE (iter->user_data)->parent == G_NODE (tree_store->root))
if (G_NODE (iter->user_data)->parent == G_NODE (priv->root))
{
retval = gtk_tree_path_new ();
tmp_node = G_NODE (tree_store->root)->children;
tmp_node = G_NODE (priv->root)->children;
}
else
{
......@@ -608,10 +637,11 @@ gtk_tree_store_get_value (GtkTreeModel *tree_model,
GValue *value)
{
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
GtkTreeStorePrivate *priv = tree_store->priv;
GtkTreeDataList *list;
gint tmp_column = column;
g_return_if_fail (column < tree_store->n_columns);
g_return_if_fail (column < priv->n_columns);
g_return_if_fail (VALID_ITER (iter, tree_store));
list = G_NODE (iter->user_data)->data;
......@@ -622,13 +652,13 @@ gtk_tree_store_get_value (GtkTreeModel *tree_model,
if (list)
{
_gtk_tree_data_list_node_to_value (list,
tree_store->column_headers[column],
priv->column_headers[column],
value);
}
else
{
/* We want to return an initialized but empty (default) value */
g_value_init (value, tree_store->column_headers[column]);
g_value_init (value, priv->column_headers[column]);
}
}
......@@ -637,7 +667,7 @@ gtk_tree_store_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
g_return_val_if_fail (iter->user_data != NULL, FALSE);
g_return_val_if_fail (iter->stamp == GTK_TREE_STORE (tree_model)->stamp, FALSE);
g_return_val_if_fail (iter->stamp == GTK_TREE_STORE (tree_model)->priv->stamp, FALSE);
if (G_NODE (iter->user_data)->next)
{
......@@ -657,6 +687,7 @@ gtk_tree_store_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *parent)
{
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
GtkTreeStorePrivate *priv = tree_store->priv;
GNode *children;
if (parent)
......@@ -665,11 +696,11 @@ gtk_tree_store_iter_children (GtkTreeModel *tree_model,
if (parent)
children = G_NODE (parent->user_data)->children;
else
children = G_NODE (tree_store->root)->children;
children = G_NODE (priv->root)->children;
if (children)
{
iter->stamp = tree_store->stamp;
iter->stamp = priv->stamp;
iter->user_data = children;
return TRUE;
}
......@@ -700,7 +731,7 @@ gtk_tree_store_iter_n_children (GtkTreeModel *tree_model,
g_return_val_if_fail (iter == NULL || iter->user_data != NULL, 0);
if (iter == NULL)
node = G_NODE (GTK_TREE_STORE (tree_model)->root)->children;
node = G_NODE (GTK_TREE_STORE (tree_model)->priv->root)->children;
else
node = G_NODE (iter->user_data)->children;
......@@ -720,13 +751,14 @@ gtk_tree_store_iter_nth_child (GtkTreeModel *tree_model,
gint n)
{
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
GtkTreeStorePrivate *priv = tree_store->priv;
GNode *parent_node;
GNode *child;
g_return_val_if_fail (parent == NULL || parent->user_data != NULL, FALSE);
if (parent == NULL)
parent_node = tree_store->root;
parent_node = priv->root;
else
parent_node = parent->user_data;
......@@ -735,7 +767,7 @@ gtk_tree_store_iter_nth_child (GtkTreeModel *tree_model,
if (child)
{
iter->user_data = child;
iter->stamp = tree_store->stamp;
iter->stamp = priv->stamp;
return TRUE;
}
else
......@@ -751,6 +783,7 @@ gtk_tree_store_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter *child)
{
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
GtkTreeStorePrivate *priv = tree_store->priv;
GNode *parent;
g_return_val_if_fail (iter != NULL, FALSE);
......@@ -760,10 +793,10 @@ gtk_tree_store_iter_parent (GtkTreeModel *tree_model,
g_assert (parent != NULL);
if (parent != tree_store->root)
if (parent != priv->root)
{
iter->user_data = parent;
iter->stamp = tree_store->stamp;
iter->stamp = priv->stamp;
return TRUE;
}
else
......@@ -782,22 +815,23 @@ gtk_tree_store_real_set_value (GtkTreeStore *tree_store,
GValue *value,
gboolean sort)
{
GtkTreeStorePrivate *priv = tree_store->priv;
GtkTreeDataList *list;
GtkTreeDataList *prev;
gint old_column = column;
GValue real_value = {0, };
GValue real_value = { 0, };
gboolean converted = FALSE;
gboolean retval = FALSE;
if (! g_type_is_a (G_VALUE_TYPE (value), tree_store->column_headers[column]))
if (! g_type_is_a (G_VALUE_TYPE (value), priv->column_headers[column]))
{
if (! (g_value_type_compatible (G_VALUE_TYPE (value), tree_store->column_headers[column]) &&
g_value_type_compatible (tree_store->column_headers[column], G_VALUE_TYPE (value))))
if (! (g_value_type_compatible (G_VALUE_TYPE (value), priv->column_headers[column]) &&
g_value_type_compatible (priv->column_headers[column], G_VALUE_TYPE (value))))
{
g_warning ("%s: Unable to convert from %s to %s\n",
G_STRLOC,
g_type_name (G_VALUE_TYPE (value)),
g_type_name (tree_store->column_headers[column]));
g_type_name (priv->column_headers[column]));
return retval;
}
if (!g_value_transform (value, &real_value))
......@@ -805,7 +839,7 @@ gtk_tree_store_real_set_value (GtkTreeStore *tree_store,
g_warning ("%s: Unable to make conversion from %s to %s\n",
G_STRLOC,
g_type_name (G_VALUE_TYPE (value)),
g_type_name (tree_store->column_headers[column]));
g_type_name (priv->column_headers[column]));
g_value_unset (&real_value);
return retval;
}
......@@ -889,7 +923,7 @@ gtk_tree_store_set_value (GtkTreeStore *tree_store,
{
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
g_return_if_fail (VALID_ITER (iter, tree_store));
g_return_if_fail (column >= 0 && column < tree_store->n_columns);
g_return_if_fail (column >= 0 && column < tree_store->priv->n_columns);
g_return_if_fail (G_IS_VALUE (value));
if (gtk_tree_store_real_set_value (tree_store, iter, column, value, TRUE))
......@@ -905,22 +939,23 @@ gtk_tree_store_set_value (GtkTreeStore *tree_store,
static GtkTreeIterCompareFunc
gtk_tree_store_get_compare_func (GtkTreeStore *tree_store)
{
GtkTreeStorePrivate *priv = tree_store->priv;
GtkTreeIterCompareFunc func = NULL;
if (GTK_TREE_STORE_IS_SORTED (tree_store))
{
if (tree_store->sort_column_id != -1)
if (priv->sort_column_id != -1)
{
GtkTreeDataSortHeader *header;
header = _gtk_tree_data_list_get_header (tree_store->sort_list,
tree_store->sort_column_id);
header = _gtk_tree_data_list_get_header (priv->sort_list,
priv->sort_column_id);
g_return_val_if_fail (header != NULL, NULL);
g_return_val_if_fail (header->func != NULL, NULL);
func = header->func;
}
else
{
func = tree_store->default_sort_func;
func = priv->default_sort_func;
}
}
......@@ -936,6 +971,7 @@ gtk_tree_store_set_vector_internal (GtkTreeStore *tree_store,
GValue *values,
gint n_values)
{
GtkTreeStorePrivate *priv = tree_store->priv;
gint i;
GtkTreeIterCompareFunc func = NULL;
......@@ -950,7 +986,7 @@ gtk_tree_store_set_vector_internal (GtkTreeStore *tree_store,
FALSE) || *emit_signal;
if (func == _gtk_tree_data_list_compare_func &&
columns[i] == tree_store->sort_column_id)
columns[i] == priv->sort_column_id)
*maybe_need_sort = TRUE;
}
}
......@@ -962,6 +998,7 @@ gtk_tree_store_set_valist_internal (GtkTreeStore *tree_store,
gboolean *maybe_need_sort,
va_list var_args)
{
GtkTreeStorePrivate *priv = tree_store->priv;
gint column;
GtkTreeIterCompareFunc func = NULL;
......@@ -976,12 +1013,12 @@ gtk_tree_store_set_valist_internal (GtkTreeStore *tree_store,
GValue value = { 0, };
gchar *error = NULL;
if (column < 0 || column >= tree_store->n_columns)
if (column < 0 || column >= priv->n_columns)
{
g_warning ("%s: Invalid column number %d added to iter (remember to end your list of columns with a -1)", G_STRLOC, column);
break;
}
g_value_init (&value, tree_store->column_headers[column]);
g_value_init (&value, priv->column_headers[column]);
G_VALUE_COLLECT (&value, var_args, 0, &error);
if (error)
......@@ -1002,7 +1039,7 @@ gtk_tree_store_set_valist_internal (GtkTreeStore *tree_store,
FALSE) || *emit_signal;
if (func == _gtk_tree_data_list_compare_func &&
column == tree_store->sort_column_id)
column == priv->sort_column_id)
*maybe_need_sort = TRUE;
g_value_unset (&value);
......@@ -1033,6 +1070,7 @@ gtk_tree_store_set_valuesv (GtkTreeStore *tree_store,
GValue *values,
gint n_values)
{
GtkTreeStorePrivate *priv = tree_store->priv;
gboolean emit_signal = FALSE;
gboolean maybe_need_sort = FALSE;
......@@ -1045,7 +1083,7 @@ gtk_tree_store_set_valuesv (GtkTreeStore *tree_store,
columns, values, n_values);
if (maybe_need_sort && GTK_TREE_STORE_IS_SORTED (tree_store))
gtk_tree_store_sort_iter_changed (tree_store, iter, tree_store->sort_column_id, TRUE);
gtk_tree_store_sort_iter_changed (tree_store, iter, priv->sort_column_id, TRUE);
if (emit_signal)
{
......@@ -1072,6 +1110,7 @@ gtk_tree_store_set_valist (GtkTreeStore *tree_store,
GtkTreeIter *iter,
va_list var_args)
{
GtkTreeStorePrivate *priv = tree_store->priv;
gboolean emit_signal = FALSE;
gboolean maybe_need_sort = FALSE;
......@@ -1084,7 +1123,7 @@ gtk_tree_store_set_valist (GtkTreeStore *tree_store,
var_args);
if (maybe_need_sort && GTK_TREE_STORE_IS_SORTED (tree_store))
gtk_tree_store_sort_iter_changed (tree_store, iter, tree_store->sort_column_id, TRUE);
gtk_tree_store_sort_iter_changed (tree_store, iter, priv->sort_column_id, TRUE);
if (emit_signal)
{
......@@ -1139,6 +1178,7 @@ gboolean
gtk_tree_store_remove (GtkTreeStore *tree_store,
GtkTreeIter *iter)
{
GtkTreeStorePrivate *priv = tree_store->priv;
GtkTreePath *path;
GtkTreeIter new_iter = {0,};
GNode *parent;
......@@ -1154,21 +1194,21 @@ gtk_tree_store_remove (GtkTreeStore *tree_store,
if (G_NODE (iter->user_data)->data)
g_node_traverse (G_NODE (iter->user_data), G_POST_ORDER, G_TRAVERSE_ALL,
-1, node_free, tree_store->column_headers);
-1, node_free, priv->column_headers);
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
g_node_destroy (G_NODE (iter->user_data));
gtk_tree_model_row_deleted (GTK_TREE_MODEL (tree_store), path);
if (parent != G_NODE (tree_store->root))
if (parent != G_NODE (priv->root))
{
/* child_toggled */
if (parent->children == NULL)
{
gtk_tree_path_up (path);
new_iter.stamp = tree_store->stamp;
new_iter.stamp = priv->stamp;
new_iter.user_data = parent;
gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (tree_store), path, &new_iter);
}
......@@ -1178,7 +1218,7 @@ gtk_tree_store_remove (GtkTreeStore *tree_store,
/* revalidate iter */
if (next_node != NULL)
{
iter->stamp = tree_store->stamp;
iter->stamp = priv->stamp;
iter->user_data = next_node;
return TRUE;
}
......@@ -1213,6 +1253,7 @@ gtk_tree_store_insert (GtkTreeStore *tree_store,
GtkTreeIter *parent,
gint position)
{
GtkTreeStorePrivate *priv = tree_store->priv;
GtkTreePath *path;
GNode *parent_node;
GNode *new_node;
......@@ -1225,20 +1266,20 @@ gtk_tree_store_insert (GtkTreeStore *tree_store,
if (parent)
parent_node = parent->user_data;
else
parent_node = tree_store->root;
parent_node = priv->root;
tree_store->columns_dirty = TRUE;
priv->columns_dirty = TRUE;
new_node = g_node_new (NULL);
iter->stamp = tree_store->stamp;
iter->stamp = priv->stamp;
iter->user_data = new_node;
g_node_insert (parent_node, position, new_node);
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
gtk_tree_model_row_inserted (GTK_TREE_MODEL (tree_store), path, iter);
if (parent_node != tree_store->root)
if (parent_node != priv->root)
{
if (new_node->prev == NULL && new_node->next == NULL)
{
......@@ -1276,6 +1317,7 @@ gtk_tree_store_insert_before (GtkTreeStore *tree_store,
GtkTreeIter *parent,
GtkTreeIter *sibling)
{
GtkTreeStorePrivate *priv = tree_store->priv;
GtkTreePath *path;
GNode *parent_node = NULL;
GNode *new_node;
......@@ -1288,7 +1330,7 @@ gtk_tree_store_insert_before (GtkTreeStore *tree_store,
g_return_if_fail (VALID_ITER (sibling, tree_store));
if (parent == NULL && sibling == NULL)
parent_node = tree_store->root;
parent_node = priv->root;
else if (parent == NULL)
parent_node = G_NODE (sibling->user_data)->parent;
else if (sibling == NULL)
......@@ -1299,7 +1341,7 @@ gtk_tree_store_insert_before (GtkTreeStore *tree_store,
parent_node = G_NODE (parent->user_data);
}
tree_store->columns_dirty = TRUE;
priv->columns_dirty = TRUE;
new_node = g_node_new (NULL);
......@@ -1307,19 +1349,19 @@ gtk_tree_store_insert_before (GtkTreeStore *tree_store,
sibling ? G_NODE (sibling->user_data) : NULL,
new_node);
iter->stamp = tree_store->stamp;
iter->stamp = priv->stamp;
iter->user_data = new_node;
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
gtk_tree_model_row_inserted (GTK_TREE_MODEL (tree_store), path, iter);
if (parent_node != tree_store->root)
if (parent_node != priv->root)
{
if (new_node->prev == NULL && new_node->next == NULL)
{
GtkTreeIter parent_iter;
parent_iter.stamp = tree_store->stamp;
parent_iter.stamp = priv->stamp;
parent_iter.user_data = parent_node;
gtk_tree_path_up (path);
......@@ -1356,6 +1398,7 @@ gtk_tree_store_insert_after (GtkTreeStore *tree_store,
GtkTreeIter *parent,
GtkTreeIter *sibling)
{
GtkTreeStorePrivate *priv = tree_store->priv;
GtkTreePath *path;
GNode *parent_node;
GNode *new_node;
......@@ -1368,7 +1411,7 @@ gtk_tree_store_insert_after (GtkTreeStore *tree_store,
g_return_if_fail (VALID_ITER (sibling, tree_store));
if (parent == NULL && sibling == NULL)
parent_node = tree_store->root;
parent_node = priv->root;
else if (parent == NULL)
parent_node = G_NODE (sibling->user_data)->parent;
else if (sibling == NULL)
......@@ -1380,7 +1423,7 @@ gtk_tree_store_insert_after (GtkTreeStore *tree_store,
parent_node = G_NODE (parent->user_data);
}
tree_store->columns_dirty = TRUE;
priv->columns_dirty = TRUE;
new_node = g_node_new (NULL);
......@@ -1388,19 +1431,19 @@ gtk_tree_store_insert_after (GtkTreeStore *tree_store,
sibling ? G_NODE (sibling->user_data) : NULL,
new_node);
iter->stamp = tree_store->stamp;
iter->stamp = priv->stamp;
iter->user_data = new_node;
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
gtk_tree_model_row_inserted (GTK_TREE_MODEL (tree_store), path, iter);
if (parent_node != tree_store->root)
if (parent_node != priv->root)
{
if (new_node->prev == NULL && new_node->next == NULL)
{
GtkTreeIter parent_iter;
parent_iter.stamp = tree_store->stamp;
parent_iter.stamp = priv->stamp;
parent_iter.user_data = parent_node;
gtk_tree_path_up (path);
......@@ -1449,6 +1492,7 @@ gtk_tree_store_insert_with_values (GtkTreeStore *tree_store,
gint position,
...)
{
GtkTreeStorePrivate *priv = tree_store->priv;
GtkTreePath *path;
GNode *parent_node;
GNode *new_node;
......@@ -1468,13 +1512,13 @@ gtk_tree_store_insert_with_values (GtkTreeStore *tree_store,
if (parent)
parent_node = parent->user_data;
else
parent_node = tree_store->root;
parent_node = priv->root;
tree_store->columns_dirty = TRUE;
priv->columns_dirty = TRUE;
new_node = g_node_new (NULL);
iter->stamp = tree_store->stamp;
iter->stamp = priv->stamp;
iter->user_data = new_node;
g_node_insert (parent_node, position, new_node);
......@@ -1485,12 +1529,12 @@ gtk_tree_store_insert_with_values (GtkTreeStore *tree_store,
va_end (var_args);
if (maybe_need_sort && GTK_TREE_STORE_IS_SORTED (tree_store))
gtk_tree_store_sort_iter_changed (tree_store, iter, tree_store->sort_column_id, FALSE);
gtk_tree_store_sort_iter_changed (tree_store, iter, priv->sort_column_id, FALSE);
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
gtk_tree_model_row_inserted (GTK_TREE_MODEL (tree_store), path, iter);
if (parent_node != tree_store->root)
if (parent_node != priv->root)
{
if (new_node->prev == NULL && new_node->next == NULL)
{
......@@ -1529,6 +1573,7 @@ gtk_tree_store_insert_with_valuesv (GtkTreeStore *tree_store,
GValue *values,
gint n_values)
{
GtkTreeStorePrivate *priv = tree_store->priv;
GtkTreePath *path;
GNode *parent_node;
GNode *new_node;
......@@ -1547,13 +1592,13 @@ gtk_tree_store_insert_with_valuesv (GtkTreeStore *tree_store,
if (parent)
parent_node = parent->user_data;
else
parent_node = tree_store->root;
parent_node = priv->root;
tree_store->columns_dirty = TRUE;
priv->columns_dirty = TRUE;
new_node = g_node_new (NULL);
iter->stamp = tree_store->stamp;
iter->stamp = priv->stamp;
iter->user_data = new_node;
g_node_insert (parent_node, position, new_node);
......@@ -1562,12 +1607,12 @@ gtk_tree_store_insert_with_valuesv (GtkTreeStore *tree_store,
columns, values, n_values);
if (maybe_need_sort && GTK_TREE_STORE_IS_SORTED (tree_store))
gtk_tree_store_sort_iter_changed (tree_store, iter, tree_store->sort_column_id, FALSE);
gtk_tree_store_sort_iter_changed (tree_store, iter, priv->sort_column_id, FALSE);
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
gtk_tree_model_row_inserted (GTK_TREE_MODEL (tree_store), path, iter);
if (parent_node != tree_store->root)
if (parent_node != priv->root)
{
if (new_node->prev == NULL && new_node->next == NULL)
{
......@@ -1598,6 +1643,7 @@ gtk_tree_store_prepend (GtkTreeStore *tree_store,
GtkTreeIter *iter,