forked from AuroraMiddleware/gtk
a11y: Add a special-case for cell index querying
I could have tried to make GtkContainerCellAccessible implement GtkCellAccessibleParent, but the current implementation of that interface doesn't make sense for it.
This commit is contained in:
parent
02fd1e5a62
commit
533ee181de
@ -95,6 +95,11 @@ gtk_cell_accessible_get_index_in_parent (AtkObject *obj)
|
||||
int index;
|
||||
|
||||
cell = GTK_CELL_ACCESSIBLE (obj);
|
||||
|
||||
parent = atk_object_get_parent (obj);
|
||||
if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (parent))
|
||||
return g_list_index (GTK_CONTAINER_CELL_ACCESSIBLE (parent)->children, obj);
|
||||
|
||||
parent = gtk_widget_get_accessible (cell->widget);
|
||||
if (parent == NULL)
|
||||
return -1;
|
||||
|
@ -96,29 +96,6 @@ _gtk_container_cell_accessible_new (void)
|
||||
return container;
|
||||
}
|
||||
|
||||
static void
|
||||
recompute_child_indices (GtkContainerCellAccessible *container)
|
||||
{
|
||||
gint cur_index = 0;
|
||||
GList *l;
|
||||
|
||||
for (l = container->children; l; l = l->next)
|
||||
{
|
||||
GTK_CELL_ACCESSIBLE (l->data)->index = cur_index;
|
||||
cur_index++;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
refresh_child_index (GtkCellAccessible *cell)
|
||||
{
|
||||
AtkObject *parent;
|
||||
|
||||
parent = atk_object_get_parent (ATK_OBJECT (cell));
|
||||
|
||||
recompute_child_indices (GTK_CONTAINER_CELL_ACCESSIBLE (parent));
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_container_cell_accessible_add_child (GtkContainerCellAccessible *container,
|
||||
GtkCellAccessible *child)
|
||||
@ -132,7 +109,6 @@ _gtk_container_cell_accessible_add_child (GtkContainerCellAccessible *container,
|
||||
container->children = g_list_append (container->children, child);
|
||||
child->index = child_index;
|
||||
atk_object_set_parent (ATK_OBJECT (child), ATK_OBJECT (container));
|
||||
child->refresh_index = refresh_child_index;
|
||||
}
|
||||
|
||||
void
|
||||
@ -144,6 +120,5 @@ _gtk_container_cell_accessible_remove_child (GtkContainerCellAccessible *contain
|
||||
g_return_if_fail (container->NChildren > 0);
|
||||
|
||||
container->children = g_list_remove (container->children, child);
|
||||
recompute_child_indices (container);
|
||||
container->NChildren--;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user