[gtk+] treeview: Add add() function to accessible
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] treeview: Add add() function to accessible
- Date: Fri, 16 Dec 2011 03:57:58 +0000 (UTC)
commit c7b82c2ceacab6e8a242815d8fbc680db7c52fac
Author: Benjamin Otte <otte redhat com>
Date: Mon Dec 12 16:02:02 2011 +0100
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 9fcc21e..b481295 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++)
@@ -2431,6 +2428,32 @@ get_header_from_column (GtkTreeViewColumn *tv_col)
}
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,
GtkRBNode *node)
@@ -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 677eb3b..aa23536 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 e00c837..22cc8b8 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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]