[evince/gnome-3-12] libview: Update ATK_STATE_SHOWING when the visible page range changes



commit 611b2aefdc277ddf99e1fd099f9c5da2c60d7879
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Apr 25 01:30:30 2014 -0400

    libview: Update ATK_STATE_SHOWING when the visible page range changes
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728664

 libview/ev-view-accessible.c |   30 ++++++++++++++++++++++++++++++
 libview/ev-view-accessible.h |    3 +++
 libview/ev-view.c            |    3 +++
 3 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/libview/ev-view-accessible.c b/libview/ev-view-accessible.c
index 0af047f..7bb0774 100644
--- a/libview/ev-view-accessible.c
+++ b/libview/ev-view-accessible.c
@@ -61,6 +61,8 @@ struct _EvViewAccessiblePrivate {
        GtkScrollType idle_scroll;
 
        gint previous_cursor_page;
+       gint start_page;
+       gint end_page;
 
        GPtrArray *children;
 };
@@ -537,3 +539,31 @@ _transform_doc_rect_to_atk_rect (EvViewAccessible *accessible,
        atk_rect->x2 = view_rect.x + view_rect.width;
        atk_rect->y2 = view_rect.y + view_rect.height;
 }
+
+void
+ev_view_accessible_set_page_range (EvViewAccessible *accessible,
+                                  gint start,
+                                  gint end)
+{
+       gint i;
+       AtkObject *page;
+
+       g_return_if_fail (EV_IS_VIEW_ACCESSIBLE (accessible));
+
+       for (i = accessible->priv->start_page; i <= accessible->priv->end_page; i++) {
+               if (i < start || i > end) {
+                       page = g_ptr_array_index (accessible->priv->children, i);
+                       atk_object_notify_state_change (page, ATK_STATE_SHOWING, FALSE);
+               }
+       }
+
+       for (i = start; i <= end; i++) {
+               if (i < accessible->priv->start_page || i > accessible->priv->end_page) {
+                       page = g_ptr_array_index (accessible->priv->children, i);
+                       atk_object_notify_state_change (page, ATK_STATE_SHOWING, TRUE);
+               }
+       }
+
+       accessible->priv->start_page = start;
+       accessible->priv->end_page = end;
+}
diff --git a/libview/ev-view-accessible.h b/libview/ev-view-accessible.h
index 0e6314c..1ff5e20 100644
--- a/libview/ev-view-accessible.h
+++ b/libview/ev-view-accessible.h
@@ -54,6 +54,9 @@ void       ev_view_accessible_set_model (EvViewAccessible *accessible,
                                         EvDocumentModel  *model);
 gint       ev_view_accessible_get_n_pages (EvViewAccessible *accessible);
 gint       ev_view_accessible_get_relevant_page (EvViewAccessible *accessible);
+void       ev_view_accessible_set_page_range (EvViewAccessible *accessible,
+                                             gint start,
+                                             gint end);
 void       _transform_doc_rect_to_atk_rect (EvViewAccessible *accessible,
                                            gint              page,
                                            EvRectangle      *doc_rect,
diff --git a/libview/ev-view.c b/libview/ev-view.c
index d922632..87e9deb 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -785,6 +785,9 @@ view_update_range_and_current_page (EvView *view)
                                        view->start_page,
                                        view->end_page,
                                        view->selection_info.selections);
+       ev_view_accessible_set_page_range (EV_VIEW_ACCESSIBLE (view->accessible),
+                                          view->start_page,
+                                          view->end_page);
 
        if (ev_pixbuf_cache_get_surface (view->pixbuf_cache, view->current_page))
            gtk_widget_queue_draw (GTK_WIDGET (view));


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