[gtk+/a11y] Move GtkSpinnerAccessible to a11y/
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/a11y] Move GtkSpinnerAccessible to a11y/
- Date: Sat, 2 Jul 2011 23:01:47 +0000 (UTC)
commit 2e85aff0b93997ac20d6ef607c3806d933916b49
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jul 2 15:48:55 2011 -0400
Move GtkSpinnerAccessible to a11y/
gtk/a11y/Makefile.am | 2 +
gtk/a11y/gtkspinneraccessible.c | 83 +++++++++++++++++++++++++++++++++++++++
gtk/a11y/gtkspinneraccessible.h | 51 ++++++++++++++++++++++++
gtk/gtkspinner.c | 66 +------------------------------
4 files changed, 138 insertions(+), 64 deletions(-)
---
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am
index 47ec89f..03fd239 100644
--- a/gtk/a11y/Makefile.am
+++ b/gtk/a11y/Makefile.am
@@ -40,6 +40,7 @@ gail_c_sources = \
gtkscrollbaraccessible.c \
gtkscrolledwindowaccessible.c \
gtkspinbuttonaccessible.c \
+ gtkspinneraccessible.c \
gtksubmenuitemaccessible.c \
gtkstatusbaraccessible.c \
gailtextcell.c \
@@ -92,6 +93,7 @@ gail_private_h_sources = \
gtkscrollbaraccessible.h \
gtkscrolledwindowaccessible.h \
gtkspinbuttonaccessible.h \
+ gtkspinneraccessible.h \
gtksubmenuitemaccessible.h \
gtkstatusbaraccessible.h \
gailtextcell.h \
diff --git a/gtk/a11y/gtkspinneraccessible.c b/gtk/a11y/gtkspinneraccessible.c
new file mode 100644
index 0000000..761ab5a
--- /dev/null
+++ b/gtk/a11y/gtkspinneraccessible.c
@@ -0,0 +1,83 @@
+/* GTK - The GIMP Toolkit
+ *
+ * Copyright (C) 2007 John Stowers, Neil Jagdish Patel.
+ * Copyright (C) 2009 Bastien Nocera, David Zeuthen
+ *
+ * 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.
+ *
+ * Code adapted from egg-spinner
+ * by Christian Hergert <christian hergert gmail com>
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include "gtkintl.h"
+#include "gtkspinneraccessible.h"
+
+static void atk_image_interface_init (AtkImageIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GtkSpinnerAccessible, gtk_spinner_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
+ G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init));
+
+static void
+gtk_spinner_accessible_initialize (AtkObject *accessible,
+ gpointer 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"));
+ atk_object_set_role (accessible, ATK_ROLE_ANIMATION);
+}
+
+static void
+gtk_spinner_accessible_class_init (GtkSpinnerAccessibleClass *klass)
+{
+ AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
+
+ atk_class->initialize = gtk_spinner_accessible_initialize;
+}
+
+static void
+gtk_spinner_accessible_init (GtkSpinnerAccessible *self)
+{
+}
+
+static void
+gtk_spinner_accessible_image_get_size (AtkImage *image,
+ gint *width,
+ gint *height)
+{
+ GtkWidget *widget;
+
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));
+ if (widget == NULL)
+ {
+ *width = 0;
+ *height = 0;
+ return;
+ }
+
+ *width = gtk_widget_get_allocated_width (widget);
+ *height = gtk_widget_get_allocated_height (widget);
+}
+
+static void
+atk_image_interface_init (AtkImageIface *iface)
+{
+ iface->get_image_size = gtk_spinner_accessible_image_get_size;
+}
diff --git a/gtk/a11y/gtkspinneraccessible.h b/gtk/a11y/gtkspinneraccessible.h
new file mode 100644
index 0000000..f52cd28
--- /dev/null
+++ b/gtk/a11y/gtkspinneraccessible.h
@@ -0,0 +1,51 @@
+/* GAIL - The GNOME Accessibility Implementation Library
+ * Copyright 2011 Red Hat, 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_SPINNER_ACCESSIBLE_H__
+#define __GTK_SPINNER_ACCESSIBLE_H__
+
+#include "gtkwidgetaccessible.h"
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_SPINNER_ACCESSIBLE (gtk_spinner_accessible_get_type ())
+#define GTK_SPINNER_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SPINNER_ACCESSIBLE, GtkSpinnerAccessible))
+#define GTK_SPINNER_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SPINNER_ACCESSIBLE, GtkSpinnerAccessibleClass))
+#define GTK_IS_SPINNER_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SPINNER_ACCESSIBLE))
+#define GTK_IS_SPINNER_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SPINNER_ACCESSIBLE))
+#define GTK_SPINNER_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SPINNER_ACCESSIBLE, GtkSpinnerAccessibleClass))
+
+typedef struct _GtkSpinnerAccessible GtkSpinnerAccessible;
+typedef struct _GtkSpinnerAccessibleClass GtkSpinnerAccessibleClass;
+
+struct _GtkSpinnerAccessible
+{
+ GtkWidgetAccessible parent;
+};
+
+struct _GtkSpinnerAccessibleClass
+{
+ GtkWidgetAccessibleClass parent_class;
+};
+
+GType gtk_spinner_accessible_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GTK_SPINNER_ACCESSIBLE_H__ */
diff --git a/gtk/gtkspinner.c b/gtk/gtkspinner.c
index 65e125f..c23be13 100644
--- a/gtk/gtkspinner.c
+++ b/gtk/gtkspinner.c
@@ -36,7 +36,7 @@
#include "gtkimage.h"
#include "gtkspinner.h"
#include "gtkstyle.h"
-#include "a11y/gtkwidgetaccessible.h"
+#include "a11y/gtkspinneraccessible.h"
/**
@@ -85,7 +85,6 @@ static void gtk_spinner_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-GType _gtk_spinner_accessible_get_type (void);
G_DEFINE_TYPE (GtkSpinner, gtk_spinner, GTK_TYPE_WIDGET)
@@ -119,7 +118,7 @@ gtk_spinner_class_init (GtkSpinnerClass *klass)
FALSE,
G_PARAM_READWRITE));
- gtk_widget_class_set_accessible_type (widget_class, _gtk_spinner_accessible_get_type ());
+ gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SPINNER_ACCESSIBLE);
}
static void
@@ -240,67 +239,6 @@ gtk_spinner_set_active (GtkSpinner *spinner,
}
}
-/* accessible implementation */
-
-static void
-gtk_spinner_accessible_image_get_size (AtkImage *image,
- gint *width,
- gint *height)
-{
- GtkAllocation allocation;
- GtkWidget *widget;
-
- widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));
- if (widget == NULL)
- {
- *width = *height = 0;
- }
- else
- {
- gtk_widget_get_allocation (widget, &allocation);
- *width = allocation.width;
- *height = allocation.height;
- }
-}
-
-static void
-gtk_spinner_accessible_image_iface_init (AtkImageIface *iface)
-{
- iface->get_image_size = gtk_spinner_accessible_image_get_size;
-}
-
-/* dummy typedef */
-typedef GtkWidgetAccessible GtkSpinnerAccessible;
-typedef GtkWidgetAccessibleClass GtkSpinnerAccessibleClass;
-
-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_set_name (accessible, C_("throbbing progress animation widget", "Spinner"));
- atk_object_set_description (accessible, _("Provides visual indication of progress"));
- atk_object_set_role (accessible, ATK_ROLE_ANIMATION);
-}
-
-static void
-_gtk_spinner_accessible_class_init (GtkSpinnerAccessibleClass *klass)
-{
- AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
-
- atk_class->initialize = gtk_spinner_accessible_initialize;
-}
-
-static void
-_gtk_spinner_accessible_init (GtkSpinnerAccessible *self)
-{
-}
-
/**
* gtk_spinner_new:
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]