Commit ab8d94d1 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Convert GailArrow to GtkArrowAccessible

parent 5fb86cf7
......@@ -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 \
......
......@@ -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);
......
......@@ -20,102 +20,74 @@
#include "config.h"
#include <gtk/gtk.h>
#include "gailarrow.h"
static void gail_arrow_class_init (GailArrowClass *klass);
static void gail_arrow_init (GailArrow *arrow);
static void gail_arrow_initialize (AtkObject *accessible,
gpointer data);
/* AtkImage */
static void atk_image_interface_init (AtkImageIface *iface);
static const gchar* gail_arrow_get_image_description
(AtkImage *obj);
static gboolean gail_arrow_set_image_description
(AtkImage *obj,
const gchar *description);
static void gail_arrow_finalize (GObject *object);
G_DEFINE_TYPE_WITH_CODE (GailArrow, gail_arrow, GAIL_TYPE_WIDGET,
#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
gail_arrow_class_init (GailArrowClass *klass)
static void
gtk_arrow_accessible_initialize (AtkObject *accessible,
gpointer data)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
atk_object_class->initialize = gail_arrow_initialize;
ATK_OBJECT_CLASS (gtk_arrow_accessible_parent_class)->initialize (accessible, data);
gobject_class->finalize = gail_arrow_finalize;
accessible->role = ATK_ROLE_ICON;
}
static void
gail_arrow_init (GailArrow *arrow)
gtk_arrow_accessible_finalize (GObject *object)
{
arrow->image_description = NULL;
GtkArrowAccessible *arrow = GTK_ARROW_ACCESSIBLE (object);
g_free (arrow->image_description);
G_OBJECT_CLASS (gtk_arrow_accessible_parent_class)->finalize (object);
}
static void
gail_arrow_initialize (AtkObject *accessible,
gpointer data)
gtk_arrow_accessible_class_init (GtkArrowAccessibleClass *klass)
{
ATK_OBJECT_CLASS (gail_arrow_parent_class)->initialize (accessible, data);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
accessible->role = ATK_ROLE_ICON;
atk_object_class->initialize = gtk_arrow_accessible_initialize;
gobject_class->finalize = gtk_arrow_accessible_finalize;
}
static void
atk_image_interface_init (AtkImageIface *iface)
gtk_arrow_accessible_init (GtkArrowAccessible *arrow)
{
iface->get_image_description = gail_arrow_get_image_description;
iface->set_image_description = gail_arrow_set_image_description;
arrow->image_description = NULL;
}
static const gchar*
gail_arrow_get_image_description (AtkImage *obj)
static const gchar *
gtk_arrow_accessible_get_image_description (AtkImage *obj)
{
GailArrow* arrow;
g_return_val_if_fail(GAIL_IS_ARROW(obj), NULL);
arrow = GAIL_ARROW (obj);
GtkArrowAccessible *arrow = GTK_ARROW_ACCESSIBLE (obj);
return arrow->image_description;
}
static gboolean
gail_arrow_set_image_description (AtkImage *obj,
const gchar *description)
static gboolean
gtk_arrow_accessible_set_image_description (AtkImage *obj,
const gchar *description)
{
GailArrow* arrow;
g_return_val_if_fail(GAIL_IS_ARROW(obj), FALSE);
GtkArrowAccessible *arrow = GTK_ARROW_ACCESSIBLE (obj);
arrow = GAIL_ARROW (obj);
g_free (arrow->image_description);
arrow->image_description = g_strdup (description);
return TRUE;
}
/*
* static void
* gail_arrow_get_image_size (AtkImage *obj,
* gint *height,
* gint *width)
*
* We dont implement this function for GailArrow as gtk hardcodes the size
* of the arrow to be 7x5 and it is not possible to query this.
*/
static void
gail_arrow_finalize (GObject *object)
atk_image_interface_init (AtkImageIface *iface)
{
GailArrow *arrow = GAIL_ARROW (object);
g_free (arrow->image_description);
G_OBJECT_CLASS (gail_arrow_parent_class)->finalize (object);
iface->get_image_description = gtk_arrow_accessible_get_image_description;
iface->set_image_description = gtk_arrow_accessible_set_image_description;
}
......@@ -17,37 +17,37 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef __GAIL_ARROW_H__
#define __GAIL_ARROW_H__
#ifndef __GTK_ARROW_ACCESSIBLE_H__
#define __GTK_ARROW_ACCESSIBLE_H__
#include "gailwidget.h"
G_BEGIN_DECLS
#define GAIL_TYPE_ARROW (gail_arrow_get_type ())
#define GAIL_ARROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_ARROW, GailArrow))
#define GAIL_ARROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_ARROW, GailArrowClass))
#define GAIL_IS_ARROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_ARROW))
#define GAIL_IS_ARROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_ARROW))
#define GAIL_ARROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_ARROW, GailArrowClass))
#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 _GailArrow GailArrow;
typedef struct _GailArrowClass GailArrowClass;
typedef struct _GtkArrowAccessible GtkArrowAccessible;
typedef struct _GtkArrowAccessibleClass GtkArrowAccessibleClass;
struct _GailArrow
struct _GtkArrowAccessible
{
GailWidget parent;
gchar* image_description;
gchar *image_description;
};
GType gail_arrow_get_type (void);
struct _GailArrowClass
struct _GtkArrowAccessibleClass
{
GailWidgetClass parent_class;
};
GType gtk_arrow_accessible_get_type (void);
G_END_DECLS
#endif /* __GAIL_ARROW_H__ */
#endif /* __GTK_ARROW_ACCESSIBLE_H__ */
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment