[evolution] Bug #722938 - Adapt a11y code for newest gtk



commit 03ca50dbe3809c7321ab7038b0d62788552d501d
Author: Mike Gorse <mgorse suse com>
Date:   Wed Mar 12 17:22:54 2014 +0100

    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.

 calendar/gui/e-calendar-view.c          |   13 ++++-
 calendar/gui/e-day-view.c               |    3 +-
 calendar/gui/e-week-view.c              |    3 +-
 calendar/gui/ea-cal-view.c              |   64 ++++------------------
 calendar/gui/ea-cal-view.h              |    5 +-
 calendar/gui/ea-calendar.c              |   21 -------
 calendar/gui/ea-calendar.h              |    3 -
 calendar/gui/ea-day-view-main-item.c    |   80 +++-----------------------
 calendar/gui/ea-day-view-main-item.h    |    5 +-
 calendar/gui/ea-day-view.c              |   50 +---------------
 calendar/gui/ea-week-view-main-item.c   |   80 +++-----------------------
 calendar/gui/ea-week-view-main-item.h   |    5 +-
 calendar/gui/ea-week-view.c             |   51 +----------------
 configure.ac                            |    2 +-
 e-util/e-table.c                        |    3 +-
 e-util/e-tree.c                         |    3 +-
 e-util/ea-calendar-cell.c               |    1 +
 e-util/gal-a11y-e-table-column-header.c |    6 +-
 e-util/gal-a11y-e-table-column-header.h |    2 +-
 e-util/gal-a11y-e-table-item.c          |    6 +-
 e-util/gal-a11y-e-table.c               |   91 +++++--------------------------
 e-util/gal-a11y-e-table.h               |   11 +--
 e-util/gal-a11y-e-tree.c                |   92 +++++--------------------------
 e-util/gal-a11y-e-tree.h                |   11 +--
 libgnomecanvas/gailcanvas.c             |   81 +--------------------------
 libgnomecanvas/gailcanvas.h             |   29 ++-------
 libgnomecanvas/gnome-canvas.c           |    3 +-
 27 files changed, 128 insertions(+), 596 deletions(-)
---
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 05ef5a5..bf510dd 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -37,6 +37,7 @@
 #include "ea-calendar.h"
 #include "e-cal-model-calendar.h"
 #include "e-calendar-view.h"
+#include "ea-cal-view.h"
 #include "itip-utils.h"
 #include "dialogs/comp-editor-util.h"
 #include "dialogs/delete-comp.h"
@@ -361,6 +362,8 @@ calendar_view_dispose (GObject *object)
                g_object_unref (keyboard);
        }
 
+       g_clear_object (&priv->calendar);
+
        /* Chain up to parent's dispose() method. */
        G_OBJECT_CLASS (e_calendar_view_parent_class)->dispose (object);
 }
@@ -857,6 +860,7 @@ static void
 e_calendar_view_class_init (ECalendarViewClass *class)
 {
        GObjectClass *object_class;
+       GtkWidgetClass *widget_class;
        GtkBindingSet *binding_set;
 
        g_type_class_add_private (class, sizeof (ECalendarViewPrivate));
@@ -1012,7 +1016,8 @@ e_calendar_view_class_init (ECalendarViewClass *class)
                binding_set, GDK_KEY_o, GDK_CONTROL_MASK, "open-event", 0);
 
        /* init the accessibility support for e_day_view */
-       e_cal_view_a11y_init ();
+       widget_class = GTK_WIDGET_CLASS (class);
+       gtk_widget_class_set_accessible_type (widget_class, EA_TYPE_CAL_VIEW);
 }
 
 static void
@@ -1213,6 +1218,12 @@ e_calendar_view_set_calendar (ECalendarView *cal_view,
 {
        g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
 
+       if (calendar)
+               g_object_ref (calendar);
+
+       if (cal_view->priv->calendar)
+               g_object_unref (cal_view->priv->calendar);
+
        cal_view->priv->calendar = calendar;
 }
 
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 7528e0f..304e024 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -54,6 +54,7 @@
 #include "itip-utils.h"
 #include "misc.h"
 #include "print.h"
+#include "ea-day-view.h"
 
 #define E_DAY_VIEW_GET_PRIVATE(obj) \
        (G_TYPE_INSTANCE_GET_PRIVATE \
@@ -1893,7 +1894,7 @@ e_day_view_class_init (EDayViewClass *class)
                "is-editing");
 
        /* init the accessibility support for e_day_view */
-       e_day_view_a11y_init ();
+       gtk_widget_class_set_accessible_type (widget_class, EA_TYPE_DAY_VIEW);
 }
 
 static void
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 22b6e4e..7cfe7ae 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -53,6 +53,7 @@
 #include "itip-utils.h"
 #include "misc.h"
 #include "print.h"
+#include "ea-week-view.h"
 
 /* Images */
 #include "art/jump.xpm"
@@ -1475,7 +1476,7 @@ e_week_view_class_init (EWeekViewClass *class)
                "is-editing");
 
        /* init the accessibility support for e_week_view */
-       e_week_view_a11y_init ();
+       gtk_widget_class_set_accessible_type (widget_class, EA_TYPE_WEEK_VIEW);
 }
 
 static void
diff --git a/calendar/gui/ea-cal-view.c b/calendar/gui/ea-cal-view.c
index fea4144..de3d805 100644
--- a/calendar/gui/ea-cal-view.c
+++ b/calendar/gui/ea-cal-view.c
@@ -30,8 +30,6 @@
 #include "dialogs/goto-dialog.h"
 #include <glib/gi18n.h>
 
-static void ea_cal_view_class_init (EaCalViewClass *klass);
-
 static AtkObject * ea_cal_view_get_parent (AtkObject *accessible);
 static void ea_cal_view_real_initialize (AtkObject *accessible, gpointer data);
 
