[gtk+] treeview: Notify a11y about reordered rows
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] treeview: Notify a11y about reordered rows
- Date: Thu, 24 Nov 2011 17:31:27 +0000 (UTC)
commit 416b3ed20464611b5e1efa9a06b49ef239bdfa29
Author: Benjamin Otte <otte redhat com>
Date: Wed Nov 23 03:21:57 2011 +0100
treeview: Notify a11y about reordered rows
That way, no more signal handler is needed in the a11y code. Plus, we
avoid needless signal emissions for rows we don't care about.
gtk/a11y/gtktreeviewaccessible.c | 21 ++++++---------------
gtk/a11y/gtktreeviewaccessible.h | 1 +
gtk/gtktreeview.c | 2 ++
3 files changed, 9 insertions(+), 15 deletions(-)
---
diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c
index 629504d..0589c4a 100644
--- a/gtk/a11y/gtktreeviewaccessible.c
+++ b/gtk/a11y/gtktreeviewaccessible.c
@@ -1995,19 +1995,14 @@ destroy_count_func (GtkTreeView *tree_view,
accessible->n_children_deleted = count;
}
-static void
-model_rows_reordered (GtkTreeModel *tree_model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- gint *new_order,
- gpointer user_data)
+void
+_gtk_tree_view_accessible_reorder (GtkTreeView *treeview)
{
- GtkTreeView *tree_view = (GtkTreeView *)user_data;
- AtkObject *atk_obj;
GtkTreeViewAccessible *accessible;
- atk_obj = gtk_widget_get_accessible (GTK_WIDGET (tree_view));
- accessible = GTK_TREE_VIEW_ACCESSIBLE (atk_obj);
+ accessible = GTK_TREE_VIEW_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (treeview)));
+ if (accessible == NULL)
+ return;
if (accessible->idle_expand_id)
{
@@ -2017,7 +2012,7 @@ model_rows_reordered (GtkTreeModel *tree_model,
}
traverse_cells (accessible, NULL, FALSE);
- g_signal_emit_by_name (atk_obj, "row-reordered");
+ g_signal_emit_by_name (accessible, "row-reordered");
}
static void
@@ -2781,9 +2776,6 @@ connect_model_signals (GtkTreeView *view,
g_signal_connect_data (obj, "row-deleted",
G_CALLBACK (model_row_deleted), view, NULL,
G_CONNECT_AFTER);
- g_signal_connect_data (obj, "rows-reordered",
- G_CALLBACK (model_rows_reordered), view, NULL,
- G_CONNECT_AFTER);
}
static void
@@ -2797,7 +2789,6 @@ disconnect_model_signals (GtkTreeViewAccessible *accessible)
g_signal_handlers_disconnect_by_func (obj, model_row_changed, widget);
g_signal_handlers_disconnect_by_func (obj, model_row_inserted, widget);
g_signal_handlers_disconnect_by_func (obj, model_row_deleted, widget);
- g_signal_handlers_disconnect_by_func (obj, model_rows_reordered, widget);
}
/* Returns the column number of the specified GtkTreeViewColumn
diff --git a/gtk/a11y/gtktreeviewaccessible.h b/gtk/a11y/gtktreeviewaccessible.h
index 15f7c55..5048a5c 100644
--- a/gtk/a11y/gtktreeviewaccessible.h
+++ b/gtk/a11y/gtktreeviewaccessible.h
@@ -57,6 +57,7 @@ struct _GtkTreeViewAccessibleClass
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_remove (GtkTreeView *treeview,
GtkRBTree *tree,
GtkRBNode *node);
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 10f4b1d..8019ce1 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -9113,6 +9113,8 @@ gtk_tree_view_rows_reordered (GtkTreeModel *model,
_gtk_rbtree_reorder (tree, new_order, len);
+ _gtk_tree_view_accessible_reorder (tree_view);
+
gtk_widget_queue_draw (GTK_WIDGET (tree_view));
gtk_tree_view_dy_to_top_row (tree_view);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]