[gtk+] Convert GailToggleButton to GtkToggleButtonAccessible
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Convert GailToggleButton to GtkToggleButtonAccessible
- Date: Tue, 5 Jul 2011 20:32:47 +0000 (UTC)
commit a8b67d2064c4e9473915cb9699afa77fa51a4aab
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jun 28 00:53:22 2011 -0400
Convert GailToggleButton to GtkToggleButtonAccessible
gtk/a11y/Makefile.am | 4 +-
gtk/a11y/gail.c | 3 -
gtk/a11y/gailtogglebutton.h | 51 --------
gtk/a11y/gtkradiobuttonaccessible.c | 2 +-
gtk/a11y/gtkradiobuttonaccessible.h | 6 +-
...ltogglebutton.c => gtktogglebuttonaccessible.c} | 122 +++++++++-----------
gtk/a11y/gtktogglebuttonaccessible.h | 51 ++++++++
gtk/gtktogglebutton.c | 3 +
8 files changed, 113 insertions(+), 129 deletions(-)
---
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am
index b13084e..deab12c 100644
--- a/gtk/a11y/Makefile.am
+++ b/gtk/a11y/Makefile.am
@@ -45,7 +45,7 @@ gail_c_sources = \
gailtextcell.c \
gailtextutil.c \
gtktextviewaccessible.c \
- gailtogglebutton.c \
+ gtktogglebuttonaccessible.c \
gailtoplevel.c \
gailtreeview.c \
gailutil.c \
@@ -96,7 +96,7 @@ gail_private_h_sources = \
gailtextcell.h \
gailtextutil.h \
gtktextviewaccessible.h \
- gailtogglebutton.h \
+ gtktogglebuttonaccessible.h \
gailtoplevel.h \
gailtreeview.h \
gailutil.h \
diff --git a/gtk/a11y/gail.c b/gtk/a11y/gail.c
index 165bc36..0d13b2f 100644
--- a/gtk/a11y/gail.c
+++ b/gtk/a11y/gail.c
@@ -42,7 +42,6 @@
#include "gailscrolledwindow.h"
#include "gailstatusbar.h"
#include "gailtextcell.h"
-#include "gailtogglebutton.h"
#include "gailtoplevel.h"
#include "gailtreeview.h"
#include "gailutil.h"
@@ -99,7 +98,6 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_WIDGET, GailWidget, gail_widget, GTK_TYPE_WIDG
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_CONTAINER, GailContainer, gail_container, GTK_TYPE_CONTAINER)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_BUTTON, GailButton, gail_button, GTK_TYPE_BUTTON)
GAIL_IMPLEMENT_FACTORY_WITH_FUNC (GAIL_TYPE_MENU_ITEM, GailMenuItem, gail_menu_item, gail_menu_item_new)
-GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_TOGGLE_BUTTON, GailToggleButton, gail_toggle_button, GTK_TYPE_TOGGLE_BUTTON)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_COMBO_BOX, GailComboBox, gail_combo_box, GTK_TYPE_COMBO_BOX)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_MENU_SHELL, GailMenuShell, gail_menu_shell, GTK_TYPE_MENU_SHELL)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_MENU, GailMenu, gail_menu, GTK_TYPE_MENU)
@@ -860,7 +858,6 @@ gail_accessibility_module_init (void)
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CONTAINER, gail_container);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_BUTTON, gail_button);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_MENU_ITEM, gail_menu_item);
- GAIL_WIDGET_SET_FACTORY (GTK_TYPE_TOGGLE_BUTTON, gail_toggle_button);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_COMBO_BOX, gail_combo_box);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_MENU_BAR, gail_menu_shell);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_MENU, gail_menu);
diff --git a/gtk/a11y/gtkradiobuttonaccessible.c b/gtk/a11y/gtkradiobuttonaccessible.c
index 50e99b3..b38cb95 100644
--- a/gtk/a11y/gtkradiobuttonaccessible.c
+++ b/gtk/a11y/gtkradiobuttonaccessible.c
@@ -23,7 +23,7 @@
#include "gtkradiobuttonaccessible.h"
-G_DEFINE_TYPE (GtkRadioButtonAccessible, gtk_radio_button_accessible, GAIL_TYPE_TOGGLE_BUTTON)
+G_DEFINE_TYPE (GtkRadioButtonAccessible, gtk_radio_button_accessible, GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE)
static void
gtk_radio_button_accessible_initialize (AtkObject *accessible,
diff --git a/gtk/a11y/gtkradiobuttonaccessible.h b/gtk/a11y/gtkradiobuttonaccessible.h
index 44f47c5..8caa6d2 100644
--- a/gtk/a11y/gtkradiobuttonaccessible.h
+++ b/gtk/a11y/gtkradiobuttonaccessible.h
@@ -20,7 +20,7 @@
#ifndef __GTK_RADIO_BUTTON_ACCESSIBLE_H__
#define __GTK_RADIO_BUTTON_ACCESSIBLE_H__
-#include "gailtogglebutton.h"
+#include "gtktogglebuttonaccessible.h"
G_BEGIN_DECLS
@@ -36,14 +36,14 @@ typedef struct _GtkRadioButtonAccessibleClass GtkRadioButtonAccessibleClass;
struct _GtkRadioButtonAccessible
{
- GailToggleButton parent;
+ GtkToggleButtonAccessible parent;
GSList *old_group;
};
struct _GtkRadioButtonAccessibleClass
{
- GailToggleButtonClass parent_class;
+ GtkToggleButtonAccessibleClass parent_class;
};
GType gtk_radio_button_accessible_get_type (void);
diff --git a/gtk/a11y/gailtogglebutton.c b/gtk/a11y/gtktogglebuttonaccessible.c
similarity index 62%
rename from gtk/a11y/gailtogglebutton.c
rename to gtk/a11y/gtktogglebuttonaccessible.c
index 63f8d44..04322f6 100644
--- a/gtk/a11y/gailtogglebutton.c
+++ b/gtk/a11y/gtktogglebuttonaccessible.c
@@ -21,52 +21,32 @@
#include <string.h>
#include <gtk/gtk.h>
-#include "gailtogglebutton.h"
+#include "gtktogglebuttonaccessible.h"
-static void gail_toggle_button_class_init (GailToggleButtonClass *klass);
-static void gail_toggle_button_init (GailToggleButton *button);
-
-static void gail_toggle_button_toggled_gtk (GtkWidget *widget);
-
-static void gail_toggle_button_real_notify_gtk (GObject *obj,
- GParamSpec *pspec);
-
-static void gail_toggle_button_real_initialize (AtkObject *obj,
- gpointer data);
-
-static AtkStateSet* gail_toggle_button_ref_state_set (AtkObject *accessible);
-
-G_DEFINE_TYPE (GailToggleButton, gail_toggle_button, GAIL_TYPE_BUTTON)
+G_DEFINE_TYPE (GtkToggleButtonAccessible, gtk_toggle_button_accessible, GAIL_TYPE_BUTTON)
static void
-gail_toggle_button_class_init (GailToggleButtonClass *klass)
+gtk_toggle_button_accessible_toggled (GtkWidget *widget)
{
- GailWidgetClass *widget_class;
- AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
-
- widget_class = (GailWidgetClass*)klass;
- widget_class->notify_gtk = gail_toggle_button_real_notify_gtk;
+ AtkObject *accessible;
+ GtkToggleButton *toggle_button;
- class->ref_state_set = gail_toggle_button_ref_state_set;
- class->initialize = gail_toggle_button_real_initialize;
-}
+ toggle_button = GTK_TOGGLE_BUTTON (widget);
-static void
-gail_toggle_button_init (GailToggleButton *button)
-{
+ accessible = gtk_widget_get_accessible (widget);
+ atk_object_notify_state_change (accessible, ATK_STATE_CHECKED,
+ gtk_toggle_button_get_active (toggle_button));
}
static void
-gail_toggle_button_real_initialize (AtkObject *obj,
- gpointer data)
+gtk_toggle_button_accessible_initialize (AtkObject *obj,
+ gpointer data)
{
- ATK_OBJECT_CLASS (gail_toggle_button_parent_class)->initialize (obj, data);
+ ATK_OBJECT_CLASS (gtk_toggle_button_accessible_parent_class)->initialize (obj, data);
- g_signal_connect (data,
- "toggled",
- G_CALLBACK (gail_toggle_button_toggled_gtk),
- NULL);
+ g_signal_connect (data, "toggled",
+ G_CALLBACK (gtk_toggle_button_accessible_toggled), NULL);
if (GTK_IS_CHECK_BUTTON (data))
obj->role = ATK_ROLE_CHECK_BOX;
@@ -75,31 +55,45 @@ gail_toggle_button_real_initialize (AtkObject *obj,
}
static void
-gail_toggle_button_toggled_gtk (GtkWidget *widget)
+gtk_toggle_button_accessible_notify_gtk (GObject *obj,
+ GParamSpec *pspec)
{
- AtkObject *accessible;
- GtkToggleButton *toggle_button;
+ GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (obj);
+ AtkObject *atk_obj;
+ gboolean sensitive;
+ gboolean inconsistent;
- toggle_button = GTK_TOGGLE_BUTTON (widget);
+ atk_obj = gtk_widget_get_accessible (GTK_WIDGET (toggle_button));
+ sensitive = gtk_widget_get_sensitive (GTK_WIDGET (toggle_button));
+ inconsistent = gtk_toggle_button_get_inconsistent (toggle_button);
- accessible = gtk_widget_get_accessible (widget);
- atk_object_notify_state_change (accessible, ATK_STATE_CHECKED,
- gtk_toggle_button_get_active (toggle_button));
-}
+ if (strcmp (pspec->name, "inconsistent") == 0)
+ {
+ atk_object_notify_state_change (atk_obj, ATK_STATE_INDETERMINATE, inconsistent);
+ atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, (sensitive && !inconsistent));
+ }
+ else if (strcmp (pspec->name, "sensitive") == 0)
+ {
+ /* Need to override gailwidget behavior of notifying for ENABLED */
+ atk_object_notify_state_change (atk_obj, ATK_STATE_SENSITIVE, sensitive);
+ 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);
+}
static AtkStateSet*
-gail_toggle_button_ref_state_set (AtkObject *accessible)
+gtk_toggle_button_accessible_ref_state_set (AtkObject *accessible)
{
AtkStateSet *state_set;
GtkToggleButton *toggle_button;
GtkWidget *widget;
- state_set = ATK_OBJECT_CLASS (gail_toggle_button_parent_class)->ref_state_set (accessible);
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
-
if (widget == NULL)
- return state_set;
+ return NULL;
+ state_set = ATK_OBJECT_CLASS (gtk_toggle_button_accessible_parent_class)->ref_state_set (accessible);
toggle_button = GTK_TOGGLE_BUTTON (widget);
if (gtk_toggle_button_get_active (toggle_button))
@@ -110,34 +104,24 @@ gail_toggle_button_ref_state_set (AtkObject *accessible)
atk_state_set_remove_state (state_set, ATK_STATE_ENABLED);
atk_state_set_add_state (state_set, ATK_STATE_INDETERMINATE);
}
-
+
return state_set;
}
static void
-gail_toggle_button_real_notify_gtk (GObject *obj,
- GParamSpec *pspec)
+gtk_toggle_button_accessible_class_init (GtkToggleButtonAccessibleClass *klass)
{
- GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (obj);
- AtkObject *atk_obj;
- gboolean sensitive;
- gboolean inconsistent;
+ GailWidgetClass *widget_class;
+ AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
- atk_obj = gtk_widget_get_accessible (GTK_WIDGET (toggle_button));
- sensitive = gtk_widget_get_sensitive (GTK_WIDGET (toggle_button));
- inconsistent = gtk_toggle_button_get_inconsistent (toggle_button);
+ widget_class = (GailWidgetClass*)klass;
+ widget_class->notify_gtk = gtk_toggle_button_accessible_notify_gtk;
- if (strcmp (pspec->name, "inconsistent") == 0)
- {
- atk_object_notify_state_change (atk_obj, ATK_STATE_INDETERMINATE, inconsistent);
- atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, (sensitive && !inconsistent));
- }
- else if (strcmp (pspec->name, "sensitive") == 0)
- {
- /* Need to override gailwidget behavior of notifying for ENABLED */
- atk_object_notify_state_change (atk_obj, ATK_STATE_SENSITIVE, sensitive);
- atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, (sensitive && !inconsistent));
- }
- else
- GAIL_WIDGET_CLASS (gail_toggle_button_parent_class)->notify_gtk (obj, pspec);
+ class->ref_state_set = gtk_toggle_button_accessible_ref_state_set;
+ class->initialize = gtk_toggle_button_accessible_initialize;
+}
+
+static void
+gtk_toggle_button_accessible_init (GtkToggleButtonAccessible *button)
+{
}
diff --git a/gtk/a11y/gtktogglebuttonaccessible.h b/gtk/a11y/gtktogglebuttonaccessible.h
new file mode 100644
index 0000000..0159cfc
--- /dev/null
+++ b/gtk/a11y/gtktogglebuttonaccessible.h
@@ -0,0 +1,51 @@
+/* GAIL - The GNOME Accessibility Implementation Library
+ * Copyright 2001 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#ifndef __GTK_TOGGLE_BUTTON_ACCESSIBLE_H__
+#define __GTK_TOGGLE_BUTTON_ACCESSIBLE_H__
+
+#include "gailbutton.h"
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE (gtk_toggle_button_accessible_get_type ())
+#define GTK_TOGGLE_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE, GtkToggleButtonAccessible))
+#define GTK_TOGGLE_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE, GtkToggleButtonAccessibleClass))
+#define GTK_IS_TOGGLE_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE))
+#define GTK_IS_TOGGLE_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE))
+#define GTK_TOGGLE_BUTTON_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE, GtkToggleButtonAccessibleClass))
+
+typedef struct _GtkToggleButtonAccessible GtkToggleButtonAccessible;
+typedef struct _GtkToggleButtonAccessibleClass GtkToggleButtonAccessibleClass;
+
+struct _GtkToggleButtonAccessible
+{
+ GailButton parent;
+};
+
+struct _GtkToggleButtonAccessibleClass
+{
+ GailButtonClass parent_class;
+};
+
+GType gtk_toggle_button_accessible_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GTK_TOGGLE_BUTTON_ACCESSIBLE_H__ */
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
index 586b735..3b1a0ad 100644
--- a/gtk/gtktogglebutton.c
+++ b/gtk/gtktogglebutton.c
@@ -36,6 +36,7 @@
#include "gtkactivatable.h"
#include "gtkprivate.h"
#include "gtkintl.h"
+#include "a11y/gtktogglebuttonaccessible.h"
/**
@@ -212,6 +213,8 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class)
G_TYPE_NONE, 0);
g_type_class_add_private (class, sizeof (GtkToggleButtonPrivate));
+
+ gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]