@@ -63,57 +61,13 @@ static const gchar *
 
 static gpointer parent_class = NULL;
 
-GType
-ea_cal_view_get_type (void)
-{
-       static GType type = 0;
-       AtkObjectFactory *factory;
-       GTypeQuery query;
-       GType derived_atk_type;
-
-       if (!type) {
-               static GTypeInfo tinfo = {
-                       sizeof (EaCalViewClass),
-                       (GBaseInitFunc) NULL, /* base init */
-                       (GBaseFinalizeFunc) NULL, /* base finalize */
-                       (GClassInitFunc) ea_cal_view_class_init, /* class init */
-                       (GClassFinalizeFunc) NULL, /* class finalize */
-                       NULL, /* class data */
-                       sizeof (EaCalView), /* instance size */
-                       0, /* nb preallocs */
-                       (GInstanceInitFunc) NULL, /* instance init */
-                       NULL /* value table */
-               };
-
-               static const GInterfaceInfo atk_action_info = {
-                       (GInterfaceInitFunc) atk_action_interface_init,
-                       (GInterfaceFinalizeFunc) NULL,
-                       NULL
-               };
-
-               /*
-                * Figure out the size of the class and instance
-                * we are run-time deriving from (GailWidget, in this case)
-                */
+G_DEFINE_TYPE_WITH_CODE (EaCalView, ea_cal_view, GTK_TYPE_CONTAINER_ACCESSIBLE,
+       G_IMPLEMENT_INTERFACE (
+               ATK_TYPE_ACTION, atk_action_interface_init))
 
-               factory = atk_registry_get_factory (
-                       atk_get_default_registry (),
-                       GTK_TYPE_WIDGET);
-               derived_atk_type = atk_object_factory_get_accessible_type (factory);
-               g_type_query (derived_atk_type, &query);
-
-               tinfo.class_size = query.class_size;
-               tinfo.instance_size = query.instance_size;
-
-               type = g_type_register_static (
-                       derived_atk_type,
-                       "EaCalView", &tinfo, 0);
-               g_type_add_interface_static (
-                       type, ATK_TYPE_ACTION,
-                       &atk_action_info);
-       }
-
-       return type;
+static void
+ea_cal_view_init (EaCalView *view)
+{
 }
 
 static void
@@ -195,7 +149,11 @@ ea_cal_view_get_parent (AtkObject *accessible)
 
        cal_view = E_CALENDAR_VIEW (widget);
 
-       return gtk_widget_get_accessible (gtk_widget_get_parent (GTK_WIDGET (cal_view)));
+       widget = gtk_widget_get_parent (GTK_WIDGET (cal_view));
+       if (!widget)
+               return NULL;
+
+       return gtk_widget_get_accessible (widget);
 }
 
 static void
diff --git a/calendar/gui/ea-cal-view.h b/calendar/gui/ea-cal-view.h
index 454ce13..738adb0 100644
--- a/calendar/gui/ea-cal-view.h
+++ b/calendar/gui/ea-cal-view.h
@@ -25,6 +25,7 @@
 
 #include <gtk/gtk.h>
 #include "e-calendar-view.h"
+#include "gtk/gtk-a11y.h"
 
 G_BEGIN_DECLS
 
@@ -40,14 +41,14 @@ typedef struct _EaCalViewClass              EaCalViewClass;
 
 struct _EaCalView
 {
-       GtkAccessible parent;
+       GtkContainerAccessible parent;
 };
 
 GType ea_cal_view_get_type (void);
 
 struct _EaCalViewClass
 {
-       GtkAccessibleClass parent_class;
+       GtkContainerAccessibleClass parent_class;
 };
 
 AtkObject * ea_cal_view_new (GtkWidget *widget);
diff --git a/calendar/gui/ea-calendar.c b/calendar/gui/ea-calendar.c
index 4c92441..824edb7 100644
--- a/calendar/gui/ea-calendar.c
+++ b/calendar/gui/ea-calendar.c
@@ -36,12 +36,9 @@
 #include "calendar/gui/ea-week-view-main-item.h"
 #include "calendar/gui/ea-gnome-calendar.h"
 
-EA_FACTORY (EA_TYPE_CAL_VIEW, ea_cal_view, ea_cal_view_new)
-EA_FACTORY (EA_TYPE_DAY_VIEW, ea_day_view, ea_day_view_new)
 EA_FACTORY_GOBJECT (
        EA_TYPE_DAY_VIEW_MAIN_ITEM,
        ea_day_view_main_item, ea_day_view_main_item_new)
-EA_FACTORY (EA_TYPE_WEEK_VIEW, ea_week_view, ea_week_view_new)
 EA_FACTORY_GOBJECT (
        EA_TYPE_WEEK_VIEW_MAIN_ITEM,
        ea_week_view_main_item, ea_week_view_main_item_new)
@@ -107,30 +104,12 @@ gnome_calendar_a11y_init (void)
 }
 
 void
-e_cal_view_a11y_init (void)
-{
-       EA_SET_FACTORY (e_calendar_view_get_type (), ea_cal_view);
-}
-
-void
-e_day_view_a11y_init (void)
-{
-       EA_SET_FACTORY (e_day_view_get_type (), ea_day_view);
-}
-
-void
 e_day_view_main_item_a11y_init (void)
 {
        EA_SET_FACTORY (e_day_view_main_item_get_type (), ea_day_view_main_item);
 }
 
 void
