[gtk+/drop-gail: 22/24] Move GailRange to GtkRangeAccessible Move GailScrollbar to GtkScrollbarAccessible



commit ce1ee81b7587aaa479a3392c77147a8b41ca6290
Author: Li Yuan <li yuan sun com>
Date:   Thu Mar 3 20:16:18 2011 +0800

    Move GailRange to GtkRangeAccessible
    Move GailScrollbar to GtkScrollbarAccessible

 gtk/Makefile.am              |    3 +
 gtk/gtkrange.c               |  424 ++++++++++++++++++++++++++++++++++++++++++
 gtk/gtkrangeaccessible.h     |   58 ++++++
 gtk/gtkscrollbar.c           |   87 +++++++++
 gtk/gtkscrollbaraccessible.h |   52 +++++
 modules/other/gail/gail.c    |   12 +-
 6 files changed, 632 insertions(+), 4 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index f652c52..7cd1e20 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -384,6 +384,7 @@ gtk_private_h_sources =		\
 	gtkappchooserprivate.h	\
 	gtkappchoosermodule.h	\
 	gtkappchooseronline.h	\
+        gtkarrowaccessible.h    \
 	gtkbindingsprivate.h	\
 	gtkboxaccessible.h	\
 	gtkbuilderprivate.h	\
@@ -426,6 +427,7 @@ gtk_private_h_sources =		\
 	gtkprivate.h		\
 	gtkprogressbaraccessible.h \
 	gtkquery.h		\
+        gtkrangeaccessible.h    \
 	gtkrbtree.h		\
 	gtkrecentchooserdefault.h \
 	gtkrecentchooserprivate.h \
@@ -438,6 +440,7 @@ gtk_private_h_sources =		\
 	gtksettingsprivate.h	\
 	gtkseparatoraccessible.h \
 	gtksizegroup-private.h	\
+        gtkscrollbaraccessible.h \
 	gtksocketprivate.h	\
 	gtkstylecontextprivate.h \
 	gtkstylepropertiesprivate.h \
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 94239e7..4ee6dea 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -4129,3 +4129,427 @@ _gtk_range_set_steppers (GtkRange      *range,
   range->priv->has_stepper_c = has_c;
   range->priv->has_stepper_d = has_d;
 }
