[gtk+/a11y] Convert GailProgressBar to GtkProgressBarAccessible
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/a11y] Convert GailProgressBar to GtkProgressBarAccessible
- Date: Mon, 27 Jun 2011 03:16:56 +0000 (UTC)
commit 3e04e0e321ea27d387ac31e79da36c1cc6336920
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jun 26 23:00:20 2011 -0400
Convert GailProgressBar to GtkProgressBarAccessible
gtk/a11y/Makefile.am | 4 +-
gtk/a11y/gail.c | 3 -
gtk/a11y/gailprogressbar.c | 133 -----------------------------------
gtk/a11y/gailprogressbar.h | 51 -------------
gtk/a11y/gtkprogressbaraccessible.c | 113 +++++++++++++++++++++++++++++
gtk/a11y/gtkprogressbaraccessible.h | 51 +++++++++++++
gtk/gtkprogressbar.c | 4 +
7 files changed, 170 insertions(+), 189 deletions(-)
---
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am
index 630b18c..9f70e2b 100644
--- a/gtk/a11y/Makefile.am
+++ b/gtk/a11y/Makefile.am
@@ -30,7 +30,7 @@ gail_c_sources = \
gailnotebook.c \
gailnotebookpage.c \
gailpaned.c \
- gailprogressbar.c \
+ gtkprogressbaraccessible.c \
gailradiobutton.c \
gailradiomenuitem.c \
gailradiosubmenuitem.c \
@@ -82,7 +82,7 @@ gail_private_h_sources = \
gailnotebook.h \
gailnotebookpage.h \
gailpaned.h \
- gailprogressbar.h \
+ gtkprogressbaraccessible.h \
gailradiobutton.h \
gailradiomenuitem.h \
gailradiosubmenuitem.h \
diff --git a/gtk/a11y/gail.c b/gtk/a11y/gail.c
index dec6ccd..46b7c45 100644
--- a/gtk/a11y/gail.c
+++ b/gtk/a11y/gail.c
@@ -40,7 +40,6 @@
#include "gailmenuitem.h"
#include "gailnotebook.h"
#include "gailpaned.h"
-#include "gailprogressbar.h"
#include "gailradiobutton.h"
#include "gailradiomenuitem.h"
#include "gailrenderercell.h"
@@ -117,7 +116,6 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_RANGE, GailRange, gail_range, GTK_TYPE_RANGE)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SCALE_BUTTON, GailScaleButton, gail_scale_button, GTK_TYPE_SCALE_BUTTON)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_STATUSBAR, GailStatusbar, gail_statusbar, GTK_TYPE_STATUSBAR)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_NOTEBOOK, GailNotebook, gail_notebook, GTK_TYPE_NOTEBOOK)
-GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_PROGRESS_BAR, GailProgressBar, gail_progress_bar, GTK_TYPE_PROGRESS_BAR)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_TREE_VIEW, GailTreeView, gail_tree_view, GTK_TYPE_TREE_VIEW)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_RADIO_BUTTON, GailRadioButton, gail_radio_button, GTK_TYPE_RADIO_BUTTON)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SCROLLED_WINDOW, GailScrolledWindow, gail_scrolled_window, GTK_TYPE_SCROLLED_WINDOW)
@@ -884,7 +882,6 @@ gail_accessibility_module_init (void)
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCALE_BUTTON, gail_scale_button);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_STATUSBAR, gail_statusbar);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_NOTEBOOK, gail_notebook);
- GAIL_WIDGET_SET_FACTORY (GTK_TYPE_PROGRESS_BAR, gail_progress_bar);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_TREE_VIEW, gail_tree_view);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_TEXT, gail_text_cell);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_TOGGLE, gail_boolean_cell);
diff --git a/gtk/a11y/gtkprogressbaraccessible.c b/gtk/a11y/gtkprogressbaraccessible.c
new file mode 100644
index 0000000..a75526a
--- /dev/null
+++ b/gtk/a11y/gtkprogressbaraccessible.c
@@ -0,0 +1,113 @@
+/* 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>
+
+#include "gtkprogressbaraccessible.h"
+#include "gailadjustment.h"
+
+
+static void atk_value_interface_init (AtkValueIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GtkProgressBarAccessible, gtk_progress_bar_accessible, GAIL_TYPE_WIDGET,
+ G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
+
+static void
+gtk_progress_bar_accessible_initialize (AtkObject *obj,
+ gpointer data)
+{
+ ATK_OBJECT_CLASS (gtk_progress_bar_accessible_parent_class)->initialize (obj, data);
+
+ obj->role = ATK_ROLE_PROGRESS_BAR;
+}
+
+static void
+gtk_progress_bar_accessible_notify_gtk (GObject *obj,
+ GParamSpec *pspec)
+{
+ GtkWidget *widget = GTK_WIDGET (obj);
+ AtkObject *accessible;
+
+ accessible = gtk_widget_get_accessible (widget);
+
+ 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);
+}
+static void
+gtk_progress_bar_accessible_class_init (GtkProgressBarAccessibleClass *klass)
+{
+ AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+ GailWidgetClass *widget_class;
+
+ widget_class = (GailWidgetClass*)klass;
+
+ widget_class->notify_gtk = gtk_progress_bar_accessible_notify_gtk;
+
+ class->initialize = gtk_progress_bar_accessible_initialize;
+}
+
+static void
+gtk_progress_bar_accessible_init (GtkProgressBarAccessible *bar)
+{
+}
+
+static void
+gtk_progress_bar_accessible_get_current_value (AtkValue *obj,
+ GValue *value)
+{
+ GtkWidget *widget;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+
+ memset (value, 0, sizeof (GValue));
+ g_value_init (value, G_TYPE_DOUBLE);
+ g_value_set_double (value, gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (widget)));
+}
+
+static void
+gtk_progress_bar_accessible_get_maximum_value (AtkValue *obj,
+ GValue *value)
+{
+ memset (value, 0, sizeof (GValue));
+ g_value_init (value, G_TYPE_DOUBLE);
+ g_value_set_double (value, 1.0);
+}
+
+static void
+gtk_progress_bar_accessible_get_minimum_value (AtkValue *obj,
+ GValue *value)
+{
+ memset (value, 0, sizeof (GValue));
+ g_value_init (value, G_TYPE_DOUBLE);
+ g_value_set_double (value, 0.0);
+}
+
+static void
+atk_value_interface_init (AtkValueIface *iface)
+{
+ iface->get_current_value = gtk_progress_bar_accessible_get_current_value;
+ iface->get_maximum_value = gtk_progress_bar_accessible_get_maximum_value;
+ iface->get_minimum_value = gtk_progress_bar_accessible_get_minimum_value;
+}
diff --git a/gtk/a11y/gtkprogressbaraccessible.h b/gtk/a11y/gtkprogressbaraccessible.h
new file mode 100644
index 0000000..80241b9
--- /dev/null
+++ b/gtk/a11y/gtkprogressbaraccessible.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_PROGRESS_BAR_ACCESSIBLE_H__
+#define __GTK_PROGRESS_BAR_ACCESSIBLE_H__
+
+#include "gailwidget.h"
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_PROGRESS_BAR_ACCESSIBLE (gtk_progress_bar_accessible_get_type ())
+#define GTK_PROGRESS_BAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE, GtkProgressBarAccessible))
+#define GTK_PROGRESS_BAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE, GtkProgressBarAccessibleClass))
+#define GTK_IS_PROGRESS_BAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE))
+#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;
+
+struct _GtkProgressBarAccessible
+{
+ GailWidget parent;
+};
+
+struct _GtkProgressBarAccessibleClass
+{
+ GailWidgetClass parent_class;
+};
+
+GType gtk_progress_bar_accessible_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GTK_PROGRESS_BAR_ACCESSIBLE_H__ */
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index aa1f28d..6d6b067 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -33,6 +33,8 @@
#include "gtkprivate.h"
#include "gtkintl.h"
+#include "a11y/gtkprogressbaraccessible.h"
+
/**
* SECTION:gtkprogressbar
* @Short_description: A widget which indicates progress visually
@@ -284,6 +286,8 @@ gtk_progress_bar_class_init (GtkProgressBarClass *class)
G_PARAM_READWRITE));
g_type_class_add_private (class, sizeof (GtkProgressBarPrivate));
+
+ gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_PROGRESS_BAR_ACCESSIBLE);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]