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 /e-util | |
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 'e-util')
-rw-r--r-- | e-util/e-table.c | 3 | ||||
-rw-r--r-- | e-util/e-tree.c | 3 | ||||
-rw-r--r-- | e-util/ea-calendar-cell.c | 1 | ||||
-rw-r--r-- | e-util/gal-a11y-e-table-column-header.c | 6 | ||||
-rw-r--r-- | e-util/gal-a11y-e-table-column-header.h | 2 | ||||
-rw-r--r-- | e-util/gal-a11y-e-table-item.c | 6 | ||||
-rw-r--r-- | e-util/gal-a11y-e-table.c | 91 | ||||
-rw-r--r-- | e-util/gal-a11y-e-table.h | 11 | ||||
-rw-r--r-- | e-util/gal-a11y-e-tree.c | 92 | ||||
-rw-r--r-- | e-util/gal-a11y-e-tree.h | 11 |
10 files changed, 50 insertions, 176 deletions
diff --git a/e-util/e-table.c b/e-util/e-table.c index e32ba3a1a0..ecffb57367 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 fbcdbe91f2..87d85e16ef 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 38c68b38c0..5248602893 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 7fb225005a..51c553164e 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 6f1c69b56e..4f62373331 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 bcdd585974..e3a842a977 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 dc79f5f0f8..26bcc03ca3 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 9d88ebb62d..9d16cd21ac 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 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 ()); -} - diff --git a/e-util/gal-a11y-e-tree.h b/e-util/gal-a11y-e-tree.h index 730261584b..b656fd7e5d 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__ */ |