summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Yelavich <[email protected]>2016-10-08 12:22:45 +1100
committerLuke Yelavich <[email protected]>2016-10-11 19:36:03 +1100
commit99a9c6e7c6a67484c029518bdb31160469627701 (patch)
tree2d7268eb3491d3a642f2cc26654445c2df5b7343
parent6e142d59d7408e53ab1e579dba62517b6f59e307 (diff)
downloadcaja-99a9c6e7c6a67484c029518bdb31160469627701.tar.bz2
caja-99a9c6e7c6a67484c029518bdb31160469627701.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
-rw-r--r--eel/eel-accessibility.c5
-rw-r--r--eel/eel-accessibility.h2
-rw-r--r--eel/eel-canvas.c84
-rw-r--r--eel/eel-canvas.h20
-rw-r--r--eel/eel-editable-label.c55
-rw-r--r--eel/eel-labeled-image.c77
-rw-r--r--libcaja-private/caja-icon-container.c57
-rw-r--r--src/caja-zoom-control.c48
8 files changed, 343 insertions, 5 deletions
diff --git a/eel/eel-accessibility.c b/eel/eel-accessibility.c
index 707756d1..da586ddc 100644
--- a/eel/eel-accessibility.c
+++ b/eel/eel-accessibility.c
@@ -63,6 +63,7 @@ eel_accessibility_set_up_label_widget_relation (GtkWidget *label, GtkWidget *wid
*
* Return value: the registered type, or 0 on failure.
**/
+#if !GTK_CHECK_VERSION(3, 0, 0)
GType
eel_accessibility_create_derived_type (const char *type_name,
GType existing_gobject_with_proxy,
@@ -113,7 +114,7 @@ eel_accessibility_create_derived_type (const char *type_name,
return type;
}
-
+#endif
static GQuark
get_quark_accessible (void)
@@ -207,6 +208,7 @@ eel_accessibility_destroy (gpointer data,
*
* Return value: @atk_object.
**/
+#if !GTK_CHECK_VERSION(3, 0, 0)
AtkObject *
eel_accessibility_set_atk_object_return (gpointer object,
AtkObject *atk_object)
@@ -224,6 +226,7 @@ eel_accessibility_set_atk_object_return (gpointer object,
return atk_object;
}
+#endif
static GailTextUtil *
get_simple_text (gpointer object)
diff --git a/eel/eel-accessibility.h b/eel/eel-accessibility.h
index 45514c91..a1f68d56 100644
--- a/eel/eel-accessibility.h
+++ b/eel/eel-accessibility.h
@@ -38,11 +38,13 @@ typedef void (*EelAccessibilityClassInitFn) (AtkObjectClass *klass);
AtkObject *eel_accessibility_get_atk_object (gpointer object);
AtkObject *eel_accessibility_for_object (gpointer object);
gpointer eel_accessibility_get_gobject (AtkObject *object);
+#if !GTK_CHECK_VERSION(3, 0, 0)
AtkObject *eel_accessibility_set_atk_object_return (gpointer object,
AtkObject *atk_object);
GType eel_accessibility_create_derived_type (const char *type_name,
GType existing_gobject_with_proxy,
EelAccessibilityClassInitFn class_init);
+#endif
void eel_accessibility_set_name (gpointer object,
const char *name);
void eel_accessibility_set_description (gpointer object,
diff --git a/eel/eel-canvas.c b/eel/eel-canvas.c
index ae4faaa7..74132149 100644
--- a/eel/eel-canvas.c
+++ b/eel/eel-canvas.c
@@ -68,6 +68,9 @@
#include <stdio.h>
#include <gdk/gdkprivate.h>
#include <gtk/gtk.h>
+#if GTK_CHECK_VERSION(3,2,0)
+#include <gtk/gtk-a11y.h>
+#endif
#include <glib/gi18n-lib.h>
#if GTK_CHECK_VERSION(3,0,0)
# include <cairo/cairo-gobject.h>
@@ -2158,6 +2161,25 @@ eel_canvas_accessible_ref_child (AtkObject *obj,
return atk_object;
}
+#if GTK_CHECK_VERSION(3, 0, 0)
+G_DEFINE_TYPE (EelCanvasAccessible, eel_canvas_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE)
+
+static void
+eel_canvas_accessible_class_init (EelCanvasAccessibleClass *klass)
+{
+ AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
+ accessible_parent_class = g_type_class_peek_parent (atk_class);
+
+ atk_class->initialize = eel_canvas_accessible_initialize;
+ atk_class->get_n_children = eel_canvas_accessible_get_n_children;
+ atk_class->ref_child = eel_canvas_accessible_ref_child;
+}
+
+static void
+eel_canvas_accessible_init (EelCanvasAccessible *accessible)
+{
+}
+#else
static void
eel_canvas_accessible_class_init (AtkObjectClass *klass)
{
@@ -2275,7 +2297,7 @@ eel_canvas_accessible_factory_get_type (void)
return type;
}
-
+#endif
/* Class initialization function for EelCanvasClass */
static void
@@ -2336,9 +2358,13 @@ eel_canvas_class_init (EelCanvasClass *klass)
G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
#endif
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_class_set_accessible_type (widget_class, eel_canvas_accessible_get_type ());
+#else
atk_registry_set_factory_type (atk_get_default_registry (),
EEL_TYPE_CANVAS,
eel_canvas_accessible_factory_get_type ());
+#endif
}
/* Callback used when the root item of a canvas is destroyed. The user should
@@ -3424,7 +3450,7 @@ idle_handler (gpointer data)
{
EelCanvas *canvas;
-#if !GTK_CHECK_VERSION (3, 0, 0)
+#if !GTK_CHECK_VERSION(3, 0, 0)
GDK_THREADS_ENTER ();
#endif
@@ -4270,6 +4296,43 @@ eel_canvas_item_accessible_ref_state_set (AtkObject *accessible)
return state_set;
}
+#if GTK_CHECK_VERSION(3, 0, 0)
+static GType eel_canvas_item_accessible_get_type (void);
+
+typedef struct _EelCanvasItemAccessible EelCanvasItemAccessible;
+typedef struct _EelCanvasItemAccessibleClass EelCanvasItemAccessibleClass;
+
+struct _EelCanvasItemAccessible
+{
+ GtkAccessible parent;
+};
+
+struct _EelCanvasItemAccessibleClass
+{
+ GtkAccessibleClass parent_class;
+};
+
+G_DEFINE_TYPE_WITH_CODE (EelCanvasItemAccessible,
+ eel_canvas_item_accessible,
+ ATK_TYPE_GOBJECT_ACCESSIBLE,
+ G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT,
+ eel_canvas_item_accessible_component_interface_init));
+
+static void
+eel_canvas_item_accessible_class_init (EelCanvasItemAccessibleClass *klass)
+{
+ AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
+ accessible_item_parent_class = g_type_class_peek_parent (atk_class);
+
+ atk_class->initialize = eel_canvas_item_accessible_initialize;
+ atk_class->ref_state_set = eel_canvas_item_accessible_ref_state_set;
+}
+
+static void
+eel_canvas_item_accessible_init (EelCanvasItemAccessible *accessible)
+{
+}
+#else
static void
eel_canvas_item_accessible_class_init (AtkObjectClass *klass)
{
@@ -4323,7 +4386,7 @@ eel_canvas_item_accessible_get_type (void)
return type;
}
-
+#endif
static AtkObject *
eel_canvas_item_accessible_create (GObject *for_object)
{
@@ -4370,6 +4433,20 @@ eel_canvas_item_accessible_factory_class_init (AtkObjectFactoryClass *klass)
klass->get_accessible_type = eel_canvas_item_accessible_factory_get_accessible_type;
}
+#if GTK_CHECK_VERSION(3, 0, 0)
+static GType eel_canvas_item_accessible_factory_get_type (void);
+
+typedef AtkObjectFactory EelCanvasItemAccessibleFactory;
+typedef AtkObjectFactoryClass EelCanvasItemAccessibleFactoryClass;
+G_DEFINE_TYPE (EelCanvasItemAccessibleFactory, eel_canvas_item_accessible_factory,
+ ATK_TYPE_OBJECT_FACTORY)
+
+static void
+eel_canvas_item_accessible_factory_init (EelCanvasItemAccessibleFactory *accessible)
+{
+}
+
+#else
static GType
eel_canvas_item_accessible_factory_get_type (void)
{
@@ -4396,6 +4473,7 @@ eel_canvas_item_accessible_factory_get_type (void)
return type;
}
+#endif
/* Class initialization function for EelCanvasItemClass */
static void
diff --git a/eel/eel-canvas.h b/eel/eel-canvas.h
index fcb4cb3d..b168aed8 100644
--- a/eel/eel-canvas.h
+++ b/eel/eel-canvas.h
@@ -38,6 +38,9 @@
#define EEL_CANVAS_H
#include <gtk/gtk.h>
+#if GTK_CHECK_VERSION(3, 0, 0)
+#include <gtk/gtk-a11y.h>
+#endif
#include <gdk/gdk.h>
#include <stdarg.h>
@@ -555,6 +558,23 @@ extern "C" {
void eel_canvas_world_to_window (EelCanvas *canvas,
double worldx, double worldy, double *winx, double *winy);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ GType eel_canvas_accessible_get_type (void);
+
+ typedef struct _EelCanvasAccessible EelCanvasAccessible;
+ typedef struct _EelCanvasAccessibleClass EelCanvasAccessibleClass;
+
+ struct _EelCanvasAccessible
+ {
+ GtkContainerAccessible parent;
+ };
+
+ struct _EelCanvasAccessibleClass
+ {
+ GtkContainerAccessibleClass parent_class;
+ };
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/eel/eel-editable-label.c b/eel/eel-editable-label.c
index be172a75..37564275 100644
--- a/eel/eel-editable-label.c
+++ b/eel/eel-editable-label.c
@@ -35,6 +35,9 @@
#include <glib/gi18n-lib.h>
#include <pango/pango.h>
#include <gtk/gtk.h>
+#if GTK_CHECK_VERSION(3, 0, 0)
+#include <gtk/gtk-a11y.h>
+#endif
#include <gdk/gdkkeysyms.h>
/* Some compatibility defines to let us build on both Gtk2 and Gtk3 */
@@ -137,7 +140,11 @@ static gint eel_editable_label_focus_in (GtkWidget
GdkEventFocus *event);
static gint eel_editable_label_focus_out (GtkWidget *widget,
GdkEventFocus *event);
+#if GTK_CHECK_VERSION(3, 0, 0)
+static GType eel_editable_label_accessible_get_type (void);
+#else
static AtkObject *eel_editable_label_get_accessible (GtkWidget *widget);
+#endif
static void eel_editable_label_commit_cb (GtkIMContext *context,
const gchar *str,
EelEditableLabel *label);
@@ -282,7 +289,11 @@ eel_editable_label_class_init (EelEditableLabelClass *class)
widget_class->key_release_event = eel_editable_label_key_release;
widget_class->focus_in_event = eel_editable_label_focus_in;
widget_class->focus_out_event = eel_editable_label_focus_out;
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_class_set_accessible_type (widget_class, eel_editable_label_accessible_get_type ());
+#else
widget_class->get_accessible = eel_editable_label_get_accessible;
+#endif
class->move_cursor = eel_editable_label_move_cursor;
class->delete_from_cursor = eel_editable_label_delete_from_cursor;
@@ -3765,6 +3776,20 @@ typedef struct
gint position;
} EelEditableLabelAccessiblePaste;
+#if GTK_CHECK_VERSION(3, 0, 0)
+typedef struct _EelEditableLabelAccessible EelEditableLabelAccessible;
+typedef struct _EelEditableLabelAccessibleClass EelEditableLabelAccessibleClass;
+
+struct _EelEditableLabelAccessible
+{
+ GtkWidgetAccessible parent;
+};
+
+struct _EelEditableLabelAccessibleClass
+{
+ GtkWidgetAccessibleClass parent_class;
+};
+#endif
static gchar*
eel_editable_label_accessible_get_text (AtkText *text,
@@ -4619,6 +4644,34 @@ eel_editable_label_accessible_finalize (GObject *object)
G_OBJECT_CLASS (a11y_parent_class)->finalize (object);
}
+#if GTK_CHECK_VERSION(3, 0, 0)
+static void
+eel_editable_label_accessible_class_init (EelEditableLabelAccessibleClass *klass)
+{
+ AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ a11y_parent_class = g_type_class_peek_parent (klass);
+
+ atk_class->initialize = eel_editable_label_accessible_initialize;
+ atk_class->get_name = eel_editable_label_accessible_get_name;
+ atk_class->ref_state_set = eel_editable_label_accessible_ref_state_set;
+ gobject_class->finalize = eel_editable_label_accessible_finalize;
+}
+
+static void
+eel_editable_label_accessible_init (EelEditableLabelAccessible *accessible)
+{
+}
+
+G_DEFINE_TYPE_WITH_CODE (EelEditableLabelAccessible,
+ eel_editable_label_accessible,
+ GTK_TYPE_WIDGET_ACCESSIBLE,
+ G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT,
+ atk_editable_text_interface_init)
+ G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT,
+ atk_text_interface_init));
+#else
static void
eel_editable_label_accessible_class_init (AtkObjectClass *klass)
{
@@ -4671,4 +4724,4 @@ eel_editable_label_get_accessible (GtkWidget *widget)
return eel_accessibility_set_atk_object_return (widget, accessible);
}
-
+#endif
diff --git a/eel/eel-labeled-image.c b/eel/eel-labeled-image.c
index 02b28bdc..27f13d25 100644
--- a/eel/eel-labeled-image.c
+++ b/eel/eel-labeled-image.c
@@ -31,6 +31,9 @@
#include "eel-gtk-extensions.h"
#include "eel-accessibility.h"
#include <gtk/gtk.h>
+#if GTK_CHECK_VERSION(3, 0, 0)
+#include <gtk/gtk-a11y.h>
+#endif
#include <gdk/gdkkeysyms.h>
#include <atk/atkimage.h>
@@ -92,7 +95,11 @@ static GType eel_labeled_image_radio_button_get_type (void);
static GType eel_labeled_image_toggle_button_get_type (void);
/* GtkWidgetClass methods */
+#if GTK_CHECK_VERSION(3, 0, 0)
+static GType eel_labeled_image_accessible_get_type (void);
+#else
static AtkObject *eel_labeled_image_get_accessible (GtkWidget *widget);
+#endif
/* Private EelLabeledImage methods */
static EelDimensions labeled_image_get_image_dimensions (const EelLabeledImage *labeled_image);
@@ -634,7 +641,11 @@ eel_labeled_image_class_init (EelLabeledImageClass *labeled_image_class)
#endif
widget_class->map = eel_labeled_image_map;
widget_class->unmap = eel_labeled_image_unmap;
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_class_set_accessible_type (widget_class, eel_labeled_image_accessible_get_type ());
+#else
widget_class->get_accessible = eel_labeled_image_get_accessible;
+#endif
/* GtkContainerClass */
container_class->add = eel_labeled_image_add;
@@ -2312,7 +2323,32 @@ static void
eel_labeled_image_accessible_initialize (AtkObject *accessible,
gpointer widget)
{
+#if GTK_CHECK_VERSION(3, 0, 0)
+ a11y_parent_class->initialize (accessible, widget);
+
+ if (GTK_IS_CHECK_BUTTON (widget))
+ {
+ atk_object_set_role (accessible, ATK_ROLE_CHECK_BOX);
+ }
+ else if (GTK_IS_RADIO_BUTTON (widget))
+ {
+ atk_object_set_role (accessible, ATK_ROLE_RADIO_BUTTON);
+ }
+ else if (GTK_IS_TOGGLE_BUTTON (widget))
+ {
+ atk_object_set_role (accessible, ATK_ROLE_TOGGLE_BUTTON);
+ }
+ else if (GTK_IS_BUTTON (widget))
+ {
+ atk_object_set_role (accessible, ATK_ROLE_PUSH_BUTTON);
+ }
+ else
+ {
+ atk_object_set_role (accessible, ATK_ROLE_IMAGE);
+ }
+#else
a11y_parent_class->initialize (accessible, widget);
+#endif
}
static EelLabeledImage *
@@ -2374,6 +2410,40 @@ eel_labeled_image_accessible_image_interface_init (AtkImageIface *iface)
iface->get_image_size = eel_labeled_image_accessible_image_get_size;
}
+#if GTK_CHECK_VERSION(3, 0, 0)
+typedef struct _EelLabeledImageAccessible EelLabeledImageAccessible;
+typedef struct _EelLabeledImageAccessibleClass EelLabeledImageAccessibleClass;
+
+struct _EelLabeledImageAccessible
+{
+ GtkContainerAccessible parent;
+};
+
+struct _EelLabeledImageAccessibleClass
+{
+ GtkContainerAccessibleClass parent_class;
+};
+
+G_DEFINE_TYPE_WITH_CODE (EelLabeledImageAccessible,
+ eel_labeled_image_accessible,
+ GTK_TYPE_CONTAINER_ACCESSIBLE,
+ G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE,
+ eel_labeled_image_accessible_image_interface_init));
+static void
+eel_labeled_image_accessible_class_init (EelLabeledImageAccessibleClass *klass)
+{
+ AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
+ a11y_parent_class = g_type_class_peek_parent (klass);
+
+ atk_class->get_name = eel_labeled_image_accessible_get_name;
+ atk_class->initialize = eel_labeled_image_accessible_initialize;
+}
+
+static void
+eel_labeled_image_accessible_init (EelLabeledImageAccessible *accessible)
+{
+}
+#else
static void
eel_labeled_image_accessible_class_init (AtkObjectClass *klass)
{
@@ -2465,11 +2535,18 @@ eel_labeled_image_get_accessible (GtkWidget *widget)
return eel_accessibility_set_atk_object_return (widget, accessible);
}
+#endif
static void
eel_labeled_image_button_class_init (GtkWidgetClass *klass)
{
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_class_set_accessible_type (GTK_WIDGET_CLASS (klass),
+ eel_labeled_image_accessible_get_type ());
+
+#else
klass->get_accessible = eel_labeled_image_get_accessible;
+#endif
}
static GType
diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c
index af8de17e..44ccc05d 100644
--- a/libcaja-private/caja-icon-container.c
+++ b/libcaja-private/caja-icon-container.c
@@ -44,6 +44,9 @@
#include <eel/eel-art-extensions.h>
#include <eel/eel-editable-label.h>
#include <eel/eel-string.h>
+#if GTK_CHECK_VERSION(3, 0, 0)
+#include <eel/eel-canvas.h>
+#endif
#include <eel/eel-canvas-rect-ellipse.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
@@ -182,6 +185,21 @@ typedef struct
static GType caja_icon_container_accessible_get_type (void);
+#if GTK_CHECK_VERSION(3, 0, 0)
+typedef struct _CajaIconContainerAccessible CajaIconContainerAccessible;
+typedef struct _CajaIconContainerAccessibleClass CajaIconContainerAccessibleClass;
+
+struct _CajaIconContainerAccessible
+{
+ EelCanvasAccessible parent;
+};
+
+struct _CajaIconContainerAccessibleClass
+{
+ EelCanvasAccessibleClass parent_class;
+};
+#endif
+
static void activate_selected_items (CajaIconContainer *container);
static void activate_selected_items_alternate (CajaIconContainer *container,
CajaIcon *icon);
@@ -6272,6 +6290,7 @@ expose_event (GtkWidget *widget,
}
#endif
+#if !GTK_CHECK_VERSION(3, 0, 0)
static AtkObject *
get_accessible (GtkWidget *widget)
{
@@ -6287,6 +6306,7 @@ get_accessible (GtkWidget *widget)
return eel_accessibility_set_atk_object_return (widget, accessible);
}
+#endif
static void
grab_notify_cb (GtkWidget *widget,
@@ -6730,7 +6750,11 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
widget_class->motion_notify_event = motion_notify_event;
widget_class->key_press_event = key_press_event;
widget_class->popup_menu = popup_menu;
+#if GTK_CHECK_VERSION(3,2,0)
+ gtk_widget_class_set_accessible_type (widget_class, caja_icon_container_accessible_get_type ());
+#else
widget_class->get_accessible = get_accessible;
+#endif
#if GTK_CHECK_VERSION(3,0,0)
widget_class->style_updated = style_updated;
#else
@@ -10555,6 +10579,38 @@ caja_icon_container_accessible_finalize (GObject *object)
G_OBJECT_CLASS (accessible_parent_class)->finalize (object);
}
+#if GTK_CHECK_VERSION(3,2,0)
+static void
+caja_icon_container_accessible_init (CajaIconContainerAccessible *accessible)
+{
+}
+
+static void
+caja_icon_container_accessible_class_init (CajaIconContainerAccessibleClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
+
+ accessible_parent_class = g_type_class_peek_parent (klass);
+
+ gobject_class->finalize = caja_icon_container_accessible_finalize;
+
+ atk_class->get_n_children = caja_icon_container_accessible_get_n_children;
+ atk_class->ref_child = caja_icon_container_accessible_ref_child;
+ atk_class->initialize = caja_icon_container_accessible_initialize;
+
+ accessible_private_data_quark = g_quark_from_static_string ("icon-container-accessible-private-data");
+}
+
+G_DEFINE_TYPE_WITH_CODE (CajaIconContainerAccessible,
+ caja_icon_container_accessible,
+ eel_canvas_accessible_get_type (),
+ G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION,
+ caja_icon_container_accessible_action_interface_init)
+ G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION,
+ caja_icon_container_accessible_selection_interface_init));
+
+#else
static void
caja_icon_container_accessible_class_init (AtkObjectClass *klass)
{
@@ -10605,6 +10661,7 @@ caja_icon_container_accessible_get_type (void)
return type;
}
+#endif
#if ! defined (CAJA_OMIT_SELF_CHECK)
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)