[gtk+] Initial conversion of GailWidget to GtkWidgetAccessible
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Initial conversion of GailWidget to GtkWidgetAccessible
- Date: Tue, 5 Jul 2011 20:36:54 +0000 (UTC)
commit 775ccf39e7f117e6f62a91f6b1607408833ebd1c
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jul 2 15:23:52 2011 -0400
Initial conversion of GailWidget to GtkWidgetAccessible
gtk/a11y/Makefile.am | 4 +-
gtk/a11y/gail.c | 3 -
gtk/a11y/gailwidget.c | 1085 ----------------------
gtk/a11y/gtkarrowaccessible.c | 2 +-
gtk/a11y/gtkarrowaccessible.h | 6 +-
gtk/a11y/gtkbuttonaccessible.c | 4 +-
gtk/a11y/gtkcheckmenuitemaccessible.c | 4 +-
gtk/a11y/gtkchecksubmenuitemaccessible.c | 4 +-
gtk/a11y/gtkcontaineraccessible.c | 2 +-
gtk/a11y/gtkcontaineraccessible.h | 6 +-
gtk/a11y/gtkentryaccessible.c | 6 +-
gtk/a11y/gtkentryaccessible.h | 10 +-
gtk/a11y/gtkexpanderaccessible.c | 4 +-
gtk/a11y/gtkimageaccessible.c | 2 +-
gtk/a11y/gtkimageaccessible.h | 6 +-
gtk/a11y/gtklabelaccessible.c | 6 +-
gtk/a11y/gtklabelaccessible.h | 6 +-
gtk/a11y/gtkmenuitemaccessible.c | 4 +-
gtk/a11y/gtknotebookaccessible.c | 4 +-
gtk/a11y/gtkprogressbaraccessible.c | 8 +-
gtk/a11y/gtkprogressbaraccessible.h | 10 +-
gtk/a11y/gtkrangeaccessible.c | 6 +-
gtk/a11y/gtkrangeaccessible.h | 6 +-
gtk/a11y/gtkscalebuttonaccessible.c | 4 +-
gtk/a11y/gtkspinbuttonaccessible.c | 6 +-
gtk/a11y/gtktextviewaccessible.c | 6 +-
gtk/a11y/gtktogglebuttonaccessible.c | 5 +-
gtk/a11y/gtktreeviewaccessible.c | 12 +-
gtk/a11y/gtkwidgetaccessible.c | 902 ++++++++++++++++++
gtk/a11y/{gailwidget.h => gtkwidgetaccessible.h} | 30 +-
gtk/a11y/gtkwindowaccessible.c | 6 +-
gtk/gtkaccessible.c | 8 +-
gtk/gtkspinner.c | 94 +--
gtk/gtkswitch.c | 60 +--
gtk/gtkwidget.c | 4 +-
tests/a11y/colorchooser.txt | 62 +-
36 files changed, 1038 insertions(+), 1359 deletions(-)
---
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am
index f960d43..47ec89f 100644
--- a/gtk/a11y/Makefile.am
+++ b/gtk/a11y/Makefile.am
@@ -49,7 +49,7 @@ gail_c_sources = \
gailtoplevel.c \
gtktreeviewaccessible.c \
gailutil.c \
- gailwidget.c \
+ gtkwidgetaccessible.c \
gtkwindowaccessible.c
libgailincludedir=$(includedir)/gail-3.0/gail
@@ -104,7 +104,7 @@ gail_private_h_sources = \
gtkwindowaccessible.h
gail_public_h_sources = \
- gailwidget.h
+ gtkwidgetaccessible.h
libgail_la_SOURCES = \
$(gail_c_sources) \
diff --git a/gtk/a11y/gail.c b/gtk/a11y/gail.c
index fcf09f7..69763ac 100644
--- a/gtk/a11y/gail.c
+++ b/gtk/a11y/gail.c
@@ -31,7 +31,6 @@
#include "gailtextcell.h"
#include "gailtoplevel.h"
#include "gailutil.h"
-#include "gailwidget.h"
#include "gailfactory.h"
@@ -77,7 +76,6 @@ static guint focus_notify_handler = 0;
static guint focus_tracker_id = 0;
static GQuark quark_focus_object = 0;
-GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_WIDGET, GailWidget, gail_widget, GTK_TYPE_WIDGET)
GAIL_IMPLEMENT_FACTORY_WITH_FUNC_DUMMY (GAIL_TYPE_RENDERER_CELL, GailRendererCell, gail_renderer_cell, GTK_TYPE_CELL_RENDERER, gail_renderer_cell_new)
GAIL_IMPLEMENT_FACTORY_WITH_FUNC_DUMMY (GAIL_TYPE_BOOLEAN_CELL, GailBooleanCell, gail_boolean_cell, GTK_TYPE_CELL_RENDERER_TOGGLE, gail_boolean_cell_new)
GAIL_IMPLEMENT_FACTORY_WITH_FUNC_DUMMY (GAIL_TYPE_IMAGE_CELL, GailImageCell, gail_image_cell, GTK_TYPE_CELL_RENDERER_PIXBUF, gail_image_cell_new)
@@ -822,7 +820,6 @@ gail_accessibility_module_init (void)
if (a_t_support)
fprintf (stderr, "GTK Accessibility Module initialized\n");
- GAIL_WIDGET_SET_FACTORY (GTK_TYPE_WIDGET, gail_widget);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_TEXT, gail_text_cell);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_TOGGLE, gail_boolean_cell);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_PIXBUF, gail_image_cell);
diff --git a/gtk/a11y/gtkarrowaccessible.c b/gtk/a11y/gtkarrowaccessible.c
index 78f157f..dbff82a 100644
--- a/gtk/a11y/gtkarrowaccessible.c
+++ b/gtk/a11y/gtkarrowaccessible.c
@@ -25,7 +25,7 @@
static void atk_image_interface_init (AtkImageIface *iface);
-G_DEFINE_TYPE_WITH_CODE (GtkArrowAccessible, gtk_arrow_accessible, GAIL_TYPE_WIDGET,
+G_DEFINE_TYPE_WITH_CODE (GtkArrowAccessible, gtk_arrow_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init))
static void
diff --git a/gtk/a11y/gtkarrowaccessible.h b/gtk/a11y/gtkarrowaccessible.h
index ee68c0b..39b30c8 100644
--- a/gtk/a11y/gtkarrowaccessible.h
+++ b/gtk/a11y/gtkarrowaccessible.h
@@ -20,7 +20,7 @@
#ifndef __GTK_ARROW_ACCESSIBLE_H__
#define __GTK_ARROW_ACCESSIBLE_H__
-#include "gailwidget.h"
+#include "gtkwidgetaccessible.h"
G_BEGIN_DECLS
@@ -36,14 +36,14 @@ typedef struct _GtkArrowAccessibleClass GtkArrowAccessibleClass;
struct _GtkArrowAccessible
{
- GailWidget parent;
+ GtkWidgetAccessible parent;
gchar *image_description;
};
struct _GtkArrowAccessibleClass
{
- GailWidgetClass parent_class;
+ GtkWidgetAccessibleClass parent_class;
};
GType gtk_arrow_accessible_get_type (void);
diff --git a/gtk/a11y/gtkbuttonaccessible.c b/gtk/a11y/gtkbuttonaccessible.c
index 1be1137..5951b90 100644
--- a/gtk/a11y/gtkbuttonaccessible.c
+++ b/gtk/a11y/gtkbuttonaccessible.c
@@ -219,7 +219,7 @@ gtk_button_accessible_notify_gtk (GObject *obj,
g_signal_emit_by_name (atk_obj, "visible_data_changed");
}
else
- GAIL_WIDGET_CLASS (gtk_button_accessible_parent_class)->notify_gtk (obj, pspec);
+ GTK_WIDGET_ACCESSIBLE_CLASS (gtk_button_accessible_parent_class)->notify_gtk (obj, pspec);
}
static void
@@ -227,7 +227,7 @@ gtk_button_accessible_class_init (GtkButtonAccessibleClass *klass)
{
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
GtkContainerAccessibleClass *container_class = (GtkContainerAccessibleClass*)klass;
- GailWidgetClass *widget_class = (GailWidgetClass*)klass;
+ GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
class->get_name = gtk_button_accessible_get_name;
class->get_n_children = gtk_button_accessible_get_n_children;
diff --git a/gtk/a11y/gtkcheckmenuitemaccessible.c b/gtk/a11y/gtkcheckmenuitemaccessible.c
index 7348275..7c2a072 100644
--- a/gtk/a11y/gtkcheckmenuitemaccessible.c
+++ b/gtk/a11y/gtkcheckmenuitemaccessible.c
@@ -102,13 +102,13 @@ gtk_check_menu_item_accessible_notify_gtk (GObject *obj,
atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, (sensitive && !inconsistent));
}
else
- GAIL_WIDGET_CLASS (gtk_check_menu_item_accessible_parent_class)->notify_gtk (obj, pspec);
+ GTK_WIDGET_ACCESSIBLE_CLASS (gtk_check_menu_item_accessible_parent_class)->notify_gtk (obj, pspec);
}
static void
gtk_check_menu_item_accessible_class_init (GtkCheckMenuItemAccessibleClass *klass)
{
- GailWidgetClass *widget_class = (GailWidgetClass*)klass;
+ GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
widget_class->notify_gtk = gtk_check_menu_item_accessible_notify_gtk;
diff --git a/gtk/a11y/gtkchecksubmenuitemaccessible.c b/gtk/a11y/gtkchecksubmenuitemaccessible.c
index eb55c58..5126ddc 100644
--- a/gtk/a11y/gtkchecksubmenuitemaccessible.c
+++ b/gtk/a11y/gtkchecksubmenuitemaccessible.c
@@ -103,14 +103,14 @@ gtk_check_submenu_item_accessible_notify_gtk (GObject *obj,
atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, (sensitive && !inconsistent));
}
else
- GAIL_WIDGET_CLASS (gtk_check_submenu_item_accessible_parent_class)->notify_gtk (obj, pspec);
+ GTK_WIDGET_ACCESSIBLE_CLASS (gtk_check_submenu_item_accessible_parent_class)->notify_gtk (obj, pspec);
}
static void
gtk_check_submenu_item_accessible_class_init (GtkCheckSubmenuItemAccessibleClass *klass)
{
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
- GailWidgetClass *widget_class = (GailWidgetClass*)klass;
+ GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
widget_class->notify_gtk = gtk_check_submenu_item_accessible_notify_gtk;
diff --git a/gtk/a11y/gtkcontaineraccessible.c b/gtk/a11y/gtkcontaineraccessible.c
index ad475a4..f02020d 100644
--- a/gtk/a11y/gtkcontaineraccessible.c
+++ b/gtk/a11y/gtkcontaineraccessible.c
@@ -23,7 +23,7 @@
#include "gtkcontaineraccessible.h"
-G_DEFINE_TYPE (GtkContainerAccessible, gtk_container_accessible, GAIL_TYPE_WIDGET)
+G_DEFINE_TYPE (GtkContainerAccessible, gtk_container_accessible, GTK_TYPE_WIDGET_ACCESSIBLE)
static void
gtk_container_accessible_init (GtkContainerAccessible *container)
diff --git a/gtk/a11y/gtkcontaineraccessible.h b/gtk/a11y/gtkcontaineraccessible.h
index 1e60c6d..bb955d2 100644
--- a/gtk/a11y/gtkcontaineraccessible.h
+++ b/gtk/a11y/gtkcontaineraccessible.h
@@ -20,7 +20,7 @@
#ifndef __GTK_CONTAINER_ACCESSIBLE_H__
#define __GTK_CONTAINER_ACCESSIBLE_H__
-#include "gailwidget.h"
+#include "gtkwidgetaccessible.h"
G_BEGIN_DECLS
@@ -36,14 +36,14 @@ typedef struct _GtkContainerAccessibleClass GtkContainerAccessibleClass;
struct _GtkContainerAccessible
{
- GailWidget parent;
+ GtkWidgetAccessible parent;
GList *children;
};
struct _GtkContainerAccessibleClass
{
- GailWidgetClass parent_class;
+ GtkWidgetAccessibleClass parent_class;
gint (*add_gtk) (GtkContainer *container,
GtkWidget *widget,
diff --git a/gtk/a11y/gtkentryaccessible.c b/gtk/a11y/gtkentryaccessible.c
index 66b5af7..ff8de78 100644
--- a/gtk/a11y/gtkentryaccessible.c
+++ b/gtk/a11y/gtkentryaccessible.c
@@ -45,7 +45,7 @@ static void atk_text_interface_init (AtkTextIface *iface);
static void atk_action_interface_init (AtkActionIface *iface);
-G_DEFINE_TYPE_WITH_CODE (GtkEntryAccessible, gtk_entry_accessible, GAIL_TYPE_WIDGET,
+G_DEFINE_TYPE_WITH_CODE (GtkEntryAccessible, gtk_entry_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT, atk_editable_text_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init))
@@ -187,7 +187,7 @@ gtk_entry_accessible_notify_gtk (GObject *obj,
atk_object_set_role (atk_obj, new_role);
}
else
- GAIL_WIDGET_CLASS (gtk_entry_accessible_parent_class)->notify_gtk (obj, pspec);
+ GTK_WIDGET_ACCESSIBLE_CLASS (gtk_entry_accessible_parent_class)->notify_gtk (obj, pspec);
}
static gint
@@ -209,7 +209,7 @@ gtk_entry_accessible_class_init (GtkEntryAccessibleClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
- GailWidgetClass *widget_class = (GailWidgetClass*)klass;
+ GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
gobject_class->finalize = gtk_entry_accessible_finalize;
diff --git a/gtk/a11y/gtkentryaccessible.h b/gtk/a11y/gtkentryaccessible.h
index f902cb5..a3d2354 100644
--- a/gtk/a11y/gtkentryaccessible.h
+++ b/gtk/a11y/gtkentryaccessible.h
@@ -20,7 +20,7 @@
#ifndef __GTK_ENTRY_ACCESSIBLE_H__
#define __GTK_ENTRY_ACCESSIBLE_H__
-#include "gailwidget.h"
+#include "gtkwidgetaccessible.h"
G_BEGIN_DECLS
@@ -36,7 +36,7 @@ typedef struct _GtkEntryAccessibleClass GtkEntryAccessibleClass;
struct _GtkEntryAccessible
{
- GailWidget parent;
+ GtkWidgetAccessible parent;
gint position_insert;
gint position_delete;
@@ -48,13 +48,13 @@ struct _GtkEntryAccessible
guint action_idle_handler;
};
-GType gtk_entry_accessible_get_type (void);
-
struct _GtkEntryAccessibleClass
{
- GailWidgetClass parent_class;
+ GtkWidgetAccessibleClass parent_class;
};
+GType gtk_entry_accessible_get_type (void);
+
G_END_DECLS
#endif /* __GTK_ENTRY_ACCESSIBLE_H__ */
diff --git a/gtk/a11y/gtkexpanderaccessible.c b/gtk/a11y/gtkexpanderaccessible.c
index 10510f1..24a04d9 100644
--- a/gtk/a11y/gtkexpanderaccessible.c
+++ b/gtk/a11y/gtkexpanderaccessible.c
@@ -162,7 +162,7 @@ gtk_expander_accessible_notify_gtk (GObject *obj,
g_signal_emit_by_name (atk_obj, "visible_data_changed");
}
else
- GAIL_WIDGET_CLASS (gtk_expander_accessible_parent_class)->notify_gtk (obj, pspec);
+ GTK_WIDGET_ACCESSIBLE_CLASS (gtk_expander_accessible_parent_class)->notify_gtk (obj, pspec);
}
static AtkStateSet*
@@ -195,7 +195,7 @@ static void
gtk_expander_accessible_class_init (GtkExpanderAccessibleClass *klass)
{
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
- GailWidgetClass *widget_class = (GailWidgetClass*)klass;
+ GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
widget_class->notify_gtk = gtk_expander_accessible_notify_gtk;
diff --git a/gtk/a11y/gtkimageaccessible.c b/gtk/a11y/gtkimageaccessible.c
index 82c3be6..1432a4c 100644
--- a/gtk/a11y/gtkimageaccessible.c
+++ b/gtk/a11y/gtkimageaccessible.c
@@ -26,7 +26,7 @@
static void atk_image_interface_init (AtkImageIface *iface);
-G_DEFINE_TYPE_WITH_CODE (GtkImageAccessible, gtk_image_accessible, GAIL_TYPE_WIDGET,
+G_DEFINE_TYPE_WITH_CODE (GtkImageAccessible, gtk_image_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init))
static void
diff --git a/gtk/a11y/gtkimageaccessible.h b/gtk/a11y/gtkimageaccessible.h
index 1d25859..3ed2d76 100644
--- a/gtk/a11y/gtkimageaccessible.h
+++ b/gtk/a11y/gtkimageaccessible.h
@@ -20,7 +20,7 @@
#ifndef __GTK_IMAGE_ACCESSIBLE_H__
#define __GTK_IMAGE_ACCESSIBLE_H__
-#include "gailwidget.h"
+#include "gtkwidgetaccessible.h"
G_BEGIN_DECLS
@@ -36,7 +36,7 @@ typedef struct _GtkImageAccessibleClass GtkImageAccessibleClass;
struct _GtkImageAccessible
{
- GailWidget parent;
+ GtkWidgetAccessible parent;
gchar* image_description;
gchar* stock_name;
@@ -44,7 +44,7 @@ struct _GtkImageAccessible
struct _GtkImageAccessibleClass
{
- GailWidgetClass parent_class;
+ GtkWidgetAccessibleClass parent_class;
};
GType gtk_image_accessible_get_type (void);
diff --git a/gtk/a11y/gtklabelaccessible.c b/gtk/a11y/gtklabelaccessible.c
index dc90301..b839fd0 100644
--- a/gtk/a11y/gtklabelaccessible.c
+++ b/gtk/a11y/gtklabelaccessible.c
@@ -28,7 +28,7 @@
static void atk_text_interface_init (AtkTextIface *iface);
-G_DEFINE_TYPE_WITH_CODE (GtkLabelAccessible, gtk_label_accessible, GAIL_TYPE_WIDGET,
+G_DEFINE_TYPE_WITH_CODE (GtkLabelAccessible, gtk_label_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_interface_init))
static void
@@ -119,7 +119,7 @@ gtk_label_accessible_notify_gtk (GObject *obj,
g_signal_emit_by_name (atk_obj, "text_selection_changed");
}
else
- GAIL_WIDGET_CLASS (gtk_label_accessible_parent_class)->notify_gtk (obj, pspec);
+ GTK_WIDGET_ACCESSIBLE_CLASS (gtk_label_accessible_parent_class)->notify_gtk (obj, pspec);
}
static void
@@ -247,7 +247,7 @@ gtk_label_accessible_class_init (GtkLabelAccessibleClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
- GailWidgetClass *widget_class = (GailWidgetClass*)klass;
+ GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
gobject_class->finalize = gtk_label_accessible_finalize;
diff --git a/gtk/a11y/gtklabelaccessible.h b/gtk/a11y/gtklabelaccessible.h
index 7f4ac76..90635b7 100644
--- a/gtk/a11y/gtklabelaccessible.h
+++ b/gtk/a11y/gtklabelaccessible.h
@@ -20,7 +20,7 @@
#ifndef __GTK_LABEL_ACCESSIBLE_H__
#define __GTK_LABEL_ACCESSIBLE_H__
-#include "gailwidget.h"
+#include "gtkwidgetaccessible.h"
G_BEGIN_DECLS
@@ -36,14 +36,14 @@ typedef struct _GtkLabelAccessibleClass GtkLabelAccessibleClass;
struct _GtkLabelAccessible
{
- GailWidget parent;
+ GtkWidgetAccessible parent;
gchar *text;
};
struct _GtkLabelAccessibleClass
{
- GailWidgetClass parent_class;
+ GtkWidgetAccessibleClass parent_class;
};
GType gtk_label_accessible_get_type (void);
diff --git a/gtk/a11y/gtkmenuitemaccessible.c b/gtk/a11y/gtkmenuitemaccessible.c
index e0eb01a..303dafa 100644
--- a/gtk/a11y/gtkmenuitemaccessible.c
+++ b/gtk/a11y/gtkmenuitemaccessible.c
@@ -203,7 +203,7 @@ gtk_menu_item_accessible_notify_gtk (GObject *obj,
g_signal_emit_by_name (atk_obj, "visible_data_changed");
}
else
- GAIL_WIDGET_CLASS (gtk_menu_item_accessible_parent_class)->notify_gtk (obj, pspec);
+ GTK_WIDGET_ACCESSIBLE_CLASS (gtk_menu_item_accessible_parent_class)->notify_gtk (obj, pspec);
}
static void
@@ -211,7 +211,7 @@ gtk_menu_item_accessible_class_init (GtkMenuItemAccessibleClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
- GailWidgetClass *widget_class = (GailWidgetClass*)klass;
+ GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
widget_class->notify_gtk = gtk_menu_item_accessible_notify_gtk;
diff --git a/gtk/a11y/gtknotebookaccessible.c b/gtk/a11y/gtknotebookaccessible.c
index 0668e00..a267080 100644
--- a/gtk/a11y/gtknotebookaccessible.c
+++ b/gtk/a11y/gtknotebookaccessible.c
@@ -280,7 +280,7 @@ gtk_notebook_accessible_notify_gtk (GObject *obj,
}
}
else
- GAIL_WIDGET_CLASS (gtk_notebook_accessible_parent_class)->notify_gtk (obj, pspec);
+ GTK_WIDGET_ACCESSIBLE_CLASS (gtk_notebook_accessible_parent_class)->notify_gtk (obj, pspec);
}
/*
@@ -309,7 +309,7 @@ gtk_notebook_accessible_class_init (GtkNotebookAccessibleClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
- GailWidgetClass *widget_class = (GailWidgetClass*)klass;
+ GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
GtkContainerAccessibleClass *container_class = (GtkContainerAccessibleClass*)klass;
diff --git a/gtk/a11y/gtkprogressbaraccessible.c b/gtk/a11y/gtkprogressbaraccessible.c
index ba66025..bd50c9e 100644
--- a/gtk/a11y/gtkprogressbaraccessible.c
+++ b/gtk/a11y/gtkprogressbaraccessible.c
@@ -28,7 +28,7 @@
static void atk_value_interface_init (AtkValueIface *iface);
-G_DEFINE_TYPE_WITH_CODE (GtkProgressBarAccessible, gtk_progress_bar_accessible, GAIL_TYPE_WIDGET,
+G_DEFINE_TYPE_WITH_CODE (GtkProgressBarAccessible, gtk_progress_bar_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
static void
@@ -52,15 +52,13 @@ gtk_progress_bar_accessible_notify_gtk (GObject *obj,
if (strcmp (pspec->name, "fraction") == 0)
g_object_notify (G_OBJECT (accessible), "accessible-value");
else
- GAIL_WIDGET_CLASS (gtk_progress_bar_accessible_parent_class)->notify_gtk (obj, pspec);
+ GTK_WIDGET_ACCESSIBLE_CLASS (gtk_progress_bar_accessible_parent_class)->notify_gtk (obj, pspec);
}
static void
gtk_progress_bar_accessible_class_init (GtkProgressBarAccessibleClass *klass)
{
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
- GailWidgetClass *widget_class;
-
- widget_class = (GailWidgetClass*)klass;
+ GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
widget_class->notify_gtk = gtk_progress_bar_accessible_notify_gtk;
diff --git a/gtk/a11y/gtkprogressbaraccessible.h b/gtk/a11y/gtkprogressbaraccessible.h
index 80241b9..370891b 100644
--- a/gtk/a11y/gtkprogressbaraccessible.h
+++ b/gtk/a11y/gtkprogressbaraccessible.h
@@ -20,7 +20,7 @@
#ifndef __GTK_PROGRESS_BAR_ACCESSIBLE_H__
#define __GTK_PROGRESS_BAR_ACCESSIBLE_H__
-#include "gailwidget.h"
+#include "gtkwidgetaccessible.h"
G_BEGIN_DECLS
@@ -31,17 +31,17 @@ G_BEGIN_DECLS
#define GTK_IS_PROGRESS_BAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE))
#define GTK_PROGRESS_BAR_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE, GtkProgressBarAccessibleClass))
-typedef struct _GtkProgressBarAccessible GtkProgressBarAccessible;
-typedef struct _GtkProgressBarAccessibleClass GtkProgressBarAccessibleClass;
+typedef struct _GtkProgressBarAccessible GtkProgressBarAccessible;
+typedef struct _GtkProgressBarAccessibleClass GtkProgressBarAccessibleClass;
struct _GtkProgressBarAccessible
{
- GailWidget parent;
+ GtkWidgetAccessible parent;
};
struct _GtkProgressBarAccessibleClass
{
- GailWidgetClass parent_class;
+ GtkWidgetAccessibleClass parent_class;
};
GType gtk_progress_bar_accessible_get_type (void);
diff --git a/gtk/a11y/gtkrangeaccessible.c b/gtk/a11y/gtkrangeaccessible.c
index e4b2dbe..7e246e3 100644
--- a/gtk/a11y/gtkrangeaccessible.c
+++ b/gtk/a11y/gtkrangeaccessible.c
@@ -27,7 +27,7 @@
static void atk_action_interface_init (AtkActionIface *iface);
static void atk_value_interface_init (AtkValueIface *iface);
-G_DEFINE_TYPE_WITH_CODE (GtkRangeAccessible, gtk_range_accessible, GAIL_TYPE_WIDGET,
+G_DEFINE_TYPE_WITH_CODE (GtkRangeAccessible, gtk_range_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
@@ -109,7 +109,7 @@ gtk_range_accessible_notify_gtk (GObject *obj,
range);
}
else
- GAIL_WIDGET_CLASS (gtk_range_accessible_parent_class)->notify_gtk (obj, pspec);
+ GTK_WIDGET_ACCESSIBLE_CLASS (gtk_range_accessible_parent_class)->notify_gtk (obj, pspec);
}
@@ -118,7 +118,7 @@ gtk_range_accessible_class_init (GtkRangeAccessibleClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
- GailWidgetClass *widget_class = (GailWidgetClass*)klass;
+ GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
widget_class->notify_gtk = gtk_range_accessible_notify_gtk;
diff --git a/gtk/a11y/gtkrangeaccessible.h b/gtk/a11y/gtkrangeaccessible.h
index 1451936..9ba66a4 100644
--- a/gtk/a11y/gtkrangeaccessible.h
+++ b/gtk/a11y/gtkrangeaccessible.h
@@ -20,7 +20,7 @@
#ifndef __GTK_RANGE_ACCESSIBLE_H__
#define __GTK_RANGE_ACCESSIBLE_H__
-#include "gailwidget.h"
+#include "gtkwidgetaccessible.h"
G_BEGIN_DECLS
@@ -36,14 +36,14 @@ typedef struct _GtkRangeAccessibleClass GtkRangeAccessibleClass;
struct _GtkRangeAccessible
{
- GailWidget parent;
+ GtkWidgetAccessible parent;
guint action_idle_handler;
};
struct _GtkRangeAccessibleClass
{
- GailWidgetClass parent_class;
+ GtkWidgetAccessibleClass parent_class;
};
GType gtk_range_accessible_get_type (void);
diff --git a/gtk/a11y/gtkscalebuttonaccessible.c b/gtk/a11y/gtkscalebuttonaccessible.c
index c5e33e4..2d0c166 100644
--- a/gtk/a11y/gtkscalebuttonaccessible.c
+++ b/gtk/a11y/gtkscalebuttonaccessible.c
@@ -79,7 +79,7 @@ gtk_scale_button_accessible_notify_gtk (GObject *obj,
}
else
{
- GAIL_WIDGET_CLASS (gtk_scale_button_accessible_parent_class)->notify_gtk (obj, pspec);
+ GTK_WIDGET_ACCESSIBLE_CLASS (gtk_scale_button_accessible_parent_class)->notify_gtk (obj, pspec);
}
}
@@ -87,7 +87,7 @@ static void
gtk_scale_button_accessible_class_init (GtkScaleButtonAccessibleClass *klass)
{
AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
- GailWidgetClass *widget_class = GAIL_WIDGET_CLASS (klass);
+ GtkWidgetAccessibleClass *widget_class = GTK_WIDGET_ACCESSIBLE_CLASS (klass);
atk_object_class->initialize = gtk_scale_button_accessible_initialize;
diff --git a/gtk/a11y/gtkspinbuttonaccessible.c b/gtk/a11y/gtkspinbuttonaccessible.c
index 1f13de9..85c24e3 100644
--- a/gtk/a11y/gtkspinbuttonaccessible.c
+++ b/gtk/a11y/gtkspinbuttonaccessible.c
@@ -79,7 +79,7 @@ gtk_spin_button_accessible_notify_gtk (GObject *obj,
spin_button);
}
else
- GAIL_WIDGET_CLASS (gtk_spin_button_accessible_parent_class)->notify_gtk (obj, pspec);
+ GTK_WIDGET_ACCESSIBLE_CLASS (gtk_spin_button_accessible_parent_class)->notify_gtk (obj, pspec);
}
@@ -88,9 +88,7 @@ static void
gtk_spin_button_accessible_class_init (GtkSpinButtonAccessibleClass *klass)
{
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
- GailWidgetClass *widget_class;
-
- widget_class = (GailWidgetClass*)klass;
+ GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
widget_class->notify_gtk = gtk_spin_button_accessible_notify_gtk;
diff --git a/gtk/a11y/gtktextviewaccessible.c b/gtk/a11y/gtktextviewaccessible.c
index f98021b..db29d9d 100644
--- a/gtk/a11y/gtktextviewaccessible.c
+++ b/gtk/a11y/gtktextviewaccessible.c
@@ -101,7 +101,7 @@ gtk_text_view_accessible_notify_gtk (GObject *obj,
setup_buffer (GTK_TEXT_VIEW (obj), GTK_TEXT_VIEW_ACCESSIBLE (atk_obj));
}
else
- GAIL_WIDGET_CLASS (gtk_text_view_accessible_parent_class)->notify_gtk (obj, pspec);
+ GTK_WIDGET_ACCESSIBLE_CLASS (gtk_text_view_accessible_parent_class)->notify_gtk (obj, pspec);
}
static AtkStateSet*
@@ -128,9 +128,7 @@ gtk_text_view_accessible_class_init (GtkTextViewAccessibleClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
- GailWidgetClass *widget_class;
-
- widget_class = (GailWidgetClass*)klass;
+ GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
gobject_class->finalize = gtk_text_view_accessible_finalize;
diff --git a/gtk/a11y/gtktogglebuttonaccessible.c b/gtk/a11y/gtktogglebuttonaccessible.c
index b742a96..c18e3f0 100644
--- a/gtk/a11y/gtktogglebuttonaccessible.c
+++ b/gtk/a11y/gtktogglebuttonaccessible.c
@@ -79,7 +79,7 @@ gtk_toggle_button_accessible_notify_gtk (GObject *obj,
atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, (sensitive && !inconsistent));
}
else
- GAIL_WIDGET_CLASS (gtk_toggle_button_accessible_parent_class)->notify_gtk (obj, pspec);
+ GTK_WIDGET_ACCESSIBLE_CLASS (gtk_toggle_button_accessible_parent_class)->notify_gtk (obj, pspec);
}
static AtkStateSet*
@@ -111,10 +111,9 @@ gtk_toggle_button_accessible_ref_state_set (AtkObject *accessible)
static void
gtk_toggle_button_accessible_class_init (GtkToggleButtonAccessibleClass *klass)
{
- GailWidgetClass *widget_class;
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+ GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
- widget_class = (GailWidgetClass*)klass;
widget_class->notify_gtk = gtk_toggle_button_accessible_notify_gtk;
class->ref_state_set = gtk_toggle_button_accessible_ref_state_set;
diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c
index 86ef72e..fb8ae47 100644
--- a/gtk/a11y/gtktreeviewaccessible.c
+++ b/gtk/a11y/gtktreeviewaccessible.c
@@ -395,7 +395,7 @@ gtk_tree_view_accessible_notify_gtk (GObject *obj,
g_signal_connect (adj, "value-changed", G_CALLBACK (adjustment_changed), tree_view);
}
else
- GAIL_WIDGET_CLASS (gtk_tree_view_accessible_parent_class)->notify_gtk (obj, pspec);
+ GTK_WIDGET_ACCESSIBLE_CLASS (gtk_tree_view_accessible_parent_class)->notify_gtk (obj, pspec);
}
static void
@@ -722,13 +722,9 @@ gtk_tree_view_accessible_class_init (GtkTreeViewAccessibleClass *klass)
{
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GtkAccessibleClass *accessible_class;
- GailWidgetClass *widget_class;
- GtkContainerAccessibleClass *container_class;
-
- accessible_class = (GtkAccessibleClass*)klass;
- widget_class = (GailWidgetClass*)klass;
- container_class = (GtkContainerAccessibleClass*)klass;
+ GtkAccessibleClass *accessible_class = (GtkAccessibleClass*)klass;
+ GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
+ GtkContainerAccessibleClass *container_class = (GtkContainerAccessibleClass*)klass;
class->get_n_children = gtk_tree_view_accessible_get_n_children;
class->ref_child = gtk_tree_view_accessible_ref_child;
diff --git a/gtk/a11y/gtkwidgetaccessible.c b/gtk/a11y/gtkwidgetaccessible.c
new file mode 100644
index 0000000..2b5ce86
--- /dev/null
+++ b/gtk/a11y/gtkwidgetaccessible.c
@@ -0,0 +1,902 @@
+/* GAIL - The GNOME Accessibility Implementation Library
+ * Copyright 2001, 2002, 2003 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gtk/gtk.h>
+#ifdef GDK_WINDOWING_X11
+#include <gdk/x11/gdkx.h>
+#endif
+#include "gtkwidgetaccessible.h"
+#include "gtknotebookpageaccessible.h"
+
+extern GtkWidget *focus_widget;
+
+
+static gboolean gtk_widget_accessible_on_screen (GtkWidget *widget);
+static gboolean gtk_widget_accessible_all_parents_visible (GtkWidget *widget);
+
+static void atk_component_interface_init (AtkComponentIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GtkWidgetAccessible, gtk_widget_accessible, GTK_TYPE_ACCESSIBLE,
+ G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init))
+
+/* Translate GtkWidget::focus-in/out-event to the focus_gtk vfunc */
+static gboolean
+focus_cb (GtkWidget *widget,
+ GdkEventFocus *event)
+{
+ GtkWidgetAccessible *accessible;
+ GtkWidgetAccessibleClass *klass;
+
+ accessible = GTK_WIDGET_ACCESSIBLE (gtk_widget_get_accessible (widget));
+ klass = GTK_WIDGET_ACCESSIBLE_GET_CLASS (accessible);
+ if (klass->focus_gtk)
+ return klass->focus_gtk (widget, event);
+ else
+ return FALSE;
+}
+
+/* Translate GtkWidget property change notification to the notify_gtk vfunc */
+static void
+notify_cb (GObject *obj,
+ GParamSpec *pspec)
+{
+ GtkWidgetAccessible *widget;
+ GtkWidgetAccessibleClass *klass;
+
+ widget = GTK_WIDGET_ACCESSIBLE (gtk_widget_get_accessible (GTK_WIDGET (obj)));
+ klass = GTK_WIDGET_ACCESSIBLE_GET_CLASS (widget);
+ if (klass->notify_gtk)
+ klass->notify_gtk (obj, pspec);
+}
+
+/* Translate GtkWidget::size-allocate to AtkComponent::bounds-changed */
+static void
+size_allocate_cb (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ AtkObject* accessible;
+ AtkRectangle rect;
+
+ accessible = gtk_widget_get_accessible (widget);
+ if (ATK_IS_COMPONENT (accessible))
+ {
+ rect.x = allocation->x;
+ rect.y = allocation->y;
+ rect.width = allocation->width;
+ rect.height = allocation->height;
+ g_signal_emit_by_name (accessible, "bounds_changed", &rect);
+ }
+}
+
+/* Translate GtkWidget mapped state into AtkObject showing */
+static gint
+map_cb (GtkWidget *widget)
+{
+ AtkObject *accessible;
+
+ accessible = gtk_widget_get_accessible (widget);
+ atk_object_notify_state_change (accessible, ATK_STATE_SHOWING,
+ gtk_widget_get_mapped (widget));
+ return 1;
+}
+
+static void
+focus_event (AtkObject *obj,
+ gboolean focus_in)
+{
+ AtkObject *focus_obj;
+
+ focus_obj = g_object_get_data (G_OBJECT (obj), "gail-focus-object");
+ if (focus_obj == NULL)
+ focus_obj = obj;
+ atk_object_notify_state_change (focus_obj, ATK_STATE_FOCUSED, focus_in);
+}
+
+static void
+gtk_widget_accessible_initialize (AtkObject *obj,
+ gpointer data)
+{
+ GtkAccessible *accessible;
+ GtkWidget *widget;
+
+ widget = GTK_WIDGET (data);
+
+ accessible = GTK_ACCESSIBLE (obj);
+ gtk_accessible_set_widget (accessible, widget);
+ gtk_accessible_connect_widget_destroyed (accessible);
+ g_signal_connect_after (widget, "focus-in-event", G_CALLBACK (focus_cb), NULL);
+ g_signal_connect_after (widget, "focus-out-event", G_CALLBACK (focus_cb), NULL);
+ g_signal_connect (widget, "notify", G_CALLBACK (notify_cb), NULL);
+ g_signal_connect (widget, "size-allocate", G_CALLBACK (size_allocate_cb), NULL);
+ g_signal_connect (widget, "map", G_CALLBACK (map_cb), NULL);
+ g_signal_connect (widget, "unmap", G_CALLBACK (map_cb), NULL);
+
+ atk_component_add_focus_handler (ATK_COMPONENT (accessible), focus_event);
+ g_object_set_data (G_OBJECT (obj), "atk-component-layer", GINT_TO_POINTER (ATK_LAYER_WIDGET));
+
+ obj->role = ATK_ROLE_UNKNOWN;
+}
+
+static void
+gtk_widget_accessible_destroyed (GtkWidget *widget,
+ GtkAccessible *accessible)
+{
+ gtk_accessible_set_widget (accessible, NULL);
+ atk_object_notify_state_change (ATK_OBJECT (accessible), ATK_STATE_DEFUNCT, TRUE);
+}
+
+static void
+gtk_widget_accessible_connect_widget_destroyed (GtkAccessible *accessible)
+{
+ GtkWidget *widget;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
+ if (widget)
+ g_signal_connect_after (widget, "destroy",
+ G_CALLBACK (gtk_widget_accessible_destroyed), accessible);
+}
+
+static const gchar *
+gtk_widget_accessible_get_description (AtkObject *accessible)
+{
+ GtkWidget *widget;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
+ if (widget == NULL)
+ return NULL;
+
+ if (accessible->description)
+ return accessible->description;
+
+ return gtk_widget_get_tooltip_text (widget);
+}
+
+static AtkObject *
+gtk_widget_accessible_get_parent (AtkObject *accessible)
+{
+ AtkObject *parent;
+ GtkWidget *widget, *parent_widget;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
+ if (widget == NULL)
+ return NULL;
+
+ parent = accessible->accessible_parent;
+ if (parent != NULL)
+ return parent;
+
+ parent_widget = gtk_widget_get_parent (widget);
+ if (parent_widget == NULL)
+ return NULL;
+
+ /* For a widget whose parent is a GtkNoteBook, we return the
+ * accessible object corresponding the GtkNotebookPage containing
+ * the widget as the accessible parent.
+ */
+ if (GTK_IS_NOTEBOOK (parent_widget))
+ {
+ gint page_num;
+ GtkWidget *child;
+ GtkNotebook *notebook;
+
+ page_num = 0;
+ notebook = GTK_NOTEBOOK (parent_widget);
+ while (TRUE)
+ {
+ child = gtk_notebook_get_nth_page (notebook, page_num);
+ if (!child)
+ break;
+ if (child == widget)
+ {
+ parent = gtk_widget_get_accessible (parent_widget);
+ parent = atk_object_ref_accessible_child (parent, page_num);
+ g_object_unref (parent);
+ return parent;
+ }
+ page_num++;
+ }
+ }
+ parent = gtk_widget_get_accessible (parent_widget);
+ return parent;
+}
+
+static GtkWidget *
+find_label (GtkWidget *widget)
+{
+ GList *labels;
+ GtkWidget *label;
+ GtkWidget *temp_widget;
+
+ labels = gtk_widget_list_mnemonic_labels (widget);
+ label = NULL;
+ if (labels)
+ {
+ if (labels->data)
+ {
+ if (labels->next)
+ g_warning ("Widget (%s) has more than one label", G_OBJECT_TYPE_NAME (widget));
+ else
+ label = labels->data;
+ }
+ g_list_free (labels);
+ }
+
+ /* Ignore a label within a button; bug #136602 */
+ if (label && GTK_IS_BUTTON (widget))
+ {
+ temp_widget = label;
+ while (temp_widget)
+ {
+ if (temp_widget == widget)
+ {
+ label = NULL;
+ break;
+ }
+ temp_widget = gtk_widget_get_parent (temp_widget);
+ }
+ }
+ return label;
+}
+
+static AtkRelationSet *
+gtk_widget_accessible_ref_relation_set (AtkObject *obj)
+{
+ GtkWidget *widget;
+ AtkRelationSet *relation_set;
+ GtkWidget *label;
+ AtkObject *array[1];
+ AtkRelation* relation;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+ if (widget == NULL)
+ return NULL;
+
+ relation_set = ATK_OBJECT_CLASS (gtk_widget_accessible_parent_class)->ref_relation_set (obj);
+
+ if (GTK_IS_BOX (widget))
+ return relation_set;
+
+ if (!atk_relation_set_contains (relation_set, ATK_RELATION_LABELLED_BY))
+ {
+ label = find_label (widget);
+ if (label == NULL)
+ {
+ if (GTK_IS_BUTTON (widget))
+ /*
+ * Handle the case where GnomeIconEntry is the mnemonic widget.
+ * The GtkButton which is a grandchild of the GnomeIconEntry
+ * should really be the mnemonic widget. See bug #133967.
+ */
+ {
+ GtkWidget *temp_widget;
+
+ temp_widget = gtk_widget_get_parent (widget);
+
+ if (GTK_IS_ALIGNMENT (temp_widget))
+ {
+ temp_widget = gtk_widget_get_parent (temp_widget);
+ if (GTK_IS_BOX (temp_widget))
+ {
+ label = find_label (temp_widget);
+ if (!label)
+ label = find_label (gtk_widget_get_parent (temp_widget));
+ }
+ }
+ }
+ else if (GTK_IS_COMBO_BOX (widget))
+ /*
+ * Handle the case when GtkFileChooserButton is the mnemonic
+ * widget. The GtkComboBox which is a child of the
+ * GtkFileChooserButton should be the mnemonic widget.
+ * See bug #359843.
+ */
+ {
+ GtkWidget *temp_widget;
+
+ temp_widget = gtk_widget_get_parent (widget);
+ if (GTK_IS_BOX (temp_widget))
+ {
+ label = find_label (temp_widget);
+ }
+ }
+ }
+
+ if (label)
+ {
+ array[0] = gtk_widget_get_accessible (label);
+
+ relation = atk_relation_new (array, 1, ATK_RELATION_LABELLED_BY);
+ atk_relation_set_add (relation_set, relation);
+ g_object_unref (relation);
+ }
+ }
+
+ return relation_set;
+}
+
+static AtkStateSet *
+gtk_widget_accessible_ref_state_set (AtkObject *accessible)
+{
+ GtkWidget *widget;
+ AtkStateSet *state_set;
+
+ state_set = ATK_OBJECT_CLASS (gtk_widget_accessible_parent_class)->ref_state_set (accessible);
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
+ if (widget == NULL)
+ atk_state_set_add_state (state_set, ATK_STATE_DEFUNCT);
+ else
+ {
+ if (gtk_widget_is_sensitive (widget))
+ {
+ atk_state_set_add_state (state_set, ATK_STATE_SENSITIVE);
+ atk_state_set_add_state (state_set, ATK_STATE_ENABLED);
+ }
+
+ if (gtk_widget_get_can_focus (widget))
+ {
+ atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE);
+ }
+ /*
+ * We do not currently generate notifications when an ATK object
+ * corresponding to a GtkWidget changes visibility by being scrolled
+ * on or off the screen. The testcase for this is the main window
+ * of the testgtk application in which a set of buttons in a GtkVBox
+ * is in a scrolled window with a viewport.
+ *
+ * To generate the notifications we would need to do the following:
+ * 1) Find the GtkViewport among the ancestors of the objects
+ * 2) Create an accessible for the viewport
+ * 3) Connect to the value-changed signal on the viewport
+ * 4) When the signal is received we need to traverse the children
+ * of the viewport and check whether the children are visible or not
+ * visible; we may want to restrict this to the widgets for which
+ * accessible objects have been created.
+ * 5) We probably need to store a variable on_screen in the
+ * GtkWidgetAccessible data structure so we can determine whether
+ * the value has changed.
+ */
+ if (gtk_widget_get_visible (widget))
+ {
+ atk_state_set_add_state (state_set, ATK_STATE_VISIBLE);
+ if (gtk_widget_accessible_on_screen (widget) &&
+ gtk_widget_get_mapped (widget) &&
+ gtk_widget_accessible_all_parents_visible (widget))
+ atk_state_set_add_state (state_set, ATK_STATE_SHOWING);
+ }
+
+ if (gtk_widget_has_focus (widget) && (widget == focus_widget))
+ {
+ AtkObject *focus_obj;
+
+ focus_obj = g_object_get_data (G_OBJECT (accessible), "gail-focus-object");
+ if (focus_obj == NULL)
+ atk_state_set_add_state (state_set, ATK_STATE_FOCUSED);
+ }
+
+ if (gtk_widget_has_default (widget))
+ atk_state_set_add_state (state_set, ATK_STATE_DEFAULT);
+
+ if (GTK_IS_ORIENTABLE (widget))
+ {
+ if (gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)) == GTK_ORIENTATION_HORIZONTAL)
+ atk_state_set_add_state (state_set, ATK_STATE_HORIZONTAL);
+ else
+ atk_state_set_add_state (state_set, ATK_STATE_VERTICAL);
+ }
+ }
+ return state_set;
+}
+
+static gint
+gtk_widget_accessible_get_index_in_parent (AtkObject *accessible)
+{
+ GtkWidget *widget;
+ GtkWidget *parent_widget;
+ gint index;
+ GList *children;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
+
+ if (widget == NULL)
+ return -1;
+
+ if (accessible->accessible_parent)
+ {
+ AtkObject *parent;
+
+ parent = accessible->accessible_parent;
+
+ if (GTK_IS_NOTEBOOK_PAGE_ACCESSIBLE (parent))
+ return 0;
+ else
+ {
+ gint n_children, i;
+ gboolean found = FALSE;
+
+ n_children = atk_object_get_n_accessible_children (parent);
+ for (i = 0; i < n_children; i++)
+ {
+ AtkObject *child;
+
+ child = atk_object_ref_accessible_child (parent, i);
+ if (child == accessible)
+ found = TRUE;
+
+ g_object_unref (child);
+ if (found)
+ return i;
+ }
+ }
+ }
+
+ if (!GTK_IS_WIDGET (widget))
+ return -1;
+ parent_widget = gtk_widget_get_parent (widget);
+ if (!GTK_IS_CONTAINER (parent_widget))
+ return -1;
+
+ children = gtk_container_get_children (GTK_CONTAINER (parent_widget));
+
+ index = g_list_index (children, widget);
+ g_list_free (children);
+ return index;
+}
+
+/* This function is the default implementation for the notify_gtk
+ * vfunc which gets called when a property changes value on the
+ * GtkWidget associated with a GtkWidgetAccessible. It constructs
+ * an AtkPropertyValues structure and emits a "property_changed"
+ * signal which causes the user specified AtkPropertyChangeHandler
+ * to be called.
+ */
+static void
+gtk_widget_accessible_notify_gtk (GObject *obj,
+ GParamSpec *pspec)
+{
+ GtkWidget* widget = GTK_WIDGET (obj);
+ AtkObject* atk_obj = gtk_widget_get_accessible (widget);
+ AtkState state;
+ gboolean value;
+
+ if (strcmp (pspec->name, "has-focus") == 0)
+ /*
+ * We use focus-in-event and focus-out-event signals to catch
+ * focus changes so we ignore this.
+ */
+ return;
+ else if (strcmp (pspec->name, "visible") == 0)
+ {
+ state = ATK_STATE_VISIBLE;
+ value = gtk_widget_get_visible (widget);
+ }
+ else if (strcmp (pspec->name, "sensitive") == 0)
+ {
+ state = ATK_STATE_SENSITIVE;
+ value = gtk_widget_get_sensitive (widget);
+ }
+ else if (strcmp (pspec->name, "orientation") == 0)
+ {
+ GtkOrientable *orientable;
+
+ orientable = GTK_ORIENTABLE (widget);
+
+ state = ATK_STATE_HORIZONTAL;
+ value = (gtk_orientable_get_orientation (orientable) == GTK_ORIENTATION_HORIZONTAL);
+ }
+ else
+ return;
+
+ atk_object_notify_state_change (atk_obj, state, value);
+ if (state == ATK_STATE_SENSITIVE)
+ atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, value);
+
+ if (state == ATK_STATE_HORIZONTAL)
+ atk_object_notify_state_change (atk_obj, ATK_STATE_VERTICAL, !value);
+}
+
+/* This function is the default implementation for the focus_gtk
+ * vfunc which gets called for focus_in/out_event.
+ *
+ * It emits a focus-event signal on the GtkWidgetAccessible.
+ */
+static gboolean
+gtk_widget_accessible_focus_gtk (GtkWidget *widget,
+ GdkEventFocus *event)
+{
+ AtkObject* accessible;
+ gboolean return_val;
+ return_val = FALSE;
+
+ accessible = gtk_widget_get_accessible (widget);
+ g_signal_emit_by_name (accessible, "focus_event", event->in, &return_val);
+ return FALSE;
+}
+
+static AtkAttributeSet *
+gtk_widget_accessible_get_attributes (AtkObject *obj)
+{
+ AtkAttributeSet *attributes;
+ AtkAttribute *toolkit;
+
+ toolkit = g_new (AtkAttribute, 1);
+ toolkit->name = g_strdup ("toolkit");
+ toolkit->value = g_strdup ("gail");
+
+ attributes = g_slist_append (NULL, toolkit);
+
+ return attributes;
+}
+
+static void
+gtk_widget_accessible_class_init (GtkWidgetAccessibleClass *klass)
+{
+ AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+ GtkAccessibleClass *accessible_class = GTK_ACCESSIBLE_CLASS (klass);
+
+ klass->notify_gtk = gtk_widget_accessible_notify_gtk;
+ klass->focus_gtk = gtk_widget_accessible_focus_gtk;
+
+ accessible_class->connect_widget_destroyed = gtk_widget_accessible_connect_widget_destroyed;
+
+ class->get_description = gtk_widget_accessible_get_description;
+ class->get_parent = gtk_widget_accessible_get_parent;
+ class->ref_relation_set = gtk_widget_accessible_ref_relation_set;
+ class->ref_state_set = gtk_widget_accessible_ref_state_set;
+ class->get_index_in_parent = gtk_widget_accessible_get_index_in_parent;
+ class->initialize = gtk_widget_accessible_initialize;
+ class->get_attributes = gtk_widget_accessible_get_attributes;
+}
+
+static void
+gtk_widget_accessible_init (GtkWidgetAccessible *accessible)
+{
+}
+
+static guint
+gtk_widget_accessible_add_focus_handler (AtkComponent *component,
+ AtkFocusHandler handler)
+{
+ GSignalMatchType match_type;
+ gulong ret;
+ guint signal_id;
+
+ match_type = G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC;
+ signal_id = g_signal_lookup ("focus-event", ATK_TYPE_OBJECT);
+
+ ret = g_signal_handler_find (component, match_type, signal_id, 0, NULL,
+ (gpointer) handler, NULL);
+ if (!ret)
+ return g_signal_connect_closure_by_id (component,
+ signal_id, 0,
+ g_cclosure_new (G_CALLBACK (handler),
+ NULL,
+ (GClosureNotify) NULL),
+ FALSE);
+ else
+ return 0;
+}
+
+static void
+gtk_widget_accessible_get_extents (AtkComponent *component,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height,
+ AtkCoordType coord_type)
+{
+ GdkWindow *window;
+ gint x_window, y_window;
+ gint x_toplevel, y_toplevel;
+ GtkWidget *widget;
+ GtkAllocation allocation;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component));
+ if (widget == NULL)
+ return;
+
+ gtk_widget_get_allocation (widget, &allocation);
+ *width = allocation.width;
+ *height = allocation.height;
+ if (!gtk_widget_accessible_on_screen (widget) || (!gtk_widget_is_drawable (widget)))
+ {
+ *x = G_MININT;
+ *y = G_MININT;
+ return;
+ }
+
+ if (gtk_widget_get_parent (widget))
+ {
+ *x = allocation.x;
+ *y = allocation.y;
+ window = gtk_widget_get_parent_window (widget);
+ }
+ else
+ {
+ *x = 0;
+ *y = 0;
+ window = gtk_widget_get_window (widget);
+ }
+ gdk_window_get_origin (window, &x_window, &y_window);
+ *x += x_window;
+ *y += y_window;
+
+ if (coord_type == ATK_XY_WINDOW)
+ {
+ window = gdk_window_get_toplevel (gtk_widget_get_window (widget));
+ gdk_window_get_origin (window, &x_toplevel, &y_toplevel);
+
+ *x -= x_toplevel;
+ *y -= y_toplevel;
+ }
+}
+
+static void
+gtk_widget_accessible_get_size (AtkComponent *component,
+ gint *width,
+ gint *height)
+{
+ GtkWidget *widget;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component));
+ if (widget == NULL)
+ return;
+
+ *width = gtk_widget_get_allocated_width (widget);
+ *height = gtk_widget_get_allocated_height (widget);
+}
+
+static AtkLayer
+gtk_widget_accessible_get_layer (AtkComponent *component)
+{
+ gint layer;
+
+ layer = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (component), "atk-component-layer"));
+
+ return (AtkLayer) layer;
+}
+
+static gboolean
+gtk_widget_accessible_grab_focus (AtkComponent *component)
+{
+ GtkWidget *widget;
+ GtkWidget *toplevel;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component));
+ if (!widget)
+ return FALSE;
+
+ if (!gtk_widget_get_can_focus (widget))
+ return FALSE;
+
+ gtk_widget_grab_focus (widget);
+ toplevel = gtk_widget_get_toplevel (widget);
+ if (gtk_widget_is_toplevel (toplevel))
+ {
+#ifdef GDK_WINDOWING_X11
+ gtk_window_present_with_time (GTK_WINDOW (toplevel),
+ gdk_x11_get_server_time (gtk_widget_get_window (widget)));
+#else
+ gtk_window_present (GTK_WINDOW (toplevel));
+#endif
+ }
+ return TRUE;
+}
+
+static void
+gtk_widget_accessible_remove_focus_handler (AtkComponent *component,
+ guint handler_id)
+{
+ g_signal_handler_disconnect (component, handler_id);
+}
+
+static gboolean
+gtk_widget_accessible_set_extents (AtkComponent *component,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ AtkCoordType coord_type)
+{
+ GtkWidget *widget;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component));
+ if (widget == NULL)
+ return FALSE;
+
+ if (!gtk_widget_is_toplevel (widget))
+ return FALSE;
+
+ if (coord_type == ATK_XY_WINDOW)
+ {
+ gint x_current, y_current;
+ GdkWindow *window = gtk_widget_get_window (widget);
+
+ gdk_window_get_origin (window, &x_current, &y_current);
+ x_current += x;
+ y_current += y;
+ if (x_current < 0 || y_current < 0)
+ return FALSE;
+ else
+ {
+ gtk_window_move (GTK_WINDOW (widget), x_current, y_current);
+ gtk_widget_set_size_request (widget, width, height);
+ return TRUE;
+ }
+ }
+ else if (coord_type == ATK_XY_SCREEN)
+ {
+ gtk_window_move (GTK_WINDOW (widget), x, y);
+ gtk_widget_set_size_request (widget, width, height);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static gboolean
+gtk_widget_accessible_set_position (AtkComponent *component,
+ gint x,
+ gint y,
+ AtkCoordType coord_type)
+{
+ GtkWidget *widget;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component));
+ if (widget == NULL)
+ return FALSE;
+
+ if (gtk_widget_is_toplevel (widget))
+ {
+ if (coord_type == ATK_XY_WINDOW)
+ {
+ gint x_current, y_current;
+ GdkWindow *window = gtk_widget_get_window (widget);
+
+ gdk_window_get_origin (window, &x_current, &y_current);
+ x_current += x;
+ y_current += y;
+ if (x_current < 0 || y_current < 0)
+ return FALSE;
+ else
+ {
+ gtk_window_move (GTK_WINDOW (widget), x_current, y_current);
+ return TRUE;
+ }
+ }
+ else if (coord_type == ATK_XY_SCREEN)
+ {
+ gtk_window_move (GTK_WINDOW (widget), x, y);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+static gboolean
+gtk_widget_accessible_set_size (AtkComponent *component,
+ gint width,
+ gint height)
+{
+ GtkWidget *widget;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component));
+ if (widget == NULL)
+ return FALSE;
+
+ if (gtk_widget_is_toplevel (widget))
+ {
+ gtk_widget_set_size_request (widget, width, height);
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+static void
+atk_component_interface_init (AtkComponentIface *iface)
+{
+ iface->add_focus_handler = gtk_widget_accessible_add_focus_handler;
+ iface->get_extents = gtk_widget_accessible_get_extents;
+ iface->get_size = gtk_widget_accessible_get_size;
+ iface->get_layer = gtk_widget_accessible_get_layer;
+ iface->grab_focus = gtk_widget_accessible_grab_focus;
+ iface->remove_focus_handler = gtk_widget_accessible_remove_focus_handler;
+ iface->set_extents = gtk_widget_accessible_set_extents;
+ iface->set_position = gtk_widget_accessible_set_position;
+ iface->set_size = gtk_widget_accessible_set_size;
+}
+
+/* This function checks whether the widget has an ancestor which is
+ * a GtkViewport and, if so, whether any part of the widget intersects
+ * the visible rectangle of the GtkViewport.
+ */
+static gboolean
+gtk_widget_accessible_on_screen (GtkWidget *widget)
+{
+ GtkAllocation allocation;
+ GtkWidget *viewport;
+ gboolean return_value;
+
+ gtk_widget_get_allocation (widget, &allocation);
+
+ viewport = gtk_widget_get_ancestor (widget, GTK_TYPE_VIEWPORT);
+ if (viewport)
+ {
+ GtkAllocation viewport_allocation;
+ GtkAdjustment *adjustment;
+ GdkRectangle visible_rect;
+
+ gtk_widget_get_allocation (viewport, &viewport_allocation);
+
+ adjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (viewport));
+ visible_rect.y = gtk_adjustment_get_value (adjustment);
+ adjustment = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (viewport));
+ visible_rect.x = gtk_adjustment_get_value (adjustment);
+ visible_rect.width = viewport_allocation.width;
+ visible_rect.height = viewport_allocation.height;
+
+ if (((allocation.x + allocation.width) < visible_rect.x) ||
+ ((allocation.y + allocation.height) < visible_rect.y) ||
+ (allocation.x > (visible_rect.x + visible_rect.width)) ||
+ (allocation.y > (visible_rect.y + visible_rect.height)))
+ return_value = FALSE;
+ else
+ return_value = TRUE;
+ }
+ else
+ {
+ /* Check whether the widget has been placed of the screen.
+ * The widget may be MAPPED as when toolbar items do not
+ * fit on the toolbar.
+ */
+ if (allocation.x + allocation.width <= 0 &&
+ allocation.y + allocation.height <= 0)
+ return_value = FALSE;
+ else
+ return_value = TRUE;
+ }
+
+ return return_value;
+}
+
+/* Checks if all the predecessors (the parent widget, his parent, etc)
+ * are visible Used to check properly the SHOWING state.
+ */
+static gboolean
+gtk_widget_accessible_all_parents_visible (GtkWidget *widget)
+{
+ GtkWidget *iter_parent = NULL;
+ gboolean result = TRUE;
+
+ for (iter_parent = gtk_widget_get_parent (widget); iter_parent;
+ iter_parent = gtk_widget_get_parent (iter_parent))
+ {
+ if (!gtk_widget_get_visible (iter_parent))
+ {
+ result = FALSE;
+ break;
+ }
+ }
+
+ return result;
+}
diff --git a/gtk/a11y/gailwidget.h b/gtk/a11y/gtkwidgetaccessible.h
similarity index 55%
rename from gtk/a11y/gailwidget.h
rename to gtk/a11y/gtkwidgetaccessible.h
index 438f6e4..f51f3f0 100644
--- a/gtk/a11y/gailwidget.h
+++ b/gtk/a11y/gtkwidgetaccessible.h
@@ -17,31 +17,29 @@
* Boston, MA 02111-1307, USA.
*/
-#ifndef __GAIL_WIDGET_H__
-#define __GAIL_WIDGET_H__
+#ifndef __GTK_WIDGET_ACCESSIBLE_H__
+#define __GTK_WIDGET_ACCESSIBLE_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
-#define GAIL_TYPE_WIDGET (gail_widget_get_type ())
-#define GAIL_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_WIDGET, GailWidget))
-#define GAIL_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_WIDGET, GailWidgetClass))
-#define GAIL_IS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_WIDGET))
-#define GAIL_IS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_WIDGET))
-#define GAIL_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_WIDGET, GailWidgetClass))
+#define GTK_TYPE_WIDGET_ACCESSIBLE (gtk_widget_accessible_get_type ())
+#define GTK_WIDGET_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_WIDGET_ACCESSIBLE, GtkWidgetAccessible))
+#define GTK_WIDGET_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WIDGET_ACCESSIBLE, GtkWidgetAccessibleClass))
+#define GTK_IS_WIDGET_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_WIDGET_ACCESSIBLE))
+#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 _GailWidget GailWidget;
-typedef struct _GailWidgetClass GailWidgetClass;
+typedef struct _GtkWidgetAccessible GtkWidgetAccessible;
+typedef struct _GtkWidgetAccessibleClass GtkWidgetAccessibleClass;
-struct _GailWidget
+struct _GtkWidgetAccessible
{
GtkAccessible parent;
};
-GType gail_widget_get_type (void);
-
-struct _GailWidgetClass
+struct _GtkWidgetAccessibleClass
{
GtkAccessibleClass parent_class;
@@ -58,6 +56,8 @@ struct _GailWidgetClass
};
+GType gtk_widget_accessible_get_type (void);
+
G_END_DECLS
-#endif /* __GAIL_WIDGET_H__ */
+#endif /* __GTK_WIDGET_ACCESSIBLE_H__ */
diff --git a/gtk/a11y/gtkwindowaccessible.c b/gtk/a11y/gtkwindowaccessible.c
index e421093..4ca157f 100644
--- a/gtk/a11y/gtkwindowaccessible.c
+++ b/gtk/a11y/gtkwindowaccessible.c
@@ -85,7 +85,7 @@ gtk_window_accessible_notify_gtk (GObject *obj,
g_signal_emit_by_name (atk_obj, "visible_data_changed");
}
else
- GAIL_WIDGET_CLASS (gtk_window_accessible_parent_class)->notify_gtk (obj, pspec);
+ GTK_WIDGET_ACCESSIBLE_CLASS (gtk_window_accessible_parent_class)->notify_gtk (obj, pspec);
}
static gboolean
@@ -320,8 +320,8 @@ gtk_window_accessible_ref_state_set (AtkObject *accessible)
static void
gtk_window_accessible_class_init (GtkWindowAccessibleClass *klass)
{
- GailWidgetClass *widget_class = (GailWidgetClass*)klass;
- AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+ GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
+ AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
widget_class->focus_gtk = gtk_window_accessible_focus_gtk;
widget_class->notify_gtk = gtk_window_accessible_notify_gtk;
diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c
index eb7697f..ba1b206 100644
--- a/gtk/gtkaccessible.c
+++ b/gtk/gtkaccessible.c
@@ -124,12 +124,8 @@ gtk_accessible_real_connect_widget_destroyed (GtkAccessible *accessible)
GtkAccessiblePrivate *priv = accessible->priv;
if (priv->widget)
- {
- g_signal_connect (priv->widget,
- "destroy",
- G_CALLBACK (gtk_widget_destroyed),
- &priv->widget);
- }
+ g_signal_connect (priv->widget, "destroy",
+ G_CALLBACK (gtk_widget_destroyed), &priv->widget);
}
/*
diff --git a/gtk/gtkspinner.c b/gtk/gtkspinner.c
index 43070be..34d4104 100644
--- a/gtk/gtkspinner.c
+++ b/gtk/gtkspinner.c
@@ -35,6 +35,7 @@
#include "gtkaccessible.h"
#include "gtkimage.h"
#include "gtkspinner.h"
+#include "a11y/gtkwidgetaccessible.h"
/**
@@ -83,8 +84,7 @@ static void gtk_spinner_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static AtkObject *gtk_spinner_get_accessible (GtkWidget *widget);
-static GType gtk_spinner_accessible_get_type (void);
+GType _gtk_spinner_accessible_get_type (void);
G_DEFINE_TYPE (GtkSpinner, gtk_spinner, GTK_TYPE_WIDGET)
@@ -101,7 +101,6 @@ gtk_spinner_class_init (GtkSpinnerClass *klass)
widget_class = GTK_WIDGET_CLASS(klass);
widget_class->draw = gtk_spinner_draw;
- widget_class->get_accessible = gtk_spinner_get_accessible;
widget_class->get_preferred_width = gtk_spinner_get_preferred_width;
widget_class->get_preferred_height = gtk_spinner_get_preferred_height;
@@ -118,6 +117,8 @@ gtk_spinner_class_init (GtkSpinnerClass *klass)
P_("Whether the spinner is active"),
FALSE,
G_PARAM_READWRITE));
+
+ gtk_widget_class_set_accessible_type (widget_class, _gtk_spinner_accessible_get_type ());
}
static void
@@ -268,20 +269,18 @@ gtk_spinner_accessible_image_iface_init (AtkImageIface *iface)
}
/* dummy typedef */
-typedef struct _GtkSpinnerAccessible GtkSpinnerAccessible;
-typedef struct _GtkSpinnerAccessibleClass GtkSpinnerAccessibleClass;
+typedef GtkWidgetAccessible GtkSpinnerAccessible;
+typedef GtkWidgetAccessibleClass GtkSpinnerAccessibleClass;
-ATK_DEFINE_TYPE_WITH_CODE (GtkSpinnerAccessible,
- gtk_spinner_accessible,
- GTK_TYPE_IMAGE,
- G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE,
- gtk_spinner_accessible_image_iface_init));
+G_DEFINE_TYPE_WITH_CODE (GtkSpinnerAccessible, _gtk_spinner_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
+ G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE,
+ gtk_spinner_accessible_image_iface_init));
static void
gtk_spinner_accessible_initialize (AtkObject *accessible,
gpointer widget)
{
- ATK_OBJECT_CLASS (gtk_spinner_accessible_parent_class)->initialize (accessible, widget);
+ ATK_OBJECT_CLASS (_gtk_spinner_accessible_parent_class)->initialize (accessible, widget);
atk_object_set_name (accessible, C_("throbbing progress animation widget", "Spinner"));
atk_object_set_description (accessible, _("Provides visual indication of progress"));
@@ -289,7 +288,7 @@ gtk_spinner_accessible_initialize (AtkObject *accessible,
}
static void
-gtk_spinner_accessible_class_init (GtkSpinnerAccessibleClass *klass)
+_gtk_spinner_accessible_class_init (GtkSpinnerAccessibleClass *klass)
{
AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
@@ -297,77 +296,8 @@ gtk_spinner_accessible_class_init (GtkSpinnerAccessibleClass *klass)
}
static void
-gtk_spinner_accessible_init (GtkSpinnerAccessible *self)
-{
-}
-
-/* factory */
-typedef AtkObjectFactory GtkSpinnerAccessibleFactory;
-typedef AtkObjectFactoryClass GtkSpinnerAccessibleFactoryClass;
-
-G_DEFINE_TYPE (GtkSpinnerAccessibleFactory,
- _gtk_spinner_accessible_factory,
- ATK_TYPE_OBJECT_FACTORY);
-
-static GType
-gtk_spinner_accessible_factory_get_accessible_type (void)
-{
- return gtk_spinner_accessible_get_type ();
-}
-
-static AtkObject *
-gtk_spinner_accessible_factory_create_accessible (GObject *obj)
-{
- AtkObject *accessible;
-
- accessible = g_object_new (gtk_spinner_accessible_get_type (), NULL);
- atk_object_initialize (accessible, obj);
-
- return accessible;
-}
-
-static void
-_gtk_spinner_accessible_factory_class_init (AtkObjectFactoryClass *klass)
+_gtk_spinner_accessible_init (GtkSpinnerAccessible *self)
{
- klass->create_accessible = gtk_spinner_accessible_factory_create_accessible;
- klass->get_accessible_type = gtk_spinner_accessible_factory_get_accessible_type;
-}
-
-static void
-_gtk_spinner_accessible_factory_init (AtkObjectFactory *factory)
-{
-}
-
-static AtkObject *
-gtk_spinner_get_accessible (GtkWidget *widget)
-{
- static gboolean first_time = TRUE;
-
- if (first_time)
- {
- AtkObjectFactory *factory;
- AtkRegistry *registry;
- GType derived_type;
- GType derived_atk_type;
-
- /*
- * Figure out whether accessibility is enabled by looking at the
- * type of the accessible object which would be created for
- * the parent type of GtkSpinner.
- */
- derived_type = g_type_parent (GTK_TYPE_SPINNER);
-
- registry = atk_get_default_registry ();
- factory = atk_registry_get_factory (registry, derived_type);
- derived_atk_type = atk_object_factory_get_accessible_type (factory);
- if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE))
- atk_registry_set_factory_type (registry,
- GTK_TYPE_SPINNER,
- _gtk_spinner_accessible_factory_get_type ());
- first_time = FALSE;
- }
-
- return GTK_WIDGET_CLASS (gtk_spinner_parent_class)->get_accessible (widget);
}
/**
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index ae5f68e..fb18bb8 100644
--- a/gtk/gtkswitch.c
+++ b/gtk/gtkswitch.c
@@ -47,6 +47,7 @@
#include "gtktoggleaction.h"
#include "gtkwidget.h"
#include "gtkmarshalers.h"
+#include "a11y/gtkwidgetaccessible.h"
#include <math.h>
@@ -89,7 +90,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
static GParamSpec *switch_props[LAST_PROP] = { NULL, };
-static GType gtk_switch_accessible_factory_get_type (void);
+GType _gtk_switch_accessible_get_type (void);
static void gtk_switch_activatable_interface_init (GtkActivatableIface *iface);
@@ -659,21 +660,6 @@ gtk_switch_draw (GtkWidget *widget,
return FALSE;
}
-static AtkObject *
-gtk_switch_get_accessible (GtkWidget *widget)
-{
- static gboolean first_time = TRUE;
-
- if (G_UNLIKELY (first_time))
- {
- _gtk_accessible_set_factory_type (GTK_TYPE_SWITCH,
- gtk_switch_accessible_factory_get_type ());
- first_time = FALSE;
- }
-
- return GTK_WIDGET_CLASS (gtk_switch_parent_class)->get_accessible (widget);
-}
-
static void
gtk_switch_set_related_action (GtkSwitch *sw,
GtkAction *action)
@@ -821,7 +807,6 @@ gtk_switch_class_init (GtkSwitchClass *klass)
widget_class->motion_notify_event = gtk_switch_motion;
widget_class->enter_notify_event = gtk_switch_enter;
widget_class->leave_notify_event = gtk_switch_leave;
- widget_class->get_accessible = gtk_switch_get_accessible;
klass->activate = gtk_switch_activate;
@@ -857,6 +842,7 @@ gtk_switch_class_init (GtkSwitchClass *klass)
G_TYPE_NONE, 0);
widget_class->activate_signal = signals[ACTIVATE];
+ gtk_widget_class_set_accessible_type (widget_class, _gtk_switch_accessible_get_type ());
}
static void
@@ -1025,7 +1011,7 @@ struct _GtkSwitchAccessibleClass
static void atk_action_interface_init (AtkActionIface *iface);
-G_DEFINE_TYPE_WITH_CODE (GtkSwitchAccessible, _gtk_switch_accessible, g_type_from_name ("GailWidget"),
+G_DEFINE_TYPE_WITH_CODE (GtkSwitchAccessible, _gtk_switch_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init))
static AtkStateSet *
@@ -1178,41 +1164,3 @@ atk_action_interface_init (AtkActionIface *iface)
iface->get_description = gtk_switch_action_get_description;
iface->set_description = gtk_switch_action_set_description;
}
-
-/* accessibility: factory */
-
-typedef AtkObjectFactoryClass GtkSwitchAccessibleFactoryClass;
-typedef AtkObjectFactory GtkSwitchAccessibleFactory;
-
-G_DEFINE_TYPE (GtkSwitchAccessibleFactory,
- gtk_switch_accessible_factory,
- ATK_TYPE_OBJECT_FACTORY);
-
-static GType
-gtk_switch_accessible_factory_get_accessible_type (void)
-{
- return _gtk_switch_accessible_get_type ();
-}
-
-static AtkObject *
-gtk_switch_accessible_factory_create_accessible (GObject *obj)
-{
- AtkObject *accessible;
-
- accessible = g_object_new (_gtk_switch_accessible_get_type (), NULL);
- atk_object_initialize (accessible, obj);
-
- return accessible;
-}
-
-static void
-gtk_switch_accessible_factory_class_init (AtkObjectFactoryClass *klass)
-{
- klass->create_accessible = gtk_switch_accessible_factory_create_accessible;
- klass->get_accessible_type = gtk_switch_accessible_factory_get_accessible_type;
-}
-
-static void
-gtk_switch_accessible_factory_init (AtkObjectFactory *factory)
-{
-}
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 3e375f9..5491107 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -65,7 +65,7 @@
#include "gtkdebug.h"
#include "gtkplug.h"
#include "gtktypebuiltins.h"
-
+#include "a11y/gtkwidgetaccessible.h"
/**
* SECTION:gtkwidget
@@ -3178,6 +3178,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_PARAM_READABLE));
g_type_class_add_private (klass, sizeof (GtkWidgetPrivate));
+
+ gtk_widget_class_set_accessible_type (klass, GTK_TYPE_WIDGET_ACCESSIBLE);
}
static void
diff --git a/tests/a11y/colorchooser.txt b/tests/a11y/colorchooser.txt
index b445584..87e7db6 100644
--- a/tests/a11y/colorchooser.txt
+++ b/tests/a11y/colorchooser.txt
@@ -43,7 +43,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-4
+ unnamed-GtkWidgetAccessible-4
"color chooser"
parent: unnamed-GtkBoxAccessible-3
index: 0
@@ -82,7 +82,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-8
+ unnamed-GtkWidgetAccessible-8
"unknown"
parent: unnamed-GtkBoxAccessible-7
index: 0
@@ -92,7 +92,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-9
+ unnamed-GtkWidgetAccessible-9
"unknown"
parent: unnamed-GtkBoxAccessible-7
index: 1
@@ -318,7 +318,7 @@ window1
variant: <omitted>
weight: <omitted>
wrap-mode: word
- unnamed-GailWidget-14
+ unnamed-GtkWidgetAccessible-14
"separator"
parent: unnamed-GtkContainerAccessible-12
index: 5
@@ -332,7 +332,7 @@ window1
parent: unnamed-GtkContainerAccessible-12
index: 6
description: Amount of blue light in the color.
- controller-for: unnamed-GailWidget-4
+ controller-for: unnamed-GtkWidgetAccessible-4
labelled-by: Blue:
state: editable enabled focusable sensitive showing single-line visible
toolkit: gail
@@ -421,7 +421,7 @@ window1
parent: unnamed-GtkContainerAccessible-12
index: 8
description: Amount of green light in the color.
- controller-for: unnamed-GailWidget-4
+ controller-for: unnamed-GtkWidgetAccessible-4
labelled-by: Green:
state: editable enabled focusable sensitive showing single-line visible
toolkit: gail
@@ -510,7 +510,7 @@ window1
parent: unnamed-GtkContainerAccessible-12
index: 10
description: Amount of red light in the color.
- controller-for: unnamed-GailWidget-4
+ controller-for: unnamed-GtkWidgetAccessible-4
labelled-by: Red:
state: editable enabled focusable sensitive showing single-line visible
toolkit: gail
@@ -599,7 +599,7 @@ window1
parent: unnamed-GtkContainerAccessible-12
index: 12
description: Brightness of the color.
- controller-for: unnamed-GailWidget-4
+ controller-for: unnamed-GtkWidgetAccessible-4
labelled-by: Value:
state: editable enabled focusable sensitive showing single-line visible
toolkit: gail
@@ -688,7 +688,7 @@ window1
parent: unnamed-GtkContainerAccessible-12
index: 14
description: Intensity of the color.
- controller-for: unnamed-GailWidget-4
+ controller-for: unnamed-GtkWidgetAccessible-4
labelled-by: Saturation:
state: editable enabled focusable sensitive showing single-line visible
toolkit: gail
@@ -777,7 +777,7 @@ window1
parent: unnamed-GtkContainerAccessible-12
index: 16
description: Position on the color wheel.
- controller-for: unnamed-GailWidget-4
+ controller-for: unnamed-GtkWidgetAccessible-4
labelled-by: Hue:
state: editable enabled focusable sensitive showing single-line visible
toolkit: gail
@@ -875,7 +875,7 @@ window1
parent: unnamed-GtkBoxAccessible-15
index: 0
name: Palette:
- label-for: unnamed-GailWidget-16
+ label-for: unnamed-GtkWidgetAccessible-16
state: enabled multi-line sensitive visible
toolkit: gail
<AtkComponent>
@@ -928,7 +928,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-19
+ unnamed-GtkWidgetAccessible-19
"unknown"
parent: unnamed-GtkFrameAccessible-18
index: 0
@@ -947,7 +947,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-21
+ unnamed-GtkWidgetAccessible-21
"unknown"
parent: unnamed-GtkFrameAccessible-20
index: 0
@@ -966,7 +966,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-23
+ unnamed-GtkWidgetAccessible-23
"unknown"
parent: unnamed-GtkFrameAccessible-22
index: 0
@@ -985,7 +985,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-25
+ unnamed-GtkWidgetAccessible-25
"unknown"
parent: unnamed-GtkFrameAccessible-24
index: 0
@@ -1004,7 +1004,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-27
+ unnamed-GtkWidgetAccessible-27
"unknown"
parent: unnamed-GtkFrameAccessible-26
index: 0
@@ -1023,7 +1023,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-29
+ unnamed-GtkWidgetAccessible-29
"unknown"
parent: unnamed-GtkFrameAccessible-28
index: 0
@@ -1042,7 +1042,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-31
+ unnamed-GtkWidgetAccessible-31
"unknown"
parent: unnamed-GtkFrameAccessible-30
index: 0
@@ -1061,7 +1061,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-33
+ unnamed-GtkWidgetAccessible-33
"unknown"
parent: unnamed-GtkFrameAccessible-32
index: 0
@@ -1080,7 +1080,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-35
+ unnamed-GtkWidgetAccessible-35
"unknown"
parent: unnamed-GtkFrameAccessible-34
index: 0
@@ -1099,7 +1099,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-37
+ unnamed-GtkWidgetAccessible-37
"unknown"
parent: unnamed-GtkFrameAccessible-36
index: 0
@@ -1118,7 +1118,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-39
+ unnamed-GtkWidgetAccessible-39
"unknown"
parent: unnamed-GtkFrameAccessible-38
index: 0
@@ -1137,7 +1137,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-41
+ unnamed-GtkWidgetAccessible-41
"unknown"
parent: unnamed-GtkFrameAccessible-40
index: 0
@@ -1156,7 +1156,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-43
+ unnamed-GtkWidgetAccessible-43
"unknown"
parent: unnamed-GtkFrameAccessible-42
index: 0
@@ -1175,7 +1175,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-45
+ unnamed-GtkWidgetAccessible-45
"unknown"
parent: unnamed-GtkFrameAccessible-44
index: 0
@@ -1194,7 +1194,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-47
+ unnamed-GtkWidgetAccessible-47
"unknown"
parent: unnamed-GtkFrameAccessible-46
index: 0
@@ -1213,7 +1213,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-49
+ unnamed-GtkWidgetAccessible-49
"unknown"
parent: unnamed-GtkFrameAccessible-48
index: 0
@@ -1232,7 +1232,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-51
+ unnamed-GtkWidgetAccessible-51
"unknown"
parent: unnamed-GtkFrameAccessible-50
index: 0
@@ -1251,7 +1251,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-53
+ unnamed-GtkWidgetAccessible-53
"unknown"
parent: unnamed-GtkFrameAccessible-52
index: 0
@@ -1270,7 +1270,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-55
+ unnamed-GtkWidgetAccessible-55
"unknown"
parent: unnamed-GtkFrameAccessible-54
index: 0
@@ -1289,7 +1289,7 @@ window1
<AtkComponent>
layer: widget
alpha: 1
- unnamed-GailWidget-16
+ unnamed-GtkWidgetAccessible-16
"unknown"
parent: unnamed-GtkFrameAccessible-56
index: 0
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]