[gtk+] a11y: Add a special-case for cell index querying
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] a11y: Add a special-case for cell index querying
- Date: Wed, 16 Nov 2011 03:40:39 +0000 (UTC)
commit 533ee181de1b8d1c9ff45f9bfd575bd98eb91b2c
Author: Benjamin Otte <otte redhat com>
Date: Fri Nov 11 01:25:09 2011 +0100
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.
gtk/a11y/gtkcellaccessible.c | 5 +++++
gtk/a11y/gtkcontainercellaccessible.c | 25 -------------------------
2 files changed, 5 insertions(+), 25 deletions(-)
---
diff --git a/gtk/a11y/gtkcellaccessible.c b/gtk/a11y/gtkcellaccessible.c
index 54bd1ad..c68ff27 100644
--- a/gtk/a11y/gtkcellaccessible.c
+++ b/gtk/a11y/gtkcellaccessible.c
@@ -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;
diff --git a/gtk/a11y/gtkcontainercellaccessible.c b/gtk/a11y/gtkcontainercellaccessible.c
index ad5bdb4..d2f577d 100644
--- a/gtk/a11y/gtkcontainercellaccessible.c
+++ b/gtk/a11y/gtkcontainercellaccessible.c
@@ -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--;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]