[gtk+] Convert GailScale to GtkScaleAccessible



commit 5fb86cf7daf3a19df7475b7d2f4c4dc71d58096e
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 26 21:14:08 2011 -0400

    Convert GailScale to GtkScaleAccessible

 gtk/a11y/Makefile.am                           |    4 +-
 gtk/a11y/gail.c                                |    3 -
 gtk/a11y/gailscale.h                           |   54 ------------------------
 gtk/a11y/{gailscale.c => gtkscaleaccessible.c} |   39 ++++++++---------
 gtk/a11y/gtkscaleaccessible.h                  |   52 +++++++++++++++++++++++
 gtk/gtkscale.c                                 |    4 ++
 6 files changed, 76 insertions(+), 80 deletions(-)
---
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am
index daad671..ca2181d 100644
--- a/gtk/a11y/Makefile.am
+++ b/gtk/a11y/Makefile.am
@@ -38,7 +38,7 @@ gail_c_sources =			\
 	gailradiosubmenuitem.c		\
 	gailrange.c			\
 	gailrenderercell.c		\
-	gailscale.c			\
+	gtkscaleaccessible.c		\
 	gailscalebutton.c		\
 	gailscrollbar.c			\
 	gailscrolledwindow.c		\
@@ -93,7 +93,7 @@ gail_private_h_sources =		\
 	gailradiosubmenuitem.h		\
 	gailrange.h			\
 	gailrenderercell.h		\
-	gailscale.h			\
+	gtkscaleaccessible.h		\
 	gailscalebutton.h		\
 	gailscrollbar.h			\
 	gailscrolledwindow.h		\
diff --git a/gtk/a11y/gail.c b/gtk/a11y/gail.c
index 4951541..b9e25f6 100644
--- a/gtk/a11y/gail.c
+++ b/gtk/a11y/gail.c
@@ -49,7 +49,6 @@
 #include "gailradiomenuitem.h"
 #include "gailrenderercell.h"
 #include "gailrange.h"
-#include "gailscale.h"
 #include "gailscalebutton.h"
 #include "gailscrollbar.h"
 #include "gailscrolledwindow.h"
@@ -121,7 +120,6 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_MENU_SHELL, GailMenuShell, gail_menu_shell, GT
 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_STATUSBAR, GailStatusbar, gail_statusbar, GTK_TYPE_STATUSBAR)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_NOTEBOOK, GailNotebook, gail_notebook, GTK_TYPE_NOTEBOOK)
@@ -895,7 +893,6 @@ gail_accessibility_module_init (void)
   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_STATUSBAR, gail_statusbar);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_NOTEBOOK, gail_notebook);
diff --git a/gtk/a11y/gailscale.c b/gtk/a11y/gtkscaleaccessible.c
similarity index 71%
rename from gtk/a11y/gailscale.c
rename to gtk/a11y/gtkscaleaccessible.c
index 1fa656b..7e3de32 100644
--- a/gtk/a11y/gailscale.c
+++ b/gtk/a11y/gtkscaleaccessible.c
@@ -20,39 +20,36 @@
 #include "config.h"
 
 #include <gtk/gtk.h>
-#include "gailscale.h"
+#include "gtkscaleaccessible.h"
 
-static const char * gail_scale_get_description   (AtkObject     *object);
+G_DEFINE_TYPE (GtkScaleAccessible, gtk_scale_accessible, GAIL_TYPE_RANGE)
 
-G_DEFINE_TYPE (GailScale, gail_scale, GAIL_TYPE_RANGE)
-
-static void	 
-gail_scale_class_init (GailScaleClass *klass)
-{
-  AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
-
-  class->get_description = gail_scale_get_description;
-}
-
-static void
-gail_scale_init (GailScale      *scale)
-{
-}
-
-static const char *
-gail_scale_get_description (AtkObject *object)
+static const gchar *
+gtk_scale_accessible_get_description (AtkObject *object)
 {
   GtkWidget *widget;
   PangoLayout *layout;
 
   widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (object));
   if (widget == NULL)
-    /* State is defunct */
     return NULL;
 
   layout = gtk_scale_get_layout (GTK_SCALE (widget));
   if (layout)
     return pango_layout_get_text (layout);
 
-  return ATK_OBJECT_CLASS (gail_scale_parent_class)->get_description (object);
+  return ATK_OBJECT_CLASS (gtk_scale_accessible_parent_class)->get_description (object);
+}
+
+static void
+gtk_scale_accessible_class_init (GtkScaleAccessibleClass *klass)
+{
+  AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+
+  class->get_description = gtk_scale_accessible_get_description;
+}
+
+static void
+gtk_scale_accessible_init (GtkScaleAccessible *scale)
+{
 }
diff --git a/gtk/a11y/gtkscaleaccessible.h b/gtk/a11y/gtkscaleaccessible.h
new file mode 100644
index 0000000..648130b
--- /dev/null
+++ b/gtk/a11y/gtkscaleaccessible.h
@@ -0,0 +1,52 @@
+/* GAIL - The GNOME Accessibility Implementation Library
+ * Copyright 2004 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_SCALE_ACCESSIBLE_H__
+#define __GTK_SCALE_ACCESSIBLE_H__
+
+#include "gailrange.h"
+#include "gailtextutil.h"
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_SCALE_ACCESSIBLE                         (gtk_scale_accessible_get_type ())
+#define GTK_SCALE_ACCESSIBLE(obj)                         (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SCALE_ACCESSIBLE, GtkScaleAccessible))
+#define GTK_SCALE_ACCESSIBLE_CLASS(klass)                       (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SCALE_ACCESSIBLE, GtkScaleAccessibleClass))
+#define GTK_IS_SCALE_ACCESSIBLE(obj)                      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SCALE_ACCESSIBLE))
+#define GTK_IS_SCALE_ACCESSIBLE_CLASS(klass)              (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SCALE_ACCESSIBLE))
+#define GTK_SCALE_ACCESSIBLE_GET_CLASS(obj)             (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SCALE_ACCESSIBLE, GtkScaleAccessibleClass))
+
+typedef struct _GtkScaleAccessible      GtkScaleAccessible;
+typedef struct _GtkScaleAccessibleClass GtkScaleAccessibleClass;
+
+struct _GtkScaleAccessible
+{
+  GailRange parent;
+};
+
+struct _GtkScaleAccessibleClass
+{
+  GailRangeClass parent_class;
+};
+
+GType gtk_scale_accessible_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GTK_SCALE_ACCESSIBLE_H__ */
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index 042722e..979f45f 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -42,6 +42,8 @@
 #include "gtkbuildable.h"
 #include "gtkbuilderprivate.h"
 
+#include "a11y/gtkscaleaccessible.h"
+
 
 /**
  * SECTION:gtkscale
@@ -410,6 +412,8 @@ gtk_scale_class_init (GtkScaleClass *class)
                       GTK_SCROLL_END);
 
   g_type_class_add_private (gobject_class, sizeof (GtkScalePrivate));
+
+  gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SCALE_ACCESSIBLE);
 }
 
 static void



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