diff options
Diffstat (limited to 'e-util/gal-a11y-e-tree.c')
-rw-r--r-- | e-util/gal-a11y-e-tree.c | 92 |
1 files changed, 15 insertions, 77 deletions
diff --git a/e-util/gal-a11y-e-tree.c b/e-util/gal-a11y-e-tree.c index 6b40b05841..fb0a224cdb 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 ()); -} - |