-e_week_view_a11y_init (void)
-{
-       EA_SET_FACTORY (E_TYPE_WEEK_VIEW, ea_week_view);
-}
-
-void
 e_week_view_main_item_a11y_init (void)
 {
        EA_SET_FACTORY (e_week_view_main_item_get_type (), ea_week_view_main_item);
diff --git a/calendar/gui/ea-calendar.h b/calendar/gui/ea-calendar.h
index 591e95b..c94be35 100644
--- a/calendar/gui/ea-calendar.h
+++ b/calendar/gui/ea-calendar.h
@@ -27,10 +27,7 @@
 #define _EA_CALENDAR_H__
 
 void gnome_calendar_a11y_init (void);
-void e_cal_view_a11y_init (void);
-void e_day_view_a11y_init (void);
 void e_day_view_main_item_a11y_init (void);
-void e_week_view_a11y_init (void);
 void e_week_view_main_item_a11y_init (void);
 
 #endif /* _EA_CALENDAR_H__ */
diff --git a/calendar/gui/ea-day-view-main-item.c b/calendar/gui/ea-day-view-main-item.c
index 376c0e8..9396eef 100644
--- a/calendar/gui/ea-day-view-main-item.c
+++ b/calendar/gui/ea-day-view-main-item.c
@@ -32,8 +32,6 @@
 #include "ea-day-view-cell.h"
 
 /* EaDayViewMainItem */
-static void    ea_day_view_main_item_class_init (EaDayViewMainItemClass *klass);
-
 static void    ea_day_view_main_item_finalize  (GObject *object);
 static const gchar *
                ea_day_view_main_item_get_name  (AtkObject *accessible);
@@ -154,75 +152,17 @@ static gint n_ea_day_view_main_item_destroyed = 0;
 
 static gpointer parent_class = NULL;
 
-GType
-ea_day_view_main_item_get_type (void)
-{
-       static GType type = 0;
-       AtkObjectFactory *factory;
-       GTypeQuery query;
-       GType derived_atk_type;
-
-       if (!type) {
-               static GTypeInfo tinfo = {
-                       sizeof (EaDayViewMainItemClass),
-                       (GBaseInitFunc) NULL, /* base init */
-                       (GBaseFinalizeFunc) NULL, /* base finalize */
-                       (GClassInitFunc) ea_day_view_main_item_class_init,
-                       (GClassFinalizeFunc) NULL, /* class finalize */
-                       NULL, /* class data */
-                       sizeof (EaDayViewMainItem), /* instance size */
-                       0, /* nb preallocs */
-                       (GInstanceInitFunc) NULL, /* instance init */
-                       NULL /* value table */
-               };
-
-               static const GInterfaceInfo atk_component_info = {
-                       (GInterfaceInitFunc) atk_component_interface_init,
-                       (GInterfaceFinalizeFunc) NULL,
-                       NULL
-               };
-
-               static const GInterfaceInfo atk_table_info = {
-                       (GInterfaceInitFunc) atk_table_interface_init,
-                       (GInterfaceFinalizeFunc) NULL,
-                       NULL
-               };
-               static const GInterfaceInfo atk_selection_info = {
-                       (GInterfaceInitFunc) atk_selection_interface_init,
-                       (GInterfaceFinalizeFunc) NULL,
-                       NULL
-               };
-
-               /*
-                * Figure out the size of the class and instance
-                * we are run-time deriving from (GailCanvasItem, in this case)
-                *
-                */
-
-               factory = atk_registry_get_factory (
-                       atk_get_default_registry (),
-                       e_day_view_main_item_get_type ());
-               derived_atk_type = atk_object_factory_get_accessible_type (factory);
-               g_type_query (derived_atk_type, &query);
-
-               tinfo.class_size = query.class_size;
-               tinfo.instance_size = query.instance_size;
-
-               type = g_type_register_static (
-                       derived_atk_type,
-                       "EaDayViewMainItem", &tinfo, 0);
-               g_type_add_interface_static (
-                       type, ATK_TYPE_COMPONENT,
-                       &atk_component_info);
-               g_type_add_interface_static (
-                       type, ATK_TYPE_TABLE,
-                       &atk_table_info);
-               g_type_add_interface_static (
-                       type, ATK_TYPE_SELECTION,
-                       &atk_selection_info);
-       }
+G_DEFINE_TYPE_WITH_CODE (EaDayViewMainItem, ea_day_view_main_item, GAIL_TYPE_CANVAS_ITEM,
+       G_IMPLEMENT_INTERFACE (
+               ATK_TYPE_COMPONENT, atk_component_interface_init)
+       G_IMPLEMENT_INTERFACE (
+               ATK_TYPE_SELECTION, atk_selection_interface_init)
+       G_IMPLEMENT_INTERFACE (
+               ATK_TYPE_TABLE, atk_table_interface_init))
 
-       return type;
+static void
+ea_day_view_main_item_init (EaDayViewMainItem *item)
+{
 }
 
 static void
diff --git a/calendar/gui/ea-day-view-main-item.h b/calendar/gui/ea-day-view-main-item.h
index d9ea4a3..f36d554 100644
--- a/calendar/gui/ea-day-view-main-item.h
+++ b/calendar/gui/ea-day-view-main-item.h
@@ -25,6 +25,7 @@
 
 #include <atk/atkgobjectaccessible.h>
 #include "e-day-view-main-item.h"
+#include <libgnomecanvas/gailcanvasitem.h>
 
 G_BEGIN_DECLS
 
@@ -40,14 +41,14 @@ typedef struct _EaDayViewMainItemClass              EaDayViewMainItemClass;
 
 struct _EaDayViewMainItem
 {
-       AtkGObjectAccessible parent;
+       GailCanvasItem parent;
 };
 
 GType ea_day_view_main_item_get_type (void);
 
 struct _EaDayViewMainItemClass
 {
-       AtkGObjectAccessibleClass parent_class;
+       GailCanvasItemClass parent_class;
 };
 
 AtkObject *     ea_day_view_main_item_new         (GObject *obj);
diff --git a/calendar/gui/ea-day-view.c b/calendar/gui/ea-day-view.c
index 45fce9c..7af286e 100644
--- a/calendar/gui/ea-day-view.c
+++ b/calendar/gui/ea-day-view.c
@@ -30,8 +30,6 @@
 #include "ea-gnome-calendar.h"
 #include <glib/gi18n.h>
 
-static void ea_day_view_class_init (EaDayViewClass *klass);
-
 static const gchar * ea_day_view_get_name (AtkObject *accessible);
 static const gchar * ea_day_view_get_description (AtkObject *accessible);
 static gint         ea_day_view_get_n_children      (AtkObject *obj);
@@ -39,51 +37,11 @@ static AtkObject *   ea_day_view_ref_child           (AtkObject *obj,
                                                      gint i);
 static gpointer parent_class = NULL;
 
-GType
-ea_day_view_get_type (void)
-{
-       static GType type = 0;
-       AtkObjectFactory *factory;
-       GTypeQuery query;
-       GType derived_atk_type;
-
-       if (!type) {
-               static GTypeInfo tinfo = {
-                       sizeof (EaDayViewClass),
-                       (GBaseInitFunc) NULL, /* base init */
-                       (GBaseFinalizeFunc) NULL, /* base finalize */
-                       (GClassInitFunc) ea_day_view_class_init, /* class init */
-                       (GClassFinalizeFunc) NULL, /* class finalize */
-                       NULL, /* class data */
-                       sizeof (EaDayView), /* instance size */
-                       0, /* nb preallocs */
-                       (GInstanceInitFunc) NULL, /* instance init */
-                       NULL /* value table */
-               };
-
-               /*
-                * Figure out the size of the class and instance
-                * we are run-time deriving from (EaCalView, in this case)
-                *
-                * Note: we must still use run-time deriving here, because
-                * our parent class EaCalView is run-time deriving.
-                */
-
-               factory = atk_registry_get_factory (
-                       atk_get_default_registry (),
-                       e_calendar_view_get_type ());
-               derived_atk_type = atk_object_factory_get_accessible_type (factory);
-               g_type_query (derived_atk_type, &query);
-
-               tinfo.class_size = query.class_size;
-               tinfo.instance_size = query.instance_size;
-
-               type = g_type_register_static (
-                       derived_atk_type,
-                       "EaDayView", &tinfo, 0);
-       }
+G_DEFINE_TYPE (EaDayView, ea_day_view, EA_TYPE_CAL_VIEW)
 
-       return type;
+static void
+ea_day_view_init (EaDayView *view)
+{
 }
 
 static void
diff --git a/calendar/gui/ea-week-view-main-item.c b/calendar/gui/ea-week-view-main-item.c
index 4677fc5..96ed04e 100644
--- a/calendar/gui/ea-week-view-main-item.c
+++ b/calendar/gui/ea-week-view-main-item.c
@@ -32,8 +32,6 @@
 #include "ea-week-view-cell.h"
 
 /* EaWeekViewMainItem */
-static void    ea_week_view_main_item_class_init
-                                               (EaWeekViewMainItemClass *class);
 static void    ea_week_view_main_item_finalize (GObject *object);
 static const gchar *
                ea_week_view_main_item_get_name (AtkObject *accessible);
@@ -184,75 +182,17 @@ static gint n_ea_week_view_main_item_destroyed = 0;
 
 static gpointer parent_class = NULL;
 
-GType
-ea_week_view_main_item_get_type (void)
-{
-       static GType type = 0;
-       AtkObjectFactory *factory;
-       GTypeQuery query;
-       GType derived_atk_type;
-
-       if (!type) {
-               static GTypeInfo tinfo = {
-                       sizeof (EaWeekViewMainItemClass),
-                       (GBaseInitFunc) NULL, /* base init */
-                       (GBaseFinalizeFunc) NULL, /* base finalize */
-                       (GClassInitFunc) ea_week_view_main_item_class_init,
-                       (GClassFinalizeFunc) NULL, /* class finalize */
-                       NULL, /* class data */
-                       sizeof (EaWeekViewMainItem), /* instance size */
-                       0, /* nb preallocs */
-                       (GInstanceInitFunc) NULL, /* instance init */
-                       NULL /* value table */
-               };
-
-               static const GInterfaceInfo atk_component_info = {
-                       (GInterfaceInitFunc) atk_component_interface_init,
-                       (GInterfaceFinalizeFunc) NULL,
-                       NULL
-               };
-
-               static const GInterfaceInfo atk_table_info = {
-                       (GInterfaceInitFunc) atk_table_interface_init,
-                       (GInterfaceFinalizeFunc) NULL,
-                       NULL
-               };
-               static const GInterfaceInfo atk_selection_info = {
-                       (GInterfaceInitFunc) atk_selection_interface_init,
-                       (GInterfaceFinalizeFunc) NULL,
-                       NULL
-               };
-
-               /*
-                * Figure out the size of the class and instance
-                * we are run-time deriving from (GailCanvasItem, in this case)
-                *
-                */
-
-               factory = atk_registry_get_factory (
-                       atk_get_default_registry (),
-                       e_week_view_main_item_get_type ());
-               derived_atk_type = atk_object_factory_get_accessible_type (factory);
-               g_type_query (derived_atk_type, &query);
-
-               tinfo.class_size = query.class_size;
-               tinfo.instance_size = query.instance_size;
-
-               type = g_type_register_static (
-                       derived_atk_type,
-                       "EaWeekViewMainItem", &tinfo, 0);
-               g_type_add_interface_static (
-                       type, ATK_TYPE_COMPONENT,
-                       &atk_component_info);
-               g_type_add_interface_static (
-                       type, ATK_TYPE_TABLE,
-                       &atk_table_info);
-               g_type_add_interface_static (
-                       type, ATK_TYPE_SELECTION,
-                       &atk_selection_info);
-       }
+G_DEFINE_TYPE_WITH_CODE (EaWeekViewMainItem, ea_week_view_main_item, GAIL_TYPE_CANVAS_ITEM,
+       G_IMPLEMENT_INTERFACE (
+               ATK_TYPE_COMPONENT, atk_component_interface_init)
+       G_IMPLEMENT_INTERFACE (
+               ATK_TYPE_SELECTION, atk_selection_interface_init)
+       G_IMPLEMENT_INTERFACE (
+               ATK_TYPE_TABLE, atk_table_interface_init))
 
-       return type;
+static void
+ea_week_view_main_item_init (EaWeekViewMainItem *item)
+{
 }
 
 static void
diff --git a/calendar/gui/ea-week-view-main-item.h b/calendar/gui/ea-week-view-main-item.h
index 318b80f..99fd0a8 100644
--- a/calendar/gui/ea-week-view-main-item.h
+++ b/calendar/gui/ea-week-view-main-item.h
@@ -26,6 +26,7 @@
 
 #include <atk/atkgobjectaccessible.h>
 #include "e-week-view-main-item.h"
+#include <libgnomecanvas/gailcanvasitem.h>
 
 G_BEGIN_DECLS
 
@@ -41,14 +42,14 @@ typedef struct _EaWeekViewMainItemClass              EaWeekViewMainItemClass;
 
 struct _EaWeekViewMainItem
 {
-       AtkGObjectAccessible parent;
+       GailCanvasItem parent;
 };
 
 GType ea_week_view_main_item_get_type (void);
 
 struct _EaWeekViewMainItemClass
 {
-       AtkGObjectAccessibleClass parent_class;
+       GailCanvasItemClass parent_class;
 };
 
 AtkObject *     ea_week_view_main_item_new         (GObject *obj);
diff --git a/calendar/gui/ea-week-view.c b/calendar/gui/ea-week-view.c
index a7c5f32..593cb8b 100644
--- a/calendar/gui/ea-week-view.c
+++ b/calendar/gui/ea-week-view.c
@@ -31,8 +31,6 @@
 #include "ea-calendar-helpers.h"
 #include "ea-gnome-calendar.h"
 
-static void ea_week_view_class_init (EaWeekViewClass *klass);
-
 static const gchar * ea_week_view_get_name (AtkObject *accessible);
 static const gchar * ea_week_view_get_description (AtkObject *accessible);
 static gint         ea_week_view_get_n_children      (AtkObject *obj);
@@ -41,52 +39,11 @@ static AtkObject *   ea_week_view_ref_child           (AtkObject *obj,
 
 static gpointer parent_class = NULL;
 
-GType
-ea_week_view_get_type (void)
-{
-       static GType type = 0;
-       AtkObjectFactory *factory;
-       GTypeQuery query;
-       GType derived_atk_type;
-
-       if (!type) {
-               static GTypeInfo tinfo = {
-                       sizeof (EaWeekViewClass),
-                       (GBaseInitFunc) NULL, /* base init */
-                       (GBaseFinalizeFunc) NULL, /* base finalize */
-                       (GClassInitFunc) ea_week_view_class_init, /* class init */
-                       (GClassFinalizeFunc) NULL, /* class finalize */
-                       NULL, /* class data */
-                       sizeof (EaWeekView), /* instance size */
-                       0, /* nb preallocs */
-                       (GInstanceInitFunc) NULL, /* instance init */
-                       NULL /* value table */
-               };
-
-               /*
-                * Figure out the size of the class and instance
-                * we are run-time deriving from (EaCalView, in this case)
-                *
-                * Note: we must still use run-time deriving here, because
-                * our parent class EaCalView is run-time deriving.
-                */
-
-               factory = atk_registry_get_factory (
-                       atk_get_default_registry (),
-                       e_calendar_view_get_type ());
-               derived_atk_type = atk_object_factory_get_accessible_type (factory);
-               g_type_query (derived_atk_type, &query);
-
-               tinfo.class_size = query.class_size;
-               tinfo.instance_size = query.instance_size;
-
-               type = g_type_register_static (
-                       derived_atk_type,
-                       "EaWeekView", &tinfo, 0);
-
-       }
+G_DEFINE_TYPE (EaWeekView, ea_week_view, EA_TYPE_CAL_VIEW)
 
-       return type;
+static void
+ea_week_view_init (EaWeekView *view)
+{
 }
 
 static void
diff --git a/configure.ac b/configure.ac
index 5022c99..1694d81 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,7 +37,7 @@ m4_define([glib_minimum_version], [2.36.0])
 m4_define([glib_encoded_version], [GLIB_VERSION_2_36])
 
 dnl Keep these two definitions in agreement.
-m4_define([gdk_minimum_version], [3.4.0])
+m4_define([gdk_minimum_version], [3.8.0])
 m4_define([gdk_encoded_version], [GDK_VERSION_3_4])
 
 dnl Keep these two definitions in agreement.
diff --git a/e-util/e-table.c b/e-util/e-table.c
index e32ba3a..ecffb57 100644
--- a/e-util/e-table.c
+++ b/e-util/e-table.c
@@ -3468,7 +3468,8 @@ e_table_class_init (ETableClass *class)
        g_object_class_override_property (
                object_class, PROP_VSCROLL_POLICY, "vscroll-policy");
 
-       gal_a11y_e_table_init ();
+       gtk_widget_class_set_accessible_type (widget_class,
+               GAL_A11Y_TYPE_E_TABLE);
 }
 
 void
diff --git a/e-util/e-tree.c b/e-util/e-tree.c
index fbcdbe9..87d85e1 100644
--- a/e-util/e-tree.c
+++ b/e-util/e-tree.c
@@ -3146,7 +3146,8 @@ e_tree_class_init (ETreeClass *class)
        g_object_class_override_property (
                object_class, PROP_VSCROLL_POLICY, "vscroll-policy");
 
-       gal_a11y_e_tree_init ();
+       gtk_widget_class_set_accessible_type (widget_class,
+               GAL_A11Y_TYPE_E_TREE);
 }
 
 static void
diff --git a/e-util/ea-calendar-cell.c b/e-util/ea-calendar-cell.c
index 38c68b3..5248602 100644
--- a/e-util/ea-calendar-cell.c
+++ b/e-util/ea-calendar-cell.c
@@ -182,6 +182,7 @@ ea_calendar_cell_init (EaCalendarCell *a11y)
        atk_state_set_add_state (a11y->state_set, ATK_STATE_SENSITIVE);
        atk_state_set_add_state (a11y->state_set, ATK_STATE_SELECTABLE);
        atk_state_set_add_state (a11y->state_set, ATK_STATE_SHOWING);
+       atk_state_set_add_state (a11y->state_set, ATK_STATE_VISIBLE);
        atk_state_set_add_state (a11y->state_set, ATK_STATE_FOCUSABLE);
 }
 
diff --git a/e-util/gal-a11y-e-table-column-header.c b/e-util/gal-a11y-e-table-column-header.c
index 7fb2250..51c5531 100644
--- a/e-util/gal-a11y-e-table-column-header.c
+++ b/e-util/gal-a11y-e-table-column-header.c
@@ -215,7 +215,8 @@ gal_a11y_e_table_column_header_get_type (void)
 
 AtkObject *
 gal_a11y_e_table_column_header_new (ETableCol *ecol,
-                                    ETableItem *item)
+                                    ETableItem *item,
+                                    AtkObject *parent)
 {
        GalA11yETableColumnHeader *a11y;
        AtkObject *accessible;
@@ -237,6 +238,7 @@ gal_a11y_e_table_column_header_new (ETableCol *ecol,
        if (ecol->text)
                atk_object_set_name (accessible, ecol->text);
        atk_object_set_role (accessible, ATK_ROLE_TABLE_COLUMN_HEADER);
+       atk_object_set_parent (accessible, parent);
 
-       return ATK_OBJECT (a11y);
+       return accessible;
 }
diff --git a/e-util/gal-a11y-e-table-column-header.h b/e-util/gal-a11y-e-table-column-header.h
index 6f1c69b..4f62373 100644
--- a/e-util/gal-a11y-e-table-column-header.h
+++ b/e-util/gal-a11y-e-table-column-header.h
@@ -52,7 +52,7 @@ struct _GalA11yETableColumnHeaderClass {
 
 /* Standard Glib function */
 GType      gal_a11y_e_table_column_header_get_type  (void);
-AtkObject *gal_a11y_e_table_column_header_new       (ETableCol *etc, ETableItem *item);
+AtkObject *gal_a11y_e_table_column_header_new       (ETableCol *etc, ETableItem *item, AtkObject *parent);
 void gal_a11y_e_table_column_header_init (void);
 
 #endif /* __GAL_A11Y_E_TABLE_COLUMN_HEADER_H__ */
diff --git a/e-util/gal-a11y-e-table-item.c b/e-util/gal-a11y-e-table-item.c
index bcdd585..e3a842a 100644
--- a/e-util/gal-a11y-e-table-item.c
+++ b/e-util/gal-a11y-e-table-item.c
@@ -276,7 +276,7 @@ eti_ref_child (AtkObject *accessible,
                AtkObject *child;
 
                ecol = e_table_header_get_column (item->header, index);
-               child = gal_a11y_e_table_column_header_new (ecol, item);
+               child = gal_a11y_e_table_column_header_new (ecol, item, accessible);
                return child;
        }
        index -= item->cols;
@@ -579,7 +579,7 @@ eti_get_column_header (AtkTable *table,
 
        ecol = e_table_header_get_column (item->header, column);
        if (ecol) {
-               atk_obj = gal_a11y_e_table_column_header_new (ecol, item);
+               atk_obj = gal_a11y_e_table_column_header_new (ecol, item, ATK_OBJECT (table));
        }
 
        return atk_obj;
@@ -1123,7 +1123,7 @@ gal_a11y_e_table_item_new (ETableItem *item)
 
        GET_PRIVATE (a11y)->state_set = atk_state_set_new ();
 
-       atk_state_set_add_state (GET_PRIVATE (a11y)->state_set, ATK_STATE_TRANSIENT);
+       atk_state_set_add_state (GET_PRIVATE (a11y)->state_set, ATK_STATE_MANAGES_DESCENDANTS);
        atk_state_set_add_state (GET_PRIVATE (a11y)->state_set, ATK_STATE_ENABLED);
        atk_state_set_add_state (GET_PRIVATE (a11y)->state_set, ATK_STATE_SENSITIVE);
        atk_state_set_add_state (GET_PRIVATE (a11y)->state_set, ATK_STATE_SHOWING);
diff --git a/e-util/gal-a11y-e-table.c b/e-util/gal-a11y-e-table.c
index dc79f5f..26bcc03 100644
--- a/e-util/gal-a11y-e-table.c
+++ b/e-util/gal-a11y-e-table.c
@@ -35,16 +35,16 @@
 #include "gal-a11y-util.h"
 
 #define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yETableClass))
-static AtkObjectClass *parent_class;
-static GType parent_type;
-static gint priv_offset;
-#define GET_PRIVATE(object) ((GalA11yETablePrivate *) (((gchar *) object) + priv_offset))
-#define PARENT_TYPE (parent_type)
 
 struct _GalA11yETablePrivate {
        AtkObject *child_item;
 };
 
+static void et_atk_component_iface_init (AtkComponentIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GalA11yETable, gal_a11y_e_table, GTK_TYPE_CONTAINER_ACCESSIBLE,
+                         G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, et_atk_component_iface_init))
+
 /* Static functions */
 static ETableItem *
 find_first_table_item (ETableGroup *group)
@@ -117,9 +117,9 @@ et_ref_accessible_at_point (AtkComponent *component,
                             AtkCoordType coord_type)
 {
        GalA11yETable *a11y = GAL_A11Y_E_TABLE (component);
-       if (GET_PRIVATE (a11y)->child_item)
-               g_object_ref (GET_PRIVATE (a11y)->child_item);
-       return GET_PRIVATE (a11y)->child_item;
+       if (a11y->priv->child_item)
+               g_object_ref (a11y->priv->child_item);
+       return a11y->priv->child_item;
 }
 
 static gint
@@ -201,14 +201,14 @@ et_get_layer (AtkComponent *component)
 }
 
 static void
-et_class_init (GalA11yETableClass *class)
+gal_a11y_e_table_class_init (GalA11yETableClass *class)
 {
        AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (class);
 
-       parent_class = g_type_class_ref (PARENT_TYPE);
-
        atk_object_class->get_n_children = et_get_n_children;
        atk_object_class->ref_child = et_ref_child;
+
+       g_type_class_add_private (class, sizeof (GalA11yETablePrivate));
 }
 
 static void
@@ -219,61 +219,10 @@ et_atk_component_iface_init (AtkComponentIface *iface)
 }
 
 static void
-et_init (GalA11yETable *a11y)
-{
-       GalA11yETablePrivate *priv;
-
-       priv = GET_PRIVATE (a11y);
-
-       priv->child_item = NULL;
-}
-
-/**
- * gal_a11y_e_table_get_type:
- * @void:
- *
- * Registers the &GalA11yETable class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &GalA11yETable class.
- **/
-GType
-gal_a11y_e_table_get_type (void)
+gal_a11y_e_table_init (GalA11yETable *a11y)
 {
-       static GType type = 0;
-
-       if (!type) {
-               AtkObjectFactory *factory;
-
-               GTypeInfo info = {
-                       sizeof (GalA11yETableClass),
-                       (GBaseInitFunc) NULL,
-                       (GBaseFinalizeFunc) NULL,
-                       (GClassInitFunc) et_class_init,
-                       (GClassFinalizeFunc) NULL,
-                       NULL, /* class_data */
-                       sizeof (GalA11yETable),
-                       0,
-                       (GInstanceInitFunc) et_init,
-                       NULL /* value_table */
-               };
-
-               static const GInterfaceInfo atk_component_info = {
-                       (GInterfaceInitFunc) et_atk_component_iface_init,
-                       (GInterfaceFinalizeFunc) NULL,
-                       NULL
-               };
-
-               factory = atk_registry_get_factory (atk_get_default_registry (), GTK_TYPE_WIDGET);
-               parent_type = atk_object_factory_get_accessible_type (factory);
-
-               type = gal_a11y_type_register_static_with_private (
-                       PARENT_TYPE, "GalA11yETable", &info, 0,
-                       sizeof (GalA11yETablePrivate), &priv_offset);
-               g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info);
-       }
-
-       return type;
+       a11y->priv = G_TYPE_INSTANCE_GET_PRIVATE (a11y, GAL_A11Y_TYPE_E_TABLE, GalA11yETablePrivate);
+       a11y->priv->child_item = NULL;
 }
 
 AtkObject *
@@ -300,15 +249,3 @@ gal_a11y_e_table_new (GObject *widget)
 
        return ATK_OBJECT (a11y);
 }
