[gtk+] Convert GailArrow to GtkArrowAccessible



commit ab8d94d195ef456c04db7f21e106647941eb338e
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 26 21:28:37 2011 -0400

    Convert GailArrow to GtkArrowAccessible

 gtk/a11y/Makefile.am          |    4 +-
 gtk/a11y/gail.c               |    3 -
 gtk/a11y/gailarrow.c          |  121 -----------------------------------------
 gtk/a11y/gailarrow.h          |   53 ------------------
 gtk/a11y/gtkarrowaccessible.c |   93 +++++++++++++++++++++++++++++++
 gtk/a11y/gtkarrowaccessible.h |   53 ++++++++++++++++++
 gtk/gtkarrow.c                |    4 ++
 7 files changed, 152 insertions(+), 179 deletions(-)
---
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am
index ca2181d..8674a26 100644
--- a/gtk/a11y/Makefile.am
+++ b/gtk/a11y/Makefile.am
@@ -6,7 +6,7 @@ gail_c_sources =			\
 	gail-private-macros.h		\
 	gail.c				\
 	gailadjustment.c		\
-	gailarrow.c			\
+	gtkarrowaccessible.c		\
 	gailbooleancell.c		\
 	gailbox.c			\
 	gailbutton.c			\
@@ -60,7 +60,7 @@ libgailincludedir=$(includedir)/gail-3.0/gail
 
 gail_private_h_sources =		\
 	gailadjustment.h		\
-	gailarrow.h			\
+	gtkarrowaccessible.h		\
 	gailbooleancell.h		\
 	gailbox.h			\
 	gailbutton.h			\
diff --git a/gtk/a11y/gail.c b/gtk/a11y/gail.c
index b9e25f6..31fd181 100644
--- a/gtk/a11y/gail.c
+++ b/gtk/a11y/gail.c
@@ -24,7 +24,6 @@
 
 #include <gtk/gtkx.h>
 #include "gailadjustment.h"
-#include "gailarrow.h"
 #include "gailbooleancell.h"
 #include "gailbox.h"
 #include "gailbutton.h"
