treeview: Add add() function to accessible

... and use that to emit the insertion signals.
This commit is contained in:
Benjamin Otte 2011-12-12 16:02:02 +01:00
parent 82a9f6faa0
commit c7b82c2cea
3 changed files with 33 additions and 8 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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)