[gtk+/quartz-integration: 457/563] Convert GailScrollbar to GtkScrollbarAccessible



commit c185ed965e5efb259ce422e8450813275c76366e
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 26 22:32:34 2011 -0400

    Convert GailScrollbar to GtkScrollbarAccessible

 gtk/a11y/Makefile.am                               |    4 +-
 gtk/a11y/gail.c                                    |    3 -
 gtk/a11y/gailscrollbar.h                           |   51 --------------------
 .../{gailscrollbar.c => gtkscrollbaraccessible.c}  |   47 +++++++------------
 gtk/a11y/gtkscrollbaraccessible.h                  |   51 ++++++++++++++++++++
 gtk/gtkscrollbar.c                                 |    4 ++
 tests/a11y/appchooser.txt                          |    4 +-
 7 files changed, 76 insertions(+), 88 deletions(-)
---
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am
index a41c16b..630b18c 100644
--- a/gtk/a11y/Makefile.am
+++ b/gtk/a11y/Makefile.am
@@ -38,7 +38,7 @@ gail_c_sources =			\
 	gailrenderercell.c		\
 	gtkscaleaccessible.c		\
 	gailscalebutton.c		\
-	gailscrollbar.c			\
+	gtkscrollbaraccessible.c	\
 	gailscrolledwindow.c		\
 	gtkspinbuttonaccessible.c	\
 	gailsubmenuitem.c		\
@@ -90,7 +90,7 @@ gail_private_h_sources =		\
 	gailrenderercell.h		\
 	gtkscaleaccessible.h		\
 	gailscalebutton.h		\
-	gailscrollbar.h			\
+	gtkscrollbaraccessible.h	\
 	gailscrolledwindow.h		\
 	gtkspinbuttonaccessible.h	\
 	gailsubmenuitem.h		\
diff --git a/gtk/a11y/gail.c b/gtk/a11y/gail.c
index 3160cf2..dec6ccd 100644
--- a/gtk/a11y/gail.c
+++ b/gtk/a11y/gail.c
@@ -46,7 +46,6 @@
 #include "gailrenderercell.h"
 #include "gailrange.h"
 #include "gailscalebutton.h"
-#include "gailscrollbar.h"
 #include "gailscrolledwindow.h"
 #include "gailstatusbar.h"
 #include "gailtextcell.h"
@@ -123,7 +122,6 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_TREE_VIEW, GailTreeView, gail_tree_view, GTK_T
 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)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_PANED, GailPaned, gail_paned, GTK_TYPE_PANED)
-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)
@@ -895,7 +893,6 @@ gail_accessibility_module_init (void)
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_RADIO_BUTTON, gail_radio_button);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCROLLED_WINDOW, gail_scrolled_window);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_PANED, gail_paned);
-  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);
diff --git a/gtk/a11y/gailscrollbar.c b/gtk/a11y/gtkscrollbaraccessible.c
similarity index 63%
rename from gtk/a11y/gailscrollbar.c
rename to gtk/a11y/gtkscrollbaraccessible.c
index 5d93c9a..9193cd4 100644
--- a/gtk/a11y/gailscrollbar.c
+++ b/gtk/a11y/gtkscrollbaraccessible.c
@@ -20,42 +20,27 @@
 #include "config.h"
 
 #include <gtk/gtk.h>
-#include "gailscrollbar.h"
+#include "gtkscrollbaraccessible.h"
 
-static void gail_scrollbar_class_init  (GailScrollbarClass *klass);
-static void gail_scrollbar_init        (GailScrollbar      *accessible);
-static void gail_scrollbar_initialize  (AtkObject           *accessible,
-                                        gpointer             data);
 
-static gint gail_scrollbar_get_index_in_parent (AtkObject *accessible);
-
-G_DEFINE_TYPE (GailScrollbar, gail_scrollbar, GAIL_TYPE_RANGE)
-
-static void	 
-gail_scrollbar_class_init (GailScrollbarClass *klass)
-{
-  AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
-
-  class->initialize = gail_scrollbar_initialize;
-  class->get_index_in_parent = gail_scrollbar_get_index_in_parent;
-}
+G_DEFINE_TYPE (GtkScrollbarAccessible, gtk_scrollbar_accessible, GAIL_TYPE_RANGE)
 
 static void