@@ -128,7 +127,6 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_PROGRESS_BAR, GailProgressBar, gail_progress_b
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_TREE_VIEW, GailTreeView, gail_tree_view, GTK_TYPE_TREE_VIEW)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_FRAME, GailFrame, gail_frame, GTK_TYPE_FRAME)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_RADIO_BUTTON, GailRadioButton, gail_radio_button, GTK_TYPE_RADIO_BUTTON)
-GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_ARROW, GailArrow, gail_arrow, GTK_TYPE_ARROW)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SEPARATOR, GailSeparator, gail_separator, GTK_TYPE_SEPARATOR)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_BOX, GailBox, gail_box, GTK_TYPE_BOX)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SCROLLED_WINDOW, GailScrolledWindow, gail_scrolled_window, GTK_TYPE_SCROLLED_WINDOW)
@@ -905,7 +903,6 @@ gail_accessibility_module_init (void)
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_PIXBUF, gail_image_cell);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER, gail_renderer_cell);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_RADIO_BUTTON, gail_radio_button);
-  GAIL_WIDGET_SET_FACTORY (GTK_TYPE_ARROW, gail_arrow);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SEPARATOR, gail_separator);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_BOX, gail_box);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCROLLED_WINDOW, gail_scrolled_window);
diff --git a/gtk/a11y/gtkarrowaccessible.c b/gtk/a11y/gtkarrowaccessible.c
new file mode 100644
index 0000000..78f157f
--- /dev/null
+++ b/gtk/a11y/gtkarrowaccessible.c
@@ -0,0 +1,93 @@
+/* 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 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 <gtk/gtk.h>
+#include "gtkarrowaccessible.h"
+
+
+static void atk_image_interface_init (AtkImageIface  *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GtkArrowAccessible, gtk_arrow_accessible, GAIL_TYPE_WIDGET,
+                         G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init))
+
+static void
+gtk_arrow_accessible_initialize (AtkObject *accessible,
+                                 gpointer   data)
+{
+  ATK_OBJECT_CLASS (gtk_arrow_accessible_parent_class)->initialize (accessible, data);
+
+  accessible->role = ATK_ROLE_ICON;
+}
+
+static void
+gtk_arrow_accessible_finalize (GObject *object)
+{
+  GtkArrowAccessible *arrow = GTK_ARROW_ACCESSIBLE (object);
+
+  g_free (arrow->image_description);
+
+  G_OBJECT_CLASS (gtk_arrow_accessible_parent_class)->finalize (object);
+}
+
+static void
+gtk_arrow_accessible_class_init (GtkArrowAccessibleClass *klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
+
+  atk_object_class->initialize = gtk_arrow_accessible_initialize;
+
+  gobject_class->finalize = gtk_arrow_accessible_finalize;
+}
+
+static void
+gtk_arrow_accessible_init (GtkArrowAccessible *arrow)
+{
+  arrow->image_description = NULL;
+}
+
+static const gchar *
+gtk_arrow_accessible_get_image_description (AtkImage *obj)
+{
+  GtkArrowAccessible *arrow = GTK_ARROW_ACCESSIBLE (obj);
+
+  return arrow->image_description;
+}
+
+static gboolean
+gtk_arrow_accessible_set_image_description (AtkImage    *obj,
+                                            const gchar *description)
+{
+  GtkArrowAccessible *arrow = GTK_ARROW_ACCESSIBLE (obj);
+
+  g_free (arrow->image_description);
+  arrow->image_description = g_strdup (description);
+
+  return TRUE;
+
+}
+
+static void
+atk_image_interface_init (AtkImageIface *iface)
+{
+  iface->get_image_description = gtk_arrow_accessible_get_image_description;
+  iface->set_image_description = gtk_arrow_accessible_set_image_description;
+}
diff --git a/gtk/a11y/gtkarrowaccessible.h b/gtk/a11y/gtkarrowaccessible.h
new file mode 100644
index 0000000..ee68c0b
--- /dev/null
+++ b/gtk/a11y/gtkarrowaccessible.h
@@ -0,0 +1,53 @@
+/* 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_ARROW_ACCESSIBLE_H__
+#define __GTK_ARROW_ACCESSIBLE_H__
+
+#include "gailwidget.h"
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_ARROW_ACCESSIBLE                      (gtk_arrow_accessible_get_type ())
+#define GTK_ARROW_ACCESSIBLE(obj)                      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ARROW_ACCESSIBLE, GtkArrowAccessible))
+#define GTK_ARROW_ACCESSIBLE_CLASS(klass)              (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ARROW_ACCESSIBLE, GtkArrowAccessibleClass))
+#define GTK_IS_ARROW_ACCESSIBLE(obj)                   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ARROW_ACCESSIBLE))
+#define GTK_IS_ARROW_ACCESSIBLE_CLASS(klass)           (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ARROW_ACCESSIBLE))
+#define GTK_ARROW_ACCESSIBLE_GET_CLASS(obj)            (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ARROW_ACCESSIBLE, GtkArrowAccessibleClass))
+
+typedef struct _GtkArrowAccessible      GtkArrowAccessible;
+typedef struct _GtkArrowAccessibleClass GtkArrowAccessibleClass;
+
+struct _GtkArrowAccessible
+{
+  GailWidget parent;
+
+  gchar *image_description;
+};
+
+struct _GtkArrowAccessibleClass
+{
+  GailWidgetClass parent_class;
+};
+
+GType gtk_arrow_accessible_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GTK_ARROW_ACCESSIBLE_H__ */
diff --git a/gtk/gtkarrow.c b/gtk/gtkarrow.c
index b8744e7..0df37be 100644
--- a/gtk/gtkarrow.c
+++ b/gtk/gtkarrow.c
@@ -52,6 +52,8 @@
 #include "gtkprivate.h"
 #include "gtkintl.h"
 
+#include "a11y/gtkarrowaccessible.h"
+
 #define MIN_ARROW_SIZE  15
 
 struct _GtkArrowPrivate
@@ -130,6 +132,8 @@ gtk_arrow_class_init (GtkArrowClass *class)
                                                                GTK_PARAM_READABLE));
 
   g_type_class_add_private (class, sizeof (GtkArrowPrivate));
+
+  gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_ARROW_ACCESSIBLE);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]