+
+/* --- Accessibility --- */
+#include "gtkaccessibility.h"
+#include "gtkrangeaccessible.h"
+#include "gtkadjustmentaccessible.h"
+#include "gtklabel.h"
+
+static void         atk_value_interface_init     (AtkValueIface  *iface);
+static void         atk_action_interface_init    (AtkActionIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GtkRangeAccessible, gtk_range_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
+                         G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
+                         G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
+
+static void
+gtk_range_accessible_value_changed (GtkAdjustment    *adjustment,
+                          gpointer         data)
+{
+  GtkRangeAccessible *range;
+
+  range = GTK_RANGE_ACCESSIBLE (data);
+
+  g_object_notify (G_OBJECT (range), "accessible-value");
+}
+
+static void
+gtk_range_accessible_real_initialize (AtkObject *obj,
+                            gpointer  data)
+{
+  GtkRangeAccessible *range = GTK_RANGE_ACCESSIBLE (obj);
+  GtkAdjustment *adj;
+  GtkRange *gtk_range;
+
+  ATK_OBJECT_CLASS (gtk_range_accessible_parent_class)->initialize (obj, data);
+
+  gtk_range = GTK_RANGE (data);
+  /*
+   * If a GtkAdjustment already exists for the GtkRange,
+   * create the GtkAdjustmentAccessible
+   */
+  adj = gtk_range_get_adjustment (gtk_range);
+  if (adj)
+    {
+      range->adjustment = atk_gobject_accessible_for_object (G_OBJECT (adj));
+      g_signal_connect (adj,
+                        "value-changed",
+                        G_CALLBACK (gtk_range_accessible_value_changed),
+                        range);
+    }
+  else
+    range->adjustment = NULL;
+  range->activate_keybinding=NULL;
+  range->activate_description=NULL;
+  /*
+   * Assumed to GtkScale (either GtkHScale or GtkVScale)
+   */
+  atk_object_set_role (obj, ATK_ROLE_SLIDER);
+}
+
+static void
+gtk_range_accessible_finalize (GObject            *object)
+{
+  GtkRangeAccessible *range = GTK_RANGE_ACCESSIBLE (object);
+
+  if (range->adjustment)
+    {
+      /*
+       * The GtkAdjustment may live on so we need to dicsonnect the
+       * signal handler
+       */
+      if (GTK_ADJUSTMENT_ACCESSIBLE (range->adjustment)->adjustment)
+        {
+          g_signal_handlers_disconnect_by_func (GTK_ADJUSTMENT_ACCESSIBLE (range->adjustment)->adjustment,
+                                                (void *)gtk_range_accessible_value_changed,
+                                                range);
+        }
+      g_object_unref (range->adjustment);
+      range->adjustment = NULL;
+    }
+  range->activate_keybinding=NULL;
+  range->activate_description=NULL;
+  if (range->action_idle_handler)
+   {
+    g_source_remove (range->action_idle_handler);
+    range->action_idle_handler = 0;
+   }
+
+  G_OBJECT_CLASS (gtk_range_accessible_parent_class)->finalize (object);
+}
+
+static void
+gtk_range_accessible_real_notify_gtk (GObject           *obj,
+                            GParamSpec        *pspec)
+{
+  GtkAdjustment *adj;
+  GtkWidget *widget = GTK_WIDGET (obj);
+  GtkRangeAccessible *range = GTK_RANGE_ACCESSIBLE (gtk_widget_get_accessible (widget));
+
+  if (strcmp (pspec->name, "adjustment") == 0)
+    {
+      /*
+       * Get rid of the GtkAdjustmentAccessible for the GtkAdjustment
+       * which was associated with the range.
+       */
+      if (range->adjustment)
+        {
+          g_object_unref (range->adjustment);
+          range->adjustment = NULL;
+        }
+      /*
+       * Create the GtkAdjustmentAccessible when notify for "adjustment" property
+       * is received
+       */
+      adj = gtk_range_get_adjustment (GTK_RANGE (widget));
+      range->adjustment = atk_gobject_accessible_for_object (G_OBJECT (adj));
+      g_signal_connect (adj,
+                        "value-changed",
+                        G_CALLBACK (gtk_range_accessible_value_changed),
+                        range);
+    }
+  else
+    GTK_WIDGET_ACCESSIBLE_CLASS (gtk_range_accessible_parent_class)->notify_gtk (obj, pspec);
+}
+
+static void
+gtk_range_accessible_class_init           (GtkRangeAccessibleClass *klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+  GtkWidgetAccessibleClass *widget_class;
+
+  widget_class = (GtkWidgetAccessibleClass*)klass;
+
+  widget_class->notify_gtk = gtk_range_accessible_real_notify_gtk;
+
+  class->initialize = gtk_range_accessible_real_initialize;
+
+  gobject_class->finalize = gtk_range_accessible_finalize;
+}
+
+static void
+gtk_range_accessible_init (GtkRangeAccessible      *range)
+{
+}
+
+static void
+gtk_range_accessible_get_current_value (AtkValue          *obj,
+                              GValue            *value)
+{
+  GtkRangeAccessible *range;
+
+  range = GTK_RANGE_ACCESSIBLE (obj);
+  if (range->adjustment == NULL)
+    /*
+     * Adjustment has not been specified
+     */
+    return;
+
+  atk_value_get_current_value (ATK_VALUE (range->adjustment), value);
+}
+
+static void
+gtk_range_accessible_get_maximum_value (AtkValue          *obj,
+                              GValue            *value)
+{
+  GtkRangeAccessible *range;
+  GtkRange *gtk_range;
+  GtkAdjustment *gtk_adjustment;
+  gdouble max = 0;
+
+  range = GTK_RANGE_ACCESSIBLE (obj);
+  if (range->adjustment == NULL)
+    /*
+     * Adjustment has not been specified
+     */
+    return;
+
+  atk_value_get_maximum_value (ATK_VALUE (range->adjustment), value);
+
+  gtk_range = GTK_RANGE (gtk_accessible_get_widget (GTK_ACCESSIBLE (range)));
+  g_return_if_fail (gtk_range);
+
+  gtk_adjustment = gtk_range_get_adjustment (gtk_range);
+  max = g_value_get_double (value);
+  max -=  gtk_adjustment_get_page_size (gtk_adjustment);
+
+  if (gtk_range_get_restrict_to_fill_level (gtk_range))
+    max = MIN (max, gtk_range_get_fill_level (gtk_range));
+
+  g_value_set_double (value, max);
+}
+
+static void
+gtk_range_accessible_get_minimum_value (AtkValue          *obj,
+                              GValue            *value)
+{
+  GtkRangeAccessible *range;
+
+  range = GTK_RANGE_ACCESSIBLE (obj);
+  if (range->adjustment == NULL)
+    /*
+     * Adjustment has not been specified
+     */
+    return;
+
+  atk_value_get_minimum_value (ATK_VALUE (range->adjustment), value);
+}
+
+static void
+gtk_range_accessible_get_minimum_increment (AtkValue *obj, GValue *value)
+{
+  GtkRangeAccessible *range;
+
+  range = GTK_RANGE_ACCESSIBLE (obj);
+  if (range->adjustment == NULL)
+    /*
+     * Adjustment has not been specified
+     */
+    return;
+
+  atk_value_get_minimum_increment (ATK_VALUE (range->adjustment), value);
+}
+
+static gboolean  gtk_range_accessible_set_current_value (AtkValue         *obj,
+                                               const GValue     *value)
+{
+  GtkWidget *widget;
+
+  g_return_val_if_fail (GTK_IS_RANGE_ACCESSIBLE (obj), FALSE);
+
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+  if (widget == NULL)
+    return FALSE;
+
+  if (G_VALUE_HOLDS_DOUBLE (value))
+    {
+      GtkRange *range = GTK_RANGE (widget);
+      gdouble new_value;
+
+      new_value = g_value_get_double (value);
+      gtk_range_set_value (range, new_value);
+      return TRUE;
+    }
+  else
+    {
+      return FALSE;
+    }
+}
+
+static void
+atk_value_interface_init (AtkValueIface *iface)
+{
+  iface->get_current_value = gtk_range_accessible_get_current_value;
+  iface->get_maximum_value = gtk_range_accessible_get_maximum_value;
+  iface->get_minimum_value = gtk_range_accessible_get_minimum_value;
+  iface->get_minimum_increment = gtk_range_accessible_get_minimum_increment;
+  iface->set_current_value = gtk_range_accessible_set_current_value;
+}
+
+static gboolean
+idle_do_action (gpointer data)
+{
+  GtkRangeAccessible *range;
+  GtkWidget *widget;
+
+  range = GTK_RANGE_ACCESSIBLE (data);
+  range->action_idle_handler = 0;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (range));
+  if (widget == NULL /* State is defunct */ ||
+     !gtk_widget_get_sensitive (widget) || !gtk_widget_get_visible (widget))
+    return FALSE;
+
+   gtk_widget_activate (widget);
+
+   return FALSE;
+}
+
+static gboolean
+gtk_range_accessible_do_action (AtkAction *action,
+                     gint      i)
+{
+  GtkRangeAccessible *range;
+  GtkWidget *widget;
+  gboolean return_value = TRUE;
+
+  range = GTK_RANGE_ACCESSIBLE (action);
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
+  if (widget == NULL)
+    /*
+     * State is defunct
+     */
+    return FALSE;
+  if (!gtk_widget_get_sensitive (widget) || !gtk_widget_get_visible (widget))
+    return FALSE;
+  if(i==0)
+   {
+    if (range->action_idle_handler)
+      return_value = FALSE;
+    else
+      range->action_idle_handler = gdk_threads_add_idle (idle_do_action, range);
+   }
+  else
+     return_value = FALSE;
+  return return_value;
+}
+
+static gint
+gtk_range_accessible_get_n_actions (AtkAction *action)
+{
+    return 1;
+}
+
+static G_CONST_RETURN gchar*
+gtk_range_accessible_get_description (AtkAction *action,
+                              gint      i)
+{
+  GtkRangeAccessible *range;
+  G_CONST_RETURN gchar *return_value;
+
+  range = GTK_RANGE_ACCESSIBLE (action);
+  if (i==0)
+   return_value = range->activate_description;
+  else
+   return_value = NULL;
+  return return_value;
+}
+
+static G_CONST_RETURN gchar*
+gtk_range_accessible_get_keybinding (AtkAction *action,
+                              gint      i)
+{
+  GtkRangeAccessible *range;
+  gchar *return_value = NULL;
+  range = GTK_RANGE_ACCESSIBLE (action);
+  if(i==0)
+   {
+    GtkWidget *widget;
+    GtkWidget *label;
+    AtkRelationSet *set;
+    AtkRelation *relation;
+    GPtrArray *target;
+    gpointer target_object;
+    guint key_val;
+
+    range = GTK_RANGE_ACCESSIBLE (action);
+    widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (range));
+    if (widget == NULL)
+       return NULL;
+    set = atk_object_ref_relation_set (ATK_OBJECT (action));
+
+    if (!set)
+      return NULL;
+    label = NULL;
+    relation = atk_relation_set_get_relation_by_type (set, ATK_RELATION_LABELLED_BY);
+    if (relation)
+     {
+      target = atk_relation_get_target (relation);
+      target_object = g_ptr_array_index (target, 0);
+      label = gtk_accessible_get_widget (GTK_ACCESSIBLE (target_object));
+     }
+    g_object_unref (set);
+    if (GTK_IS_LABEL (label))
+     {
+      key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label));
+      if (key_val != GDK_KEY_VoidSymbol)
+         return_value = gtk_accelerator_name (key_val, GDK_MOD1_MASK);
+      }
+    g_free (range->activate_keybinding);
+    range->activate_keybinding = return_value;
+   }
+  return return_value;
+}
+
+static G_CONST_RETURN gchar*
+gtk_range_accessible_action_get_name (AtkAction *action,
+                           gint      i)
+{
+  G_CONST_RETURN gchar *return_value;
+
+  if (i==0)
+   return_value = "activate";
+  else
+   return_value = NULL;
+
+  return return_value;
+}
+
+static gboolean
+gtk_range_accessible_set_description (AtkAction      *action,
+                           gint           i,
+                           const gchar    *desc)
+{
+  GtkRangeAccessible *range;
+  gchar **value;
+
+  range = GTK_RANGE_ACCESSIBLE (action);
+
+  if (i==0)
+   value = &range->activate_description;
+  else
+   value = NULL;
+
+  if (value)
+   {
+    g_free (*value);
+    *value = g_strdup (desc);
+    return TRUE;
+   }
+  else
+   return FALSE;
+}
+
+static void
+atk_action_interface_init (AtkActionIface *iface)
+{
+  iface->do_action = gtk_range_accessible_do_action;
+  iface->get_n_actions = gtk_range_accessible_get_n_actions;
+  iface->get_description = gtk_range_accessible_get_description;
+  iface->get_keybinding = gtk_range_accessible_get_keybinding;
+  iface->get_name = gtk_range_accessible_action_get_name;
+  iface->set_description = gtk_range_accessible_set_description;
+}
+
+GTK_ACCESSIBLE_FACTORY(GTK_TYPE_RANGE_ACCESSIBLE, gtk_range_accessible)
diff --git a/gtk/gtkrangeaccessible.h b/gtk/gtkrangeaccessible.h
new file mode 100644
index 0000000..3564187
--- /dev/null
+++ b/gtk/gtkrangeaccessible.h
@@ -0,0 +1,58 @@
+/* GTK - The GIMP Toolkit
+ * Copyright 2011 Oracle Corporation
+ *
+ * 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_RANGE_ACCESSIBLE_H__
+#define __GTK_RANGE_ACCESSIBLE_H__
+
+#include <gtk/gtkwidgetaccessible.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_RANGE_ACCESSIBLE               (gtk_range_accessible_get_type ())
+#define GTK_RANGE_ACCESSIBLE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RANGE_ACCESSIBLE, GtkRangeAccessible))
+#define GTK_RANGE_ACCESSIBLE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RANGE_ACCESSIBLE, GtkRangeAccessibleClass))
+#define GTK_IS_RANGE_ACCESSIBLE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RANGE_ACCESSIBLE))
+#define GTK_IS_RANGE_ACCESSIBLE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RANGE_ACCESSIBLE))
+#define GTK_RANGE_ACCESSIBLE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RANGE_ACCESSIBLE, GtkRangeAccessibleClass))
+
+typedef struct _GtkRangeAccessible      GtkRangeAccessible;
+typedef struct _GtkRangeAccessibleClass	GtkRangeAccessibleClass;
+
+struct _GtkRangeAccessible
+{
+  GtkWidgetAccessible parent;
+
+  AtkObject *adjustment;
+  gchar     *activate_description;
+  gchar     *activate_keybinding;
+  guint     action_idle_handler;
+
+};
+
+GType gtk_range_accessible_get_type (void) G_GNUC_CONST;
+GType gtk_range_accessible_factory_get_type (void) G_GNUC_CONST;
+
+struct _GtkRangeAccessibleClass
+{
+  GtkWidgetAccessibleClass parent_class;
+};
+
+G_END_DECLS
+
+#endif /* __GTK_RANGE_ACCESSIBLE_H__ */
diff --git a/gtk/gtkscrollbar.c b/gtk/gtkscrollbar.c
index 4a852f2..369390d 100644
--- a/gtk/gtkscrollbar.c
+++ b/gtk/gtkscrollbar.c
@@ -169,3 +169,90 @@ gtk_scrollbar_new (GtkOrientation  orientation,
                        "adjustment",  adjustment,
                        NULL);
 }