-gail_scrollbar_init (GailScrollbar      *accessible)
+gtk_scrollbar_accessible_init (GtkScrollbarAccessible *accessible)
 {
 }
 
 static void
-gail_scrollbar_initialize (AtkObject *accessible,
+gtk_scrollbar_accessible_initialize (AtkObject *accessible,
                            gpointer  data)
 {
-  ATK_OBJECT_CLASS (gail_scrollbar_parent_class)->initialize (accessible, data);
+  ATK_OBJECT_CLASS (gtk_scrollbar_accessible_parent_class)->initialize (accessible, data);
 
   accessible->role = ATK_ROLE_SCROLL_BAR;
 }
 
 static gint
-gail_scrollbar_get_index_in_parent (AtkObject *accessible)
+gtk_scrollbar_accessible_get_index_in_parent (AtkObject *accessible)
 {
   GtkWidget *widget;
   GtkWidget *parent;
@@ -64,19 +49,12 @@ gail_scrollbar_get_index_in_parent (AtkObject *accessible)
   gint id;
 
   widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
-
   if (widget == NULL)
-  {
-    /*
-     * State is defunct
-     */
     return -1;
-  }
-  g_return_val_if_fail (GTK_IS_SCROLLBAR (widget), -1);
 
   parent = gtk_widget_get_parent (widget);
   if (!GTK_IS_SCROLLED_WINDOW (parent))
-    return ATK_OBJECT_CLASS (gail_scrollbar_parent_class)->get_index_in_parent (accessible);
+    return ATK_OBJECT_CLASS (gtk_scrollbar_accessible_parent_class)->get_index_in_parent (accessible);
 
   scrolled_window = GTK_SCROLLED_WINDOW (parent);
   id = 0;
@@ -103,4 +81,13 @@ gail_scrollbar_get_index_in_parent (AtkObject *accessible)
     }
 
   return -1;
-} 
+}
+
+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;
+}
diff --git a/gtk/a11y/gtkscrollbaraccessible.h b/gtk/a11y/gtkscrollbaraccessible.h
new file mode 100644
index 0000000..a593652
--- /dev/null
+++ b/gtk/a11y/gtkscrollbaraccessible.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_SCROLLBAR_ACCESSIBLE_H__
+#define __GTK_SCROLLBAR_ACCESSIBLE_H__
+
+#include "gailrange.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
+{
+  GailRange parent;
+};
+
+struct _GtkScrollbarAccessibleClass
+{
+  GailRangeClass parent_class;
+};
+
+GType gtk_scrollbar_accessible_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GTK_SCROLLBAR_ACCESSIBLE_H__ */
diff --git a/gtk/gtkscrollbar.c b/gtk/gtkscrollbar.c
index fd79b99..01825a9 100644
--- a/gtk/gtkscrollbar.c
+++ b/gtk/gtkscrollbar.c
@@ -31,6 +31,8 @@
 #include "gtkintl.h"
 #include "gtkprivate.h"
 
+#include "a11y/gtkscrollbaraccessible.h"
+
 
 /**
  * SECTION:gtkscrollbar
@@ -108,6 +110,8 @@ gtk_scrollbar_class_init (GtkScrollbarClass *class)
                                                                  P_("Display a second forward arrow button on the opposite end of the scrollbar"),
                                                                  FALSE,
                                                                  GTK_PARAM_READABLE));
+
+  gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SCROLLBAR_ACCESSIBLE);
 }
 
 static void
diff --git a/tests/a11y/appchooser.txt b/tests/a11y/appchooser.txt
index 5e2ac92..491b93f 100644
--- a/tests/a11y/appchooser.txt
+++ b/tests/a11y/appchooser.txt
@@ -396,7 +396,7 @@ Click "Show other applications", for more options, or "Find applications online"
                   <AtkAction>
                   action 0 name: activate
                   action 0 description: activate the cell
-            unnamed-GailScrollbar-8
+            unnamed-GtkScrollbarAccessible-8
               "scroll bar"
               parent: unnamed-GailScrolledWindow-4
               index: 1
@@ -412,7 +412,7 @@ Click "Show other applications", for more options, or "Find applications online"
               maximum value: 0.000000
               current value: 0.000000
               minimum increment: 39.800000
-            unnamed-GailScrollbar-9
+            unnamed-GtkScrollbarAccessible-9
               "scroll bar"
               parent: unnamed-GailScrolledWindow-4
               index: 2



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