diff options
author | infirit <[email protected]> | 2014-12-10 01:23:29 +0100 |
---|---|---|
committer | infirit <[email protected]> | 2014-12-10 01:23:29 +0100 |
commit | 1557d3b66a33eb1d4ac84c9a3b9f707874aad883 (patch) | |
tree | 2a9143ae9924d0807b429166691724ae42ca607a /libview/ev-view.c | |
parent | b7a74f8f6f05a6c944385af7d641c909e258231e (diff) | |
download | atril-1557d3b66a33eb1d4ac84c9a3b9f707874aad883.tar.bz2 atril-1557d3b66a33eb1d4ac84c9a3b9f707874aad883.tar.xz |
libview: Make sure a11y is initialized before checking whether it's enabled
Taken from evince commit: 629c01120f1b2fb0ffdea5e95d2346bab5fb98ee
From: Carlos Garcia Campos <[email protected]>
Diffstat (limited to 'libview/ev-view.c')
-rw-r--r-- | libview/ev-view.c | 28 |
1 files 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, |