diff options
author | Luke Yelavich <[email protected]> | 2016-10-08 12:22:45 +1100 |
---|---|---|
committer | monsta <[email protected]> | 2016-10-18 16:31:31 +0300 |
commit | a8470c69525fd6b0c2c94755298753f90b813831 (patch) | |
tree | 23383171c1248f96c851846fec7e9cc5471c0ab1 /src/caja-zoom-control.c | |
parent | 28bf4f548f21554f82acd406aa64662b6a09c044 (diff) | |
download | caja-a8470c69525fd6b0c2c94755298753f90b813831.tar.bz2 caja-a8470c69525fd6b0c2c94755298753f90b813831.tar.xz |
Fix accessible object inherritance when used with GTK 3
Also disable eel accessibility code that is not needed.
Fixes https://github.com/mate-desktop/caja/issues/590
Diffstat (limited to 'src/caja-zoom-control.c')
-rw-r--r-- | src/caja-zoom-control.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/caja-zoom-control.c b/src/caja-zoom-control.c index 737a61b0..5f0549f1 100644 --- a/src/caja-zoom-control.c +++ b/src/caja-zoom-control.c @@ -37,6 +37,9 @@ #include <eel/eel-graphic-effects.h> #include <eel/eel-gtk-extensions.h> #include <gtk/gtk.h> +#if GTK_CHECK_VERSION(3, 0, 0) +#include <gtk/gtk-a11y.h> +#endif #include <gdk/gdkkeysyms.h> #include <libcaja-private/caja-file-utilities.h> #include <libcaja-private/caja-global-preferences.h> @@ -529,6 +532,7 @@ create_zoom_menu (CajaZoomControl *zoom_control) return menu; } +#if !GTK_CHECK_VERSION(3, 0, 0) static AtkObject * caja_zoom_control_get_accessible (GtkWidget *widget) { @@ -546,6 +550,7 @@ caja_zoom_control_get_accessible (GtkWidget *widget) return eel_accessibility_set_atk_object_return (widget, accessible); } +#endif static void caja_zoom_control_change_value (CajaZoomControl *zoom_control, @@ -689,7 +694,12 @@ caja_zoom_control_class_init (CajaZoomControlClass *class) widget_class = GTK_WIDGET_CLASS (class); +#if GTK_CHECK_VERSION(3, 0, 0) + gtk_widget_class_set_accessible_type (widget_class, + caja_zoom_control_accessible_get_type ()); +#else widget_class->get_accessible = caja_zoom_control_get_accessible; +#endif widget_class->scroll_event = caja_zoom_control_scroll_event; class->change_value = caja_zoom_control_change_value; @@ -968,6 +978,43 @@ caja_zoom_control_accessible_initialize (AtkObject *accessible, atk_object_set_role (accessible, ATK_ROLE_DIAL); } +#if GTK_CHECK_VERSION(3, 0, 0) +typedef struct _CajaZoomControlAccessible CajaZoomControlAccessible; +typedef struct _CajaZoomControlAccessibleClass CajaZoomControlAccessibleClass; + +struct _CajaZoomControlAccessible +{ + GtkContainerAccessible parent; +}; + +struct _CajaZoomControlAccessibleClass +{ + GtkContainerAccessibleClass parent_class; +}; + +G_DEFINE_TYPE_WITH_CODE (CajaZoomControlAccessible, + caja_zoom_control_accessible, + GTK_TYPE_CONTAINER_ACCESSIBLE, + G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, + caja_zoom_control_accessible_action_interface_init) + G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, + caja_zoom_control_accessible_value_interface_init)); +static void +caja_zoom_control_accessible_class_init (CajaZoomControlAccessibleClass *klass) +{ + AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); + accessible_parent_class = g_type_class_peek_parent (klass); + + atk_class->get_name = caja_zoom_control_accessible_get_name; + atk_class->get_description = caja_zoom_control_accessible_get_description; + atk_class->initialize = caja_zoom_control_accessible_initialize; +} + +static void +caja_zoom_control_accessible_init (CajaZoomControlAccessible *accessible) +{ +} +#else static void caja_zoom_control_accessible_class_init (AtkObjectClass *klass) { @@ -1016,6 +1063,7 @@ caja_zoom_control_accessible_get_type (void) return type; } +#endif void caja_zoom_control_set_active_appearance (CajaZoomControl *zoom_control, gboolean is_active) |