+
+/* --- Accessibility --- */
+
+#include "gtkaccessibility.h"
+#include "gtkscrollbaraccessible.h"
+#include "gtkcontainer.h"
+#include "gtkscrolledwindow.h"
+
+G_DEFINE_TYPE (GtkScrollbarAccessible, gtk_scrollbar_accessible, GTK_TYPE_RANGE_ACCESSIBLE)
+
+static void
+gtk_scrollbar_accessible_initialize (AtkObject *accessible,
+                                     gpointer  data)
+{
+  ATK_OBJECT_CLASS (gtk_scrollbar_accessible_parent_class)->initialize (accessible, data);
+
+  atk_object_set_role (accessible, ATK_ROLE_SCROLL_BAR);
+}
+
+static gint
+gtk_scrollbar_accessible_get_index_in_parent (AtkObject *accessible)
+{
+  GtkWidget *widget;
+  GtkWidget *parent;
+  GtkScrolledWindow *scrolled_window;
+  gint n_children;
+  GList *children;
+
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
+
+  if (widget == NULL)
+  {
+    /*
+     * State is defunct
+     */
+    return -1;
+  }
+
+  parent = gtk_widget_get_parent (widget);
+  if (!GTK_IS_SCROLLED_WINDOW (parent))
+    return ATK_OBJECT_CLASS (gtk_scrollbar_accessible_parent_class)->get_index_in_parent (accessible);
+
+  scrolled_window = GTK_SCROLLED_WINDOW (parent);
+  children = gtk_container_get_children (GTK_CONTAINER (scrolled_window));
+  n_children = g_list_length (children);
+  g_list_free (children);
+
+  if (GTK_IS_HSCROLLBAR (widget))
+  {
+    if (!gtk_scrolled_window_get_hscrollbar (scrolled_window))
+    {
+      n_children = -1;
+    }
+  }
+  else if (GTK_IS_VSCROLLBAR (widget))
+  {
+    if (!gtk_scrolled_window_get_vscrollbar (scrolled_window))
+    {
+      n_children = -1;
+    }
+    else if (gtk_scrolled_window_get_hscrollbar (scrolled_window))
+    {
+      n_children++;
+    }
+  }
+  else
+  {
+    n_children = -1;
+  }
+  return n_children;
+}
+
+static void
+gtk_scrollbar_accessible_class_init (GtkScrollbarAccessibleClass *klass)
+{
+  AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+
+  class->initialize = gtk_scrollbar_accessible_initialize;
+  class->get_index_in_parent = gtk_scrollbar_accessible_get_index_in_parent;
+}
+
+static void
+gtk_scrollbar_accessible_init (GtkScrollbarAccessible *accessible)
+{
+}
+
+GTK_ACCESSIBLE_FACTORY(GTK_TYPE_SCROLLBAR_ACCESSIBLE, gtk_scrollbar_accessible)
diff --git a/gtk/gtkscrollbaraccessible.h b/gtk/gtkscrollbaraccessible.h
new file mode 100644
index 0000000..b5aede6
--- /dev/null
+++ b/gtk/gtkscrollbaraccessible.h
@@ -0,0 +1,52 @@
+/* GTK - The GIMP Toolkit
+ * Copyright 2010 Oracle Corporation
+ *
+ * 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_SCROLLBAR_ACCESSIBLE_H__
+#define __GTK_SCROLLBAR_ACCESSIBLE_H__
+
+#include <gtk/gtkrangeaccessible.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_SCROLLBAR_ACCESSIBLE            (gtk_scrollbar_accessible_get_type ())
+#define GTK_SCROLLBAR_ACCESSIBLE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SCROLLBAR_ACCESSIBLE, GtkScrollbarAccessible))
+#define GTK_SCROLLBAR_ACCESSIBLE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SCROLLBAR_ACCESSIBLE, GtkScrollbarAccessibleClass))
+#define GTK_IS_SCROLLBAR_ACCESSIBLE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SCROLLBAR_ACCESSIBLE))
+#define GTK_IS_SCROLLBAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SCROLLBAR_ACCESSIBLE))
+#define GTK_SCROLLBAR_ACCESSIBLE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SCROLLBAR_ACCESSIBLE, GtkScrollbarAccessibleClass))
+
+typedef struct _GtkScrollbarAccessible		GtkScrollbarAccessible;
+typedef struct _GtkScrollbarAccessibleClass	GtkScrollbarAccessibleClass;
+
+struct _GtkScrollbarAccessible
+{
+  GtkRangeAccessible parent;
+};
+
+GType gtk_scrollbar_accessible_get_type (void) G_GNUC_CONST;
+GType gtk_scrollbar_accessible_factory_get_type (void) G_GNUC_CONST;
+
+struct _GtkScrollbarAccessibleClass
+{
+  GtkRangeAccessibleClass parent_class;
+};
+
+G_END_DECLS
+
+#endif /* __GTK_SCROLLBAR_ACCESSIBLE_H__ */
diff --git a/modules/other/gail/gail.c b/modules/other/gail/gail.c
index 3278ce0..1652c16 100644
--- a/modules/other/gail/gail.c
+++ b/modules/other/gail/gail.c
@@ -32,6 +32,8 @@
 #include <gtk/gtkimageaccessible.h>
 #include <gtk/gtkpanedaccessible.h>
 #include <gtk/gtkprogressbaraccessible.h>
