a11y: Remove index from cellaccessible

That way we also get rid of the refresh_index function.
This commit is contained in:
Benjamin Otte 2011-11-11 03:02:31 +01:00
parent f05d3f66b1
commit d265636526
4 changed files with 7 additions and 32 deletions

View File

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

View File

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

View File

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

View File

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