diff options
author | Mike Gorse <mgorse@suse.com> | 2014-03-13 00:22:54 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2014-03-13 00:22:54 +0800 |
commit | 03ca50dbe3809c7321ab7038b0d62788552d501d (patch) | |
tree | 041bff6b0edd258bb49291117892ebb30f8be8d8 /libgnomecanvas | |
parent | d8ac0f010b636a675e279da9a1fcfc5bc5f03789 (diff) | |
download | gsoc2013-evolution-03ca50dbe3809c7321ab7038b0d62788552d501d.tar gsoc2013-evolution-03ca50dbe3809c7321ab7038b0d62788552d501d.tar.gz gsoc2013-evolution-03ca50dbe3809c7321ab7038b0d62788552d501d.tar.bz2 gsoc2013-evolution-03ca50dbe3809c7321ab7038b0d62788552d501d.tar.lz gsoc2013-evolution-03ca50dbe3809c7321ab7038b0d62788552d501d.tar.xz gsoc2013-evolution-03ca50dbe3809c7321ab7038b0d62788552d501d.tar.zst gsoc2013-evolution-03ca50dbe3809c7321ab7038b0d62788552d501d.zip |
Bug #722938 - Adapt a11y code for newest gtk
As of gtk+ 3.2, AtkObjectFactories are no longer used to generate
accessibles for gtk widgets, so our custom atk classes need refactoring.
Diffstat (limited to 'libgnomecanvas')
-rw-r--r-- | libgnomecanvas/gailcanvas.c | 81 | ||||
-rw-r--r-- | libgnomecanvas/gailcanvas.h | 29 | ||||
-rw-r--r-- | libgnomecanvas/gnome-canvas.c | 3 |
3 files changed, 13 insertions, 100 deletions
diff --git a/libgnomecanvas/gailcanvas.c b/libgnomecanvas/gailcanvas.c index 6af1a0745a..61a91246dc 100644 --- a/libgnomecanvas/gailcanvas.c +++ b/libgnomecanvas/gailcanvas.c @@ -29,7 +29,6 @@ #include "gailcanvasitemfactory.h" #include "gailcanvaswidgetfactory.h" -static void gail_canvas_class_init (GailCanvasClass *klass); static void gail_canvas_real_initialize (AtkObject *obj, gpointer data); @@ -40,91 +39,20 @@ static AtkObject * gail_canvas_ref_child (AtkObject *obj, static void adjustment_changed (GtkAdjustment *adjustment, GnomeCanvas *canvas); -static AtkObject * gail_canvas_factory_create_accessible (GObject *obj); - -static GType gail_canvas_factory_get_accessible_type (void); - -G_DEFINE_TYPE (GailCanvasFactory, - gail_canvas_factory, - ATK_TYPE_OBJECT_FACTORY); - -static void -gail_canvas_factory_init (GailCanvasFactory *foo) -{ - ; -} +G_DEFINE_TYPE (GailCanvas, gail_canvas, GTK_TYPE_CONTAINER_ACCESSIBLE) static void -gail_canvas_factory_class_init (GailCanvasFactoryClass *klass) +gail_canvas_init (GailCanvas *canvas) { - AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass); - - class->create_accessible = gail_canvas_factory_create_accessible; - class->get_accessible_type = gail_canvas_factory_get_accessible_type; } -static AtkObject * -gail_canvas_factory_create_accessible (GObject *obj) -{ - return gail_canvas_new (GTK_WIDGET (obj)); -} - -static GType -gail_canvas_factory_get_accessible_type (void) -{ - return GAIL_TYPE_CANVAS; -} - -GType -gail_canvas_get_type (void) -{ - static GType type = 0; - - if (!type) - { - GType parent_type = g_type_parent (GNOME_TYPE_CANVAS); - AtkObjectFactory *factory = atk_registry_get_factory ( - atk_get_default_registry (), - parent_type); - GType atkobject_parent_type = atk_object_factory_get_accessible_type (factory); - GTypeQuery query; - static GTypeInfo tinfo = - { - 0, /* class size */ - (GBaseInitFunc) NULL, /* base init */ - (GBaseFinalizeFunc) NULL, /* base finalize */ - (GClassInitFunc) gail_canvas_class_init, /* class init */ - (GClassFinalizeFunc) NULL, /* class finalize */ - NULL, /* class data */ - 0, /* instance size */ - 0, /* nb preallocs */ - (GInstanceInitFunc) NULL, /* instance init */ - NULL /* value table */ - }; - g_type_query (atkobject_parent_type, &query); - tinfo.class_size = query.class_size; - tinfo.instance_size = query.instance_size; - - /* use the size obtained from the parent type factory */ - type = g_type_register_static (atkobject_parent_type, - "GailCanvas", &tinfo, 0); - } - - return type; -} - -static AtkObjectClass *parent_atk_object_class; - /** * Tell ATK how to create the appropriate AtkObject peers **/ void -gail_canvas_init (void) +gail_canvas_a11y_init (void) { atk_registry_set_factory_type (atk_get_default_registry (), - GNOME_TYPE_CANVAS, - gail_canvas_factory_get_type ()); - atk_registry_set_factory_type (atk_get_default_registry (), GNOME_TYPE_CANVAS_GROUP, gail_canvas_group_factory_get_type ()); atk_registry_set_factory_type (atk_get_default_registry (), @@ -142,7 +70,6 @@ static void gail_canvas_class_init (GailCanvasClass *klass) { AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - parent_atk_object_class = g_type_class_peek_parent (klass); class->get_n_children = gail_canvas_get_n_children; class->ref_child = gail_canvas_ref_child; @@ -172,7 +99,7 @@ gail_canvas_real_initialize (AtkObject *obj, GnomeCanvas *canvas; GtkAdjustment *adj; - parent_atk_object_class->initialize (obj, data); + ATK_OBJECT_CLASS (gail_canvas_parent_class)->initialize (obj, data); canvas = GNOME_CANVAS (data); diff --git a/libgnomecanvas/gailcanvas.h b/libgnomecanvas/gailcanvas.h index 84dfdb8299..58164da160 100644 --- a/libgnomecanvas/gailcanvas.h +++ b/libgnomecanvas/gailcanvas.h @@ -19,6 +19,7 @@ #define __GAIL_CANVAS_H__ #include <gtk/gtk.h> +#include <gtk/gtk-a11y.h> /* This code provides the ATK implementation for gnome-canvas widgets. */ @@ -31,39 +32,23 @@ G_BEGIN_DECLS #define GAIL_IS_CANVAS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CANVAS)) #define GAIL_CANVAS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CANVAS, GailCanvasClass)) -#define GAIL_TYPE_CANVAS_FACTORY (gail_canvas_factory_get_type ()) -#define GAIL_CANVAS_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_CANVAS_FACTORY, GailCanvasFactory)) -#define GAIL_CANVAS_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_CANVAS_FACTORY, GailCanvasFactoryClass)) -#define GAIL_IS_CANVAS_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_CANVAS_FACTORY)) -#define GAIL_IS_CANVAS_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CANVAS_FACTORY)) -#define GAIL_CANVAS_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CANVAS_FACTORY, GailCanvasFactoryClass)) - typedef struct _GailCanvas GailCanvas; typedef struct _GailCanvasClass GailCanvasClass; -typedef struct _GailCanvasFactory GailCanvasFactory; -typedef struct _GailCanvasFactoryClass GailCanvasFactoryClass; +GType gail_canvas_get_type (void); -struct _GailCanvasFactory +struct _GailCanvas { - AtkObjectFactory parent; + GtkContainerAccessible parent; }; -struct _GailCanvasFactoryClass +struct _GailCanvasClass { - AtkObjectFactoryClass parent_class; + GtkContainerAccessibleClass parent_class; }; -GType gail_canvas_get_type (void); - -struct _GailCanvas; - -struct _GailCanvasClass; - AtkObject * gail_canvas_new (GtkWidget *widget); -void gail_canvas_init (void); - -GType gail_canvas_factory_get_type (void); +void gail_canvas_a11y_init (void); G_END_DECLS diff --git a/libgnomecanvas/gnome-canvas.c b/libgnomecanvas/gnome-canvas.c index a9688d90f3..45b383b47f 100644 --- a/libgnomecanvas/gnome-canvas.c +++ b/libgnomecanvas/gnome-canvas.c @@ -1911,7 +1911,8 @@ gnome_canvas_class_init (GnomeCanvasClass *class) G_TYPE_INT, G_TYPE_INT); - gail_canvas_init (); + gtk_widget_class_set_accessible_type (widget_class, GAIL_TYPE_CANVAS); + gail_canvas_a11y_init (); } /* Callback used when the root item of a canvas is destroyed. The user should |