From 1557d3b66a33eb1d4ac84c9a3b9f707874aad883 Mon Sep 17 00:00:00 2001 From: infirit Date: Wed, 10 Dec 2014 01:23:29 +0100 Subject: libview: Make sure a11y is initialized before checking whether it's enabled Taken from evince commit: 629c01120f1b2fb0ffdea5e95d2346bab5fb98ee From: Carlos Garcia Campos --- libview/ev-view.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/libview/ev-view.c b/libview/ev-view.c index f19b40d0..91617fff 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -4833,16 +4833,17 @@ ev_view_set_property (GObject *object, } #endif -static AtkObject * -ev_view_get_accessible (GtkWidget *widget) +/* Accessibility */ +static void +ev_view_init_accessibility (EvView *view) { static gboolean first_time = TRUE; if (first_time) { AtkObjectFactory *factory; AtkRegistry *registry; - GType derived_type; - GType derived_atk_type; + GType derived_type; + GType derived_atk_type; /* * Figure out whether accessibility is enabled by looking at the @@ -4859,13 +4860,26 @@ ev_view_get_accessible (GtkWidget *widget) atk_registry_set_factory_type (registry, EV_TYPE_VIEW, ev_view_accessible_factory_get_type ()); - EV_VIEW (widget)->a11y_enabled = TRUE; + view->a11y_enabled = TRUE; } first_time = FALSE; - } + } +} + +static AtkObject * +ev_view_get_accessible (GtkWidget *widget) +{ + ev_view_init_accessibility (EV_VIEW (widget)); return GTK_WIDGET_CLASS (ev_view_parent_class)->get_accessible (widget); } +static gboolean +ev_view_is_a11y_enabled (EvView *view) +{ + ev_view_init_accessibility (view); + return view->a11y_enabled; +} + static void ev_view_class_init (EvViewClass *class) { @@ -5233,7 +5247,7 @@ setup_caches (EvView *view) view->height_to_page_cache = ev_view_get_height_to_page_cache (view); view->pixbuf_cache = ev_pixbuf_cache_new (GTK_WIDGET (view), view->model, view->pixbuf_cache_size); view->page_cache = ev_page_cache_new (view->document); - if (view->a11y_enabled) { + if (ev_view_is_a11y_enabled (view)) { EvJobPageDataFlags flags = ev_page_cache_get_flags (view->page_cache); ev_page_cache_set_flags (view->page_cache, -- cgit v1.2.1