[evolution] Bug 738463 - [a11y] Fix various problems with fetching children



commit 7bcec80942b77a5ca087aaa9ec5be7f9b57ce587
Author: Mike Gorse <mgorse suse com>
Date:   Mon Oct 20 15:25:21 2014 +0200

    Bug 738463 - [a11y] Fix various problems with fetching children

 calendar/gui/ea-calendar-helpers.c     |    4 ++++
 e-util/gal-a11y-e-table-click-to-add.c |    8 +++++++-
 e-util/gal-a11y-e-table-item.c         |    4 ++--
 e-util/gal-a11y-e-table.c              |   23 ++++++++++++++---------
 4 files changed, 27 insertions(+), 12 deletions(-)
---
diff --git a/calendar/gui/ea-calendar-helpers.c b/calendar/gui/ea-calendar-helpers.c
index fec0849..a60751d 100644
--- a/calendar/gui/ea-calendar-helpers.c
+++ b/calendar/gui/ea-calendar-helpers.c
@@ -89,6 +89,10 @@ ea_calendar_helpers_get_cal_view_from (GnomeCanvasItem *canvas_item)
        /* parent of canvas_item->canvas is the EDayView or EWeekView widget */
        canvas = canvas_item->canvas;
        view_widget = gtk_widget_get_parent (GTK_WIDGET (canvas));
+
+       if (view_widget && GTK_IS_BOX (view_widget))
+               view_widget = gtk_widget_get_parent (view_widget);
+
        if (!view_widget || !E_IS_CALENDAR_VIEW (view_widget))
                return NULL;
 
diff --git a/e-util/gal-a11y-e-table-click-to-add.c b/e-util/gal-a11y-e-table-click-to-add.c
index 6fabe31..6386ebb 100644
--- a/e-util/gal-a11y-e-table-click-to-add.c
+++ b/e-util/gal-a11y-e-table-click-to-add.c
@@ -145,7 +145,13 @@ etcta_get_name (AtkObject *obj)
 static gint
 etcta_get_n_children (AtkObject *accessible)
 {
-       return 1;
+       ETableClickToAdd * etcta;
+
+       etcta = E_TABLE_CLICK_TO_ADD (
+               atk_gobject_accessible_get_object (
+               ATK_GOBJECT_ACCESSIBLE (accessible)));
+
+       return (etcta->rect || etcta->row) ? 1 : 0;
 }
 
 static AtkObject *
diff --git a/e-util/gal-a11y-e-table-item.c b/e-util/gal-a11y-e-table-item.c
index a650d68..6990d4d 100644
--- a/e-util/gal-a11y-e-table-item.c
+++ b/e-util/gal-a11y-e-table-item.c
@@ -1115,7 +1115,7 @@ gal_a11y_e_table_item_new (ETableItem *item)
        AtkObject *parent;
        const gchar *name;
 
-       g_return_val_if_fail (item && item->cols >= 0 && item->rows >= 0, NULL);
+       g_return_val_if_fail (item && item->cols >= 0, NULL);
        a11y = g_object_new (gal_a11y_e_table_item_get_type (), NULL);
 
        atk_object_initialize (ATK_OBJECT (a11y), item);
@@ -1133,7 +1133,7 @@ gal_a11y_e_table_item_new (ETableItem *item)
        GET_PRIVATE (a11y)->item = item;
        /* Initialize cell data. */
        GET_PRIVATE (a11y)->cols = item->cols;
-       GET_PRIVATE (a11y)->rows = item->rows;
+       GET_PRIVATE (a11y)->rows = item->rows >= 0 ? item->rows : 0;
 
        GET_PRIVATE (a11y)->columns = e_table_header_get_columns (item->header);
        if (GET_PRIVATE (a11y)->columns == NULL)
diff --git a/e-util/gal-a11y-e-table.c b/e-util/gal-a11y-e-table.c
index 26bcc03..e766b18 100644
--- a/e-util/gal-a11y-e-table.c
+++ b/e-util/gal-a11y-e-table.c
@@ -132,9 +132,10 @@ et_get_n_children (AtkObject *accessible)
        et = E_TABLE (gtk_accessible_get_widget (GTK_ACCESSIBLE (a11y)));
 
        if (et && et->group) {
-               if (E_IS_TABLE_GROUP_LEAF (et->group))
-                       n = 1;
-               else if (E_IS_TABLE_GROUP_CONTAINER (et->group)) {
+               if (E_IS_TABLE_GROUP_LEAF (et->group)) {
+                       if (find_first_table_item (et->group))
+                               n++;
+               } else if (E_IS_TABLE_GROUP_CONTAINER (et->group)) {
                        ETableGroupContainer *etgc = (ETableGroupContainer *) et->group;
                        n = g_list_length (etgc->children);
                }
@@ -162,11 +163,13 @@ et_ref_child (AtkObject *accessible,
        if (i == 0 || i < child_no - 1) {
                if (E_IS_TABLE_GROUP_LEAF (et->group)) {
                        ETableItem *eti = find_first_table_item (et->group);
-                       AtkObject *aeti = eti_get_accessible (eti, accessible);
-                       if (aeti)
-                               g_object_ref (aeti);
-                       return aeti;
-
+                       AtkObject *aeti;
+                       if (eti) {
+                               aeti = eti_get_accessible (eti, accessible);
+                               if (aeti)
+                                       g_object_ref (aeti);
+                               return aeti;
+                       }
                } else if (E_IS_TABLE_GROUP_CONTAINER (et->group)) {
                        ETableGroupContainer *etgc = (ETableGroupContainer *) et->group;
                        ETableGroupContainerChildNode *child_node = g_list_nth_data (etgc->children, i);
@@ -179,7 +182,9 @@ et_ref_child (AtkObject *accessible,
                                return aeti;
                        }
                }
-       } else if (i == child_no -1) {
+       }
+
+       if (i == child_no -1) {
                ETableClickToAdd * etcta;
 
                if (et && et->use_click_to_add && et->click_to_add) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]