From d26563652608e52f1f30bb4400ac947a748af79b Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 11 Nov 2011 03:02:31 +0100 Subject: [PATCH] a11y: Remove index from cellaccessible That way we also get rid of the refresh_index function. --- gtk/a11y/gtkcellaccessible.c | 20 ++------------------ gtk/a11y/gtkcellaccessible.h | 8 +------- gtk/a11y/gtkcontainercellaccessible.c | 5 +---- gtk/a11y/gtktreeviewaccessible.c | 6 +++--- 4 files changed, 7 insertions(+), 32 deletions(-) diff --git a/gtk/a11y/gtkcellaccessible.c b/gtk/a11y/gtkcellaccessible.c index c68ff27125..fdccd19ae4 100644 --- a/gtk/a11y/gtkcellaccessible.c +++ b/gtk/a11y/gtkcellaccessible.c @@ -92,7 +92,6 @@ gtk_cell_accessible_get_index_in_parent (AtkObject *obj) { GtkCellAccessible *cell; AtkObject *parent; - int index; cell = GTK_CELL_ACCESSIBLE (obj); @@ -104,18 +103,7 @@ gtk_cell_accessible_get_index_in_parent (AtkObject *obj) if (parent == NULL) return -1; - index = _gtk_cell_accessible_parent_get_child_index (GTK_CELL_ACCESSIBLE_PARENT (parent), cell); - if (index >= 0) - return index; - - if (atk_state_set_contains_state (cell->state_set, ATK_STATE_STALE) && - cell->refresh_index != NULL) - { - cell->refresh_index (cell); - atk_state_set_remove_state (cell->state_set, ATK_STATE_STALE); - } - - return cell->index; + return _gtk_cell_accessible_parent_get_child_index (GTK_CELL_ACCESSIBLE_PARENT (parent), cell); } static AtkStateSet * @@ -145,8 +133,6 @@ _gtk_cell_accessible_init (GtkCellAccessible *cell) { cell->widget = NULL; cell->action_list = NULL; - cell->index = 0; - cell->refresh_index = NULL; cell->state_set = atk_state_set_new (); atk_state_set_add_state (cell->state_set, ATK_STATE_TRANSIENT); atk_state_set_add_state (cell->state_set, ATK_STATE_ENABLED); @@ -164,12 +150,10 @@ widget_destroyed (GtkWidget *widget, void _gtk_cell_accessible_initialise (GtkCellAccessible *cell, GtkWidget *widget, - AtkObject *parent, - gint index) + AtkObject *parent) { cell->widget = widget; atk_object_set_parent (ATK_OBJECT (cell), parent); - cell->index = index; g_signal_connect_object (G_OBJECT (widget), "destroy", G_CALLBACK (widget_destroyed), cell, 0); diff --git a/gtk/a11y/gtkcellaccessible.h b/gtk/a11y/gtkcellaccessible.h index 234ca7d3dd..ceab222958 100644 --- a/gtk/a11y/gtkcellaccessible.h +++ b/gtk/a11y/gtkcellaccessible.h @@ -39,13 +39,8 @@ struct _GtkCellAccessible AtkObject parent; GtkWidget *widget; - /* This cached value is used only by atk_object_get_index_in_parent() - * which updates the value when it is stale. - */ - gint index; AtkStateSet *state_set; GList *action_list; - void (*refresh_index) (GtkCellAccessible *cell); }; struct _GtkCellAccessibleClass @@ -57,8 +52,7 @@ GType _gtk_cell_accessible_get_type (void); void _gtk_cell_accessible_initialise (GtkCellAccessible *cell, GtkWidget *widget, - AtkObject *parent, - gint index); + AtkObject *parent); gboolean _gtk_cell_accessible_add_state (GtkCellAccessible *cell, AtkStateType state_type, gboolean emit_signal); diff --git a/gtk/a11y/gtkcontainercellaccessible.c b/gtk/a11y/gtkcontainercellaccessible.c index d2f577d938..6232249dd1 100644 --- a/gtk/a11y/gtkcontainercellaccessible.c +++ b/gtk/a11y/gtkcontainercellaccessible.c @@ -100,14 +100,11 @@ void _gtk_container_cell_accessible_add_child (GtkContainerCellAccessible *container, GtkCellAccessible *child) { - gint child_index; - g_return_if_fail (GTK_IS_CONTAINER_CELL_ACCESSIBLE (container)); g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (child)); - child_index = container->NChildren++; + container->NChildren++; container->children = g_list_append (container->children, child); - child->index = child_index; atk_object_set_parent (ATK_OBJECT (child), ATK_OBJECT (container)); } diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c index 0445c34faf..1b6167f259 100644 --- a/gtk/a11y/gtktreeviewaccessible.c +++ b/gtk/a11y/gtktreeviewaccessible.c @@ -566,7 +566,7 @@ gtk_tree_view_accessible_ref_child (AtkObject *obj, container = _gtk_container_cell_accessible_new (); container_cell = GTK_CELL_ACCESSIBLE (container); - _gtk_cell_accessible_initialise (container_cell, widget, ATK_OBJECT (accessible), i); + _gtk_cell_accessible_initialise (container_cell, widget, ATK_OBJECT (accessible)); /* The GtkTreeViewAccessibleCellInfo structure for the container will * be before the ones for the cells so that the first one we find for @@ -596,7 +596,7 @@ gtk_tree_view_accessible_ref_child (AtkObject *obj, /* Create the GtkTreeViewAccessibleCellInfo structure for this cell */ cell_info_new (accessible, tree_model, path, tv_col, cell); - _gtk_cell_accessible_initialise (cell, widget, parent, i); + _gtk_cell_accessible_initialise (cell, widget, parent); /* Set state if it is expandable */ if (is_expander) @@ -630,7 +630,7 @@ gtk_tree_view_accessible_ref_child (AtkObject *obj, /* Create the GtkTreeViewAccessibleCellInfo for this cell */ cell_info_new (accessible, tree_model, path, tv_col, cell); - _gtk_cell_accessible_initialise (cell, widget, parent, i); + _gtk_cell_accessible_initialise (cell, widget, parent); if (container) _gtk_container_cell_accessible_add_child (container, cell);