+#include <gtk/gtkrangeaccessible.h>
+#include <gtk/gtkscrollbaraccessible.h>
 #include <gtk/gtkscrolledwindowaccessible.h>
 #include <gtk/gtkseparatoraccessible.h>
 #include <gtk/gtkwidgetaccessible.h>
@@ -94,7 +96,6 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_ENTRY, GailEntry, gail_entry, GTK_TYPE_ENTRY)
 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)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_WINDOW, GailWindow, gail_window, GTK_TYPE_BIN)
-GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_RANGE, GailRange, gail_range, GTK_TYPE_RANGE)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SCALE, GailScale, gail_scale, GTK_TYPE_SCALE)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SCALE_BUTTON, GailScaleButton, gail_scale_button, GTK_TYPE_SCALE_BUTTON)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_LABEL, GailLabel, gail_label, GTK_TYPE_LABEL)
@@ -104,7 +105,6 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_CALENDAR, GailCalendar, gail_calendar, GTK_TYP
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SPIN_BUTTON, GailSpinButton, gail_spin_button, GTK_TYPE_SPIN_BUTTON)
 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_SCROLLBAR, GailScrollbar, gail_scrollbar, GTK_TYPE_SCROLLBAR)
 GAIL_IMPLEMENT_FACTORY_WITH_FUNC (GAIL_TYPE_CHECK_MENU_ITEM, GailCheckMenuItem, gail_check_menu_item, gail_check_menu_item_new)
 GAIL_IMPLEMENT_FACTORY_WITH_FUNC (GAIL_TYPE_RADIO_MENU_ITEM, GailRadioMenuItem, gail_radio_menu_item, gail_radio_menu_item_new)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_EXPANDER, GailExpander, gail_expander, GTK_TYPE_EXPANDER)
