fix stupid missing statement

Tue Jun 26 12:59:28 2001  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_model): fix
	stupid missing statement

	* gtk/gtktreeview.c (gtk_tree_view_set_destroy_count_func): New
	private function for ATK.  It notifies you of how many _visible_
	children are deleted when a node is deleted.  Should be used by
	atk only.
This commit is contained in:
Jonathan Blandford 2001-06-26 17:01:53 +00:00 committed by Jonathan Blandford
parent 837b7120a8
commit 94f7d7e604
12 changed files with 155 additions and 5 deletions

View File

@ -1,3 +1,13 @@
Tue Jun 26 12:59:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_model): fix
stupid missing statement
* gtk/gtktreeview.c (gtk_tree_view_set_destroy_count_func): New
private function for ATK. It notifies you of how many _visible_
children are deleted when a node is deleted. Should be used by
atk only.
Tue Jun 26 11:06:34 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclist.c gtk/gtkentry.c gtk/gtkspinbutton.c:

View File

@ -1,3 +1,13 @@
Tue Jun 26 12:59:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_model): fix
stupid missing statement
* gtk/gtktreeview.c (gtk_tree_view_set_destroy_count_func): New
private function for ATK. It notifies you of how many _visible_
children are deleted when a node is deleted. Should be used by
atk only.
Tue Jun 26 11:06:34 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclist.c gtk/gtkentry.c gtk/gtkspinbutton.c:

View File

@ -1,3 +1,13 @@
Tue Jun 26 12:59:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_model): fix
stupid missing statement
* gtk/gtktreeview.c (gtk_tree_view_set_destroy_count_func): New
private function for ATK. It notifies you of how many _visible_
children are deleted when a node is deleted. Should be used by
atk only.
Tue Jun 26 11:06:34 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclist.c gtk/gtkentry.c gtk/gtkspinbutton.c:

View File

@ -1,3 +1,13 @@
Tue Jun 26 12:59:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_model): fix
stupid missing statement
* gtk/gtktreeview.c (gtk_tree_view_set_destroy_count_func): New
private function for ATK. It notifies you of how many _visible_
children are deleted when a node is deleted. Should be used by
atk only.
Tue Jun 26 11:06:34 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclist.c gtk/gtkentry.c gtk/gtkspinbutton.c:

View File

@ -1,3 +1,13 @@
Tue Jun 26 12:59:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_model): fix
stupid missing statement
* gtk/gtktreeview.c (gtk_tree_view_set_destroy_count_func): New
private function for ATK. It notifies you of how many _visible_
children are deleted when a node is deleted. Should be used by
atk only.
Tue Jun 26 11:06:34 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclist.c gtk/gtkentry.c gtk/gtkspinbutton.c:

View File

@ -1,3 +1,13 @@
Tue Jun 26 12:59:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_model): fix
stupid missing statement
* gtk/gtktreeview.c (gtk_tree_view_set_destroy_count_func): New
private function for ATK. It notifies you of how many _visible_
children are deleted when a node is deleted. Should be used by
atk only.
Tue Jun 26 11:06:34 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclist.c gtk/gtkentry.c gtk/gtkspinbutton.c:

View File

@ -1,3 +1,13 @@
Tue Jun 26 12:59:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_model): fix
stupid missing statement
* gtk/gtktreeview.c (gtk_tree_view_set_destroy_count_func): New
private function for ATK. It notifies you of how many _visible_
children are deleted when a node is deleted. Should be used by
atk only.
Tue Jun 26 11:06:34 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclist.c gtk/gtkentry.c gtk/gtkspinbutton.c:

View File