-
-void
-gal_a11y_e_table_init (void)
-{
-       if (atk_get_root ())
-               atk_registry_set_factory_type (
-                       atk_get_default_registry (),
-                                               E_TYPE_TABLE,
-                                               gal_a11y_e_table_factory_get_type ());
-
-}
-
diff --git a/e-util/gal-a11y-e-table.h b/e-util/gal-a11y-e-table.h
index 9d88ebb..9d16cd2 100644
--- a/e-util/gal-a11y-e-table.h
+++ b/e-util/gal-a11y-e-table.h
@@ -28,6 +28,7 @@
 #define __GAL_A11Y_E_TABLE_H__
 
 #include <gtk/gtk.h>
+#include <gtk/gtk-a11y.h>
 #include <atk/atkobject.h>
 #include <atk/atkcomponent.h>
 
@@ -41,21 +42,17 @@ typedef struct _GalA11yETable GalA11yETable;
 typedef struct _GalA11yETableClass GalA11yETableClass;
 typedef struct _GalA11yETablePrivate GalA11yETablePrivate;
 
-/* This struct should actually be larger as this isn't what we derive from.
- * The GalA11yETablePrivate comes right after the parent class structure.
- **/
 struct _GalA11yETable {
-       GtkAccessible object;
+       GtkContainerAccessible object;
+       GalA11yETablePrivate *priv;
 };
 
 struct _GalA11yETableClass {
-       GtkAccessibleClass parent_class;
+       GtkContainerAccessibleClass parent_class;
 };
 
 /* Standard Glib function */
 GType      gal_a11y_e_table_get_type  (void);
 AtkObject *gal_a11y_e_table_new       (GObject *table);
 