@@ -917,6 +917,12 @@ gail_accessibility_module_init (void)
   atk_registry_set_factory_type (atk_get_default_registry (),
                                  GTK_TYPE_SCROLLED_WINDOW,
                                  gtk_scrolled_window_accessible_factory_get_type ());
+  atk_registry_set_factory_type (atk_get_default_registry (),
+                                 GTK_TYPE_SCROLLBAR,
+                                 gtk_scrollbar_accessible_factory_get_type ());
+  atk_registry_set_factory_type (atk_get_default_registry (),
+                                 GTK_TYPE_RANGE,
+                                 gtk_range_accessible_factory_get_type ());
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_BUTTON, gail_button);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_LINK_BUTTON, gail_link_button);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_MENU_ITEM, gail_menu_item);
@@ -927,7 +933,6 @@ gail_accessibility_module_init (void)
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_MENU_BAR, gail_menu_shell);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_MENU, gail_menu);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_WINDOW, gail_window);
-  GAIL_WIDGET_SET_FACTORY (GTK_TYPE_RANGE, gail_range);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCALE, gail_scale);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCALE_BUTTON, gail_scale_button);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_LABEL, gail_label);
@@ -940,7 +945,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_SCROLLBAR, gail_scrollbar);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CHECK_MENU_ITEM, gail_check_menu_item);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_RADIO_MENU_ITEM, gail_radio_menu_item);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_EXPANDER, gail_expander);



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