[gtk+] GtkWidgetAccessible: add a private struct
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkWidgetAccessible: add a private struct
- Date: Mon, 15 Oct 2012 10:41:26 +0000 (UTC)
commit d83294d313dcb7b444d1d9415f0f49c470129331
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Oct 15 06:04:11 2012 -0400
GtkWidgetAccessible: add a private struct
Move instance fields to a private struct, in preparation
for installing a11y headers.
This also required removing access to GtkWidgetAccessible innards
from several accessible implementations.
gtk/a11y/gtkmenuaccessible.c | 2 +-
gtk/a11y/gtkmenuitemaccessible.c | 2 +-
gtk/a11y/gtkwidgetaccessible.c | 21 +++++++++++++++++++--
gtk/a11y/gtkwidgetaccessible.h | 10 +++++++---
gtk/a11y/gtkwindowaccessible.c | 2 +-
5 files changed, 29 insertions(+), 8 deletions(-)
---
diff --git a/gtk/a11y/gtkmenuaccessible.c b/gtk/a11y/gtkmenuaccessible.c
index 3202521..4a07f13 100644
--- a/gtk/a11y/gtkmenuaccessible.c
+++ b/gtk/a11y/gtkmenuaccessible.c
@@ -31,7 +31,7 @@ gtk_menu_accessible_initialize (AtkObject *obj,
obj->role = ATK_ROLE_MENU;
- GTK_WIDGET_ACCESSIBLE (obj)->layer = ATK_LAYER_POPUP;
+ _gtk_widget_accessible_set_layer (GTK_WIDGET_ACCESSIBLE (obj), ATK_LAYER_POPUP);
}
static AtkObject *
diff --git a/gtk/a11y/gtkmenuitemaccessible.c b/gtk/a11y/gtkmenuitemaccessible.c
index 6495268..2e5a436 100644
--- a/gtk/a11y/gtkmenuitemaccessible.c
+++ b/gtk/a11y/gtkmenuitemaccessible.c
@@ -72,7 +72,7 @@ gtk_menu_item_accessible_initialize (AtkObject *obj,
atk_object_set_parent (obj, gtk_widget_get_accessible (parent_widget));
}
- GTK_WIDGET_ACCESSIBLE (obj)->layer = ATK_LAYER_POPUP;
+ _gtk_widget_accessible_set_layer (GTK_WIDGET_ACCESSIBLE (obj), ATK_LAYER_POPUP);
obj->role = ATK_ROLE_MENU_ITEM;
diff --git a/gtk/a11y/gtkwidgetaccessible.c b/gtk/a11y/gtkwidgetaccessible.c
index b37232a..9e8add7 100644
--- a/gtk/a11y/gtkwidgetaccessible.c
+++ b/gtk/a11y/gtkwidgetaccessible.c
@@ -24,6 +24,11 @@
#include "gtkwidgetaccessible.h"
#include "gtknotebookpageaccessible.h"
+struct _GtkWidgetAccessiblePrivate
+{
+ AtkLayer layer;
+};
+
#define TOOLTIP_KEY "tooltip"
extern GtkWidget *_focus_widget;
@@ -133,7 +138,7 @@ gtk_widget_accessible_initialize (AtkObject *obj,
g_signal_connect (widget, "map", G_CALLBACK (map_cb), NULL);
g_signal_connect (widget, "unmap", G_CALLBACK (map_cb), NULL);
- GTK_WIDGET_ACCESSIBLE (obj)->layer = ATK_LAYER_WIDGET;
+ GTK_WIDGET_ACCESSIBLE (obj)->priv->layer = ATK_LAYER_WIDGET;
obj->role = ATK_ROLE_UNKNOWN;
gtk_widget_accessible_update_tooltip (GTK_WIDGET_ACCESSIBLE (obj), widget);
@@ -534,11 +539,16 @@ _gtk_widget_accessible_class_init (GtkWidgetAccessibleClass *klass)
class->initialize = gtk_widget_accessible_initialize;
class->get_attributes = gtk_widget_accessible_get_attributes;
class->focus_event = gtk_widget_accessible_focus_event;
+
+ g_type_class_add_private (klass, sizeof (GtkWidgetAccessiblePrivate));
}
static void
_gtk_widget_accessible_init (GtkWidgetAccessible *accessible)
{
+ accessible->priv = G_TYPE_INSTANCE_GET_PRIVATE (accessible,
+ GTK_TYPE_WIDGET_ACCESSIBLE,
+ GtkWidgetAccessiblePrivate);
}
static void
@@ -615,7 +625,7 @@ gtk_widget_accessible_get_layer (AtkComponent *component)
{
GtkWidgetAccessible *accessible = GTK_WIDGET_ACCESSIBLE (component);
- return accessible->layer;
+ return accessible->priv->layer;
}
static gboolean
@@ -833,3 +843,10 @@ gtk_widget_accessible_all_parents_visible (GtkWidget *widget)
return result;
}
+
+void
+_gtk_widget_accessible_set_layer (GtkWidgetAccessible *accessible,
+ AtkLayer layer)
+{
+ accessible->priv->layer = layer;
+}
diff --git a/gtk/a11y/gtkwidgetaccessible.h b/gtk/a11y/gtkwidgetaccessible.h
index c88a3fb..3294c07 100644
--- a/gtk/a11y/gtkwidgetaccessible.h
+++ b/gtk/a11y/gtkwidgetaccessible.h
@@ -30,14 +30,15 @@ G_BEGIN_DECLS
#define GTK_IS_WIDGET_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WIDGET_ACCESSIBLE))
#define GTK_WIDGET_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WIDGET_ACCESSIBLE, GtkWidgetAccessibleClass))
-typedef struct _GtkWidgetAccessible GtkWidgetAccessible;
-typedef struct _GtkWidgetAccessibleClass GtkWidgetAccessibleClass;
+typedef struct _GtkWidgetAccessible GtkWidgetAccessible;
+typedef struct _GtkWidgetAccessibleClass GtkWidgetAccessibleClass;
+typedef struct _GtkWidgetAccessiblePrivate GtkWidgetAccessiblePrivate;
struct _GtkWidgetAccessible
{
GtkAccessible parent;
- AtkLayer layer;
+ GtkWidgetAccessiblePrivate *priv;
};
struct _GtkWidgetAccessibleClass
@@ -54,6 +55,9 @@ struct _GtkWidgetAccessibleClass
GType _gtk_widget_accessible_get_type (void);
+void _gtk_widget_accessible_set_layer (GtkWidgetAccessible *accessible,
+ AtkLayer layer);
+
G_END_DECLS
#endif /* __GTK_WIDGET_ACCESSIBLE_H__ */
diff --git a/gtk/a11y/gtkwindowaccessible.c b/gtk/a11y/gtkwindowaccessible.c
index 475d142..4b88fb5 100644
--- a/gtk/a11y/gtkwindowaccessible.c
+++ b/gtk/a11y/gtkwindowaccessible.c
@@ -93,7 +93,7 @@ gtk_window_accessible_initialize (AtkObject *obj,
ATK_OBJECT_CLASS (_gtk_window_accessible_parent_class)->initialize (obj, data);
g_signal_connect (data, "window-state-event", G_CALLBACK (window_state_event_cb), NULL);
- GTK_WIDGET_ACCESSIBLE (obj)->layer = ATK_LAYER_WINDOW;
+ _gtk_widget_accessible_set_layer (GTK_WIDGET_ACCESSIBLE (obj), ATK_LAYER_WINDOW);
name = gtk_widget_get_name (widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]