-void       gal_a11y_e_table_init (void);
-
 #endif /* __GAL_A11Y_E_TABLE_H__ */
diff --git a/e-util/gal-a11y-e-tree.c b/e-util/gal-a11y-e-tree.c
index 6b40b05..fb0a224 100644
--- a/e-util/gal-a11y-e-tree.c
+++ b/e-util/gal-a11y-e-tree.c
@@ -32,22 +32,21 @@
 #include "gal-a11y-util.h"
 
 #define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yETreeClass))
-static AtkObjectClass *parent_class;
-static GType parent_type;
-static gint priv_offset;
-#define GET_PRIVATE(object) ((GalA11yETreePrivate *) (((gchar *) object) + priv_offset))
-#define PARENT_TYPE (parent_type)
-
 struct _GalA11yETreePrivate {
        AtkObject *child_item;
 };
 
+static void et_atk_component_iface_init (AtkComponentIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GalA11yETree, gal_a11y_e_tree, GTK_TYPE_CONTAINER_ACCESSIBLE,
+                         G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, et_atk_component_iface_init))
+
 /* Static functions */
 
 static void
 init_child_item (GalA11yETree *a11y)
 {
-       GalA11yETreePrivate *priv = GET_PRIVATE (a11y);
+       GalA11yETreePrivate *priv = a11y->priv;
        ETree *tree;
        ETableItem * eti;
 
@@ -68,7 +67,7 @@ et_ref_accessible_at_point (AtkComponent *component,
 {
        GalA11yETree *a11y = GAL_A11Y_E_TREE (component);
        init_child_item (a11y);
-       return GET_PRIVATE (a11y)->child_item;
+       return a11y->priv->child_item;
 }
 
 static gint
@@ -85,8 +84,8 @@ et_ref_child (AtkObject *accessible,
        if (i != 0)
                return NULL;
        init_child_item (a11y);
-       g_object_ref (GET_PRIVATE (a11y)->child_item);
-       return GET_PRIVATE (a11y)->child_item;
+       g_object_ref (a11y->priv->child_item);
+       return a11y->priv->child_item;
 }
 
 static AtkLayer
@@ -96,14 +95,14 @@ et_get_layer (AtkComponent *component)
 }
 
 static void
-et_class_init (GalA11yETreeClass *class)
+gal_a11y_e_tree_class_init (GalA11yETreeClass *class)
 {
        AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (class);
 
-       parent_class = g_type_class_ref (PARENT_TYPE);
-
        atk_object_class->get_n_children = et_get_n_children;
        atk_object_class->ref_child = et_ref_child;
+
+       g_type_class_add_private (class, sizeof (GalA11yETreePrivate));
 }
 
 static void
@@ -114,61 +113,10 @@ et_atk_component_iface_init (AtkComponentIface *iface)
 }
 
 static void