@ -278,7 +278,7 @@ gtk_tree_model_sort_set_model (GtkTreeModelSort *tree_model_sort,
if (tree_model_sort->root)
{
gtk_tree_model_sort_free_level (tree_model_sort->root);
tree_model_sort->root;
tree_model_sort->root = NULL;
}
if (tree_model_sort->sort_list)

View File

@ -135,6 +135,11 @@ struct _GtkTreeViewPrivate
GList *column_drag_info;
GtkTreeViewColumnReorder *cur_reorder;
/* ATK Hack */
GtkTreeDestroyCountFunc destroy_count_func;
gpointer destroy_count_data;
GtkDestroyNotify destroy_count_destroy;
/* Scroll timeout (e.g. during dnd) */
guint scroll_timeout;

View File

@ -836,7 +836,6 @@ gtk_tree_view_init (GtkTreeView *tree_view)
gtk_tree_view_set_adjustments (tree_view, NULL, NULL);
tree_view->priv->selection = _gtk_tree_selection_new_with_tree_view (tree_view);
_gtk_tree_view_update_size (tree_view);
}
@ -995,6 +994,13 @@ gtk_tree_view_destroy (GtkObject *object)
tree_view->priv->column_drop_func_data = NULL;
}
if (tree_view->priv->destroy_count_destroy &&
tree_view->priv->destroy_count_data)
{
(* tree_view->priv->destroy_count_destroy) (tree_view->priv->destroy_count_data);
tree_view->priv->destroy_count_data = NULL;
}
gtk_tree_row_reference_free (tree_view->priv->cursor);
tree_view->priv->cursor = NULL;
@ -4414,6 +4420,16 @@ gtk_tree_view_has_child_toggled (GtkTreeModel *model,
gtk_tree_path_free (path);
}
static void
count_children_helper (GtkRBTree *tree,
GtkRBNode *node,
gpointer data)
{
if (node->children)
_gtk_rbtree_traverse (node->children, node->children->root, G_POST_ORDER, count_children_helper, data);
((gint *)data)++;
}
static void
gtk_tree_view_deleted (GtkTreeModel *model,
GtkTreePath *path,
@ -4446,6 +4462,14 @@ gtk_tree_view_deleted (GtkTreeModel *model,
/* Ensure we don't have a dangling pointer to a dead node */
ensure_unprelighted (tree_view);
if (tree_view->priv->destroy_count_func)
{
gint child_count = 0;
if (node->children)
_gtk_rbtree_traverse (node->children, node->children->root, G_POST_ORDER, count_children_helper, &child_count);
(* tree_view->priv->destroy_count_func) (tree_view, path, child_count, tree_view->priv->destroy_count_data);
}
if (tree->root->count == 1)
{
if (tree_view->priv->tree == tree)
@ -7148,6 +7172,14 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
/* Ensure we don't have a dangling pointer to a dead node */
ensure_unprelighted (tree_view);
if (tree_view->priv->destroy_count_func)
{
gint child_count = 0;
if (node->children)
_gtk_rbtree_traverse (node->children, node->children->root, G_POST_ORDER, count_children_helper, &child_count);
(* tree_view->priv->destroy_count_func) (tree_view, path, child_count, tree_view->priv->destroy_count_data);
}
if (gtk_tree_view_unref_and_check_selection_tree (tree_view, node->children))
g_signal_emit_by_name (G_OBJECT (tree_view->priv->selection), "changed", 0);
_gtk_rbtree_remove (node->children);
@ -8158,3 +8190,30 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
return drawable;
}
/**
* gtk_tree_view_set_destroy_count_func:
* @tree_view: A #GtkTreeView
* @func: Function to be called when a view row is destroyed, or NULL
* @data: User data to be passed to @func, or NULL
* @destroy: Destroy notifier for @data, or NULL
*
* This function should almost never be used. It is meant for private use by
* ATK for determining the number of visible rows that are removed when the user
* collapses a row, or a row is deleted.
**/
void
gtk_tree_view_set_destroy_count_func (GtkTreeView *tree_view,
GtkTreeDestroyCountFunc func,
gpointer data,
GtkDestroyNotify destroy)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
if (tree_view->priv->destroy_count_destroy)
(* tree_view->priv->destroy_count_destroy) (tree_view->priv->destroy_count_data);
tree_view->priv->destroy_count_func = func;
tree_view->priv->destroy_count_data = data;
tree_view->priv->destroy_count_destroy = destroy;
}

View File

@ -275,6 +275,21 @@ gboolean gtk_tree_view_get_dest_row_at_pos (GtkTreeView
GdkPixmap *gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
GtkTreePath *path);
/* This function should really never be used. It is just for use by ATK.
*/
typedef void (* GtkTreeDestroyCountFunc) (GtkTreeView *tree_view,
GtkTreePath *path,
gint children,
gpointer user_data);
void gtk_tree_view_set_destroy_count_func (GtkTreeView *tree_view,
GtkTreeDestroyCountFunc func,
gpointer data,
GtkDestroyNotify destroy);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -1446,10 +1446,11 @@ run_automated_tests (void)
{
/* Make sure tree store mutations don't crash anything */
GtkTreeStore *store;
GtkTreeIter root;
store = gtk_tree_store_new_with_types (1, G_TYPE_INT);
treestore_torture_recurse (store, NULL, 0);
gtk_tree_model_get_iter_root (GTK_TREE_MODEL (store), &root);
treestore_torture_recurse (store, &root, 0);
g_object_unref (G_OBJECT (store));
}