From c7b82c2ceacab6e8a242815d8fbc680db7c52fac Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 12 Dec 2011 16:02:02 +0100 Subject: [PATCH] treeview: Add add() function to accessible ... and use that to emit the insertion signals. --- gtk/a11y/gtktreeviewaccessible.c | 34 ++++++++++++++++++++++++-------- gtk/a11y/gtktreeviewaccessible.h | 3 +++ gtk/gtktreeview.c | 4 ++++ 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c index 9fcc21e7bb..b48129512e 100644 --- a/gtk/a11y/gtktreeviewaccessible.c +++ b/gtk/a11y/gtktreeviewaccessible.c @@ -1749,9 +1749,6 @@ model_row_inserted (GtkTreeModel *tree_model, else n_inserted = 1; - /* Generate row-inserted signal */ - g_signal_emit_by_name (atk_obj, "row-inserted", row, n_inserted); - /* Generate children-changed signals */ n_cols = get_n_columns (tree_view); for (child_row = row; child_row < (row + n_inserted); child_row++) @@ -2430,6 +2427,32 @@ get_header_from_column (GtkTreeViewColumn *tv_col) return rc; } +void +_gtk_tree_view_accessible_add (GtkTreeView *treeview, + GtkRBTree *tree, + GtkRBNode *node) +{ + GtkTreeViewAccessible *accessible; + guint row, n_rows; + + accessible = GTK_TREE_VIEW_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (treeview))); + if (accessible == NULL) + return; + + if (node == NULL) + { + row = tree->parent_tree ? _gtk_rbtree_node_get_index (tree->parent_tree, tree->parent_node) : 0; + n_rows = tree->root->total_count; + } + else + { + row = _gtk_rbtree_node_get_index (tree, node); + n_rows = 1 + (node->children ? node->children->root->total_count : 0); + } + + g_signal_emit_by_name (accessible, "row-inserted", row, n_rows); +} + void _gtk_tree_view_accessible_remove (GtkTreeView *treeview, GtkRBTree *tree, @@ -2701,10 +2724,5 @@ _gtk_tree_view_accessible_expanded (GtkTreeView *treeview, _gtk_tree_view_accessible_add_state (treeview, tree, node, GTK_CELL_RENDERER_EXPANDED); - - g_signal_emit_by_name (obj, - "row-inserted", - _gtk_rbtree_node_get_index (tree, node), - node->children->root->total_count); } diff --git a/gtk/a11y/gtktreeviewaccessible.h b/gtk/a11y/gtktreeviewaccessible.h index 677eb3b8af..aa23536d7f 100644 --- a/gtk/a11y/gtktreeviewaccessible.h +++ b/gtk/a11y/gtktreeviewaccessible.h @@ -53,6 +53,9 @@ GType _gtk_tree_view_accessible_get_type (void); /* called by treeview code */ void _gtk_tree_view_accessible_reorder (GtkTreeView *treeview); +void _gtk_tree_view_accessible_add (GtkTreeView *treeview, + GtkRBTree *tree, + GtkRBNode *node); void _gtk_tree_view_accessible_remove (GtkTreeView *treeview, GtkRBTree *tree, GtkRBNode *node); diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index e00c837770..22cc8b8d2e 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -8870,6 +8870,8 @@ gtk_tree_view_row_inserted (GtkTreeModel *model, tmpnode = _gtk_rbtree_insert_after (tree, tmpnode, height, FALSE); } + _gtk_tree_view_accessible_add (tree_view, tree, tmpnode); + done: if (height > 0) { @@ -11475,6 +11477,7 @@ gtk_tree_view_set_model (GtkTreeView *tree_view, { tree_view->priv->tree = _gtk_rbtree_new (); gtk_tree_view_build_tree (tree_view, tree_view->priv->tree, &iter, 1, FALSE); + _gtk_tree_view_accessible_add (tree_view, tree_view->priv->tree, NULL); } gtk_tree_path_free (path); @@ -12758,6 +12761,7 @@ gtk_tree_view_real_expand_row (GtkTreeView *tree_view, gtk_tree_path_get_depth (path) + 1, open_all); + _gtk_tree_view_accessible_add (tree_view, node->children, NULL); _gtk_tree_view_accessible_expanded (tree_view, tree, node); if (animate)