-et_init (GalA11yETree *a11y)
+gal_a11y_e_tree_init (GalA11yETree *a11y)
 {
-       GalA11yETreePrivate *priv;
-
-       priv = GET_PRIVATE (a11y);
-
-       priv->child_item = NULL;
-}
-
-/**
- * gal_a11y_e_tree_get_type:
- * @void:
- *
- * Registers the &GalA11yETree class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &GalA11yETree class.
- **/
-GType
-gal_a11y_e_tree_get_type (void)
-{
-       static GType type = 0;
-
-       if (!type) {
-               AtkObjectFactory *factory;
-
-               GTypeInfo info = {
-                       sizeof (GalA11yETreeClass),
-                       (GBaseInitFunc) NULL,
-                       (GBaseFinalizeFunc) NULL,
-                       (GClassInitFunc) et_class_init,
-                       (GClassFinalizeFunc) NULL,
-                       NULL, /* class_data */
-                       sizeof (GalA11yETree),
-                       0,
-                       (GInstanceInitFunc) et_init,
-                       NULL /* value_tree */
-               };
-
-               static const GInterfaceInfo atk_component_info = {
-                       (GInterfaceInitFunc) et_atk_component_iface_init,
-                       (GInterfaceFinalizeFunc) NULL,
-                       NULL
-               };
-
-               factory = atk_registry_get_factory (atk_get_default_registry (), GTK_TYPE_WIDGET);
-               parent_type = atk_object_factory_get_accessible_type (factory);
-
-               type = gal_a11y_type_register_static_with_private (
-                       PARENT_TYPE, "GalA11yETree", &info, 0,
-                       sizeof (GalA11yETreePrivate), &priv_offset);
-               g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info);
-       }
-
-       return type;
+       a11y->priv = G_TYPE_INSTANCE_GET_PRIVATE (a11y, GAL_A11Y_TYPE_E_TREE, GalA11yETreePrivate);
+       a11y->priv->child_item = NULL;
 }
 
 AtkObject *
@@ -183,13 +131,3 @@ gal_a11y_e_tree_new (GObject *widget)
        return ATK_OBJECT (a11y);
 }
 
-void
-gal_a11y_e_tree_init (void)
-{
-       if (atk_get_root ())
-               atk_registry_set_factory_type (
-                       atk_get_default_registry (),
-                       E_TYPE_TREE,
-                       gal_a11y_e_tree_factory_get_type ());
-}
-
diff --git a/e-util/gal-a11y-e-tree.h b/e-util/gal-a11y-e-tree.h
index 7302615..b656fd7 100644
--- a/e-util/gal-a11y-e-tree.h
+++ b/e-util/gal-a11y-e-tree.h
@@ -27,6 +27,7 @@
 #define __GAL_A11Y_E_TREE_H__
 
 #include <gtk/gtk.h>
+#include <gtk/gtk-a11y.h>
 #include <atk/atkobject.h>
 #include <atk/atkcomponent.h>
 
@@ -40,21 +41,17 @@ typedef struct _GalA11yETree GalA11yETree;
 typedef struct _GalA11yETreeClass GalA11yETreeClass;
 typedef struct _GalA11yETreePrivate GalA11yETreePrivate;
 
-/* This struct should actually be larger as this isn't what we derive from.
- * The GalA11yETablePrivate comes right after the parent class structure.
- **/
 struct _GalA11yETree {
-       GtkAccessible object;
+       GtkContainerAccessible object;
+       GalA11yETreePrivate *priv;
 };
 
 struct _GalA11yETreeClass {
-       GtkAccessibleClass parent_class;
+       GtkContainerAccessibleClass parent_class;
 };
 
 /* Standard Glib function */
 GType      gal_a11y_e_tree_get_type  (void);
 AtkObject *gal_a11y_e_tree_new       (GObject *tree);
 
-void       gal_a11y_e_tree_init      (void);
-
 #endif /* __GAL_A11Y_E_TREE_H__ */
diff --git a/libgnomecanvas/gailcanvas.c b/libgnomecanvas/gailcanvas.c
index 6af1a07..61a9124 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 84dfdb8..58164da 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 a9688d9..45b383b 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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]