[gtk+/a11y] Convert GailFrame to GtkFrameAccessible



commit be97539283c1e9efe861ebe434f6922a4d180f1a
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 26 22:13:15 2011 -0400

    Convert GailFrame to GtkFrameAccessible

 gtk/a11y/Makefile.am          |    4 +-
 gtk/a11y/gail.c               |    3 -
 gtk/a11y/gailframe.c          |   85 -----------------------------------------
 gtk/a11y/gailframe.h          |   51 ------------------------
 gtk/a11y/gtkframeaccessible.c |   67 ++++++++++++++++++++++++++++++++
 gtk/a11y/gtkframeaccessible.h |   51 ++++++++++++++++++++++++
 gtk/gtkframe.c                |    3 +
 7 files changed, 123 insertions(+), 141 deletions(-)
---
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am
index 6031514..a41c16b 100644
--- a/gtk/a11y/Makefile.am
+++ b/gtk/a11y/Makefile.am
@@ -18,7 +18,7 @@ gail_c_sources =			\
 	gailcontainercell.c		\
 	gtkentryaccessible.c		\
 	gailexpander.c			\
-	gailframe.c			\
+	gtkframeaccessible.c		\
 	gailimage.c			\
 	gailimagecell.c			\
 	gtklabelaccessible.c		\
@@ -70,7 +70,7 @@ gail_private_h_sources =		\
 	gtkentryaccessible.h		\
 	gailexpander.h			\
 	gailfactory.h			\
-	gailframe.h			\
+	gtkframeaccessible.h		\
 	gailimage.h			\
 	gailimagecell.h			\
 	gtklabelaccessible.h		\
diff --git a/gtk/a11y/gail.c b/gtk/a11y/gail.c
index ed1b3e8..3160cf2 100644
--- a/gtk/a11y/gail.c
+++ b/gtk/a11y/gail.c
@@ -32,7 +32,6 @@
 #include "gailcontainer.h"
 #include "gailcontainercell.h"
 #include "gailexpander.h"
-#include "gailframe.h"
 #include "gailimage.h"
 #include "gailimagecell.h"
 #include "gaillinkbutton.h"
@@ -121,7 +120,6 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_STATUSBAR, GailStatusbar, gail_statusbar, GTK_
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_NOTEBOOK, GailNotebook, gail_notebook, GTK_TYPE_NOTEBOOK)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_PROGRESS_BAR, GailProgressBar, gail_progress_bar, GTK_TYPE_PROGRESS_BAR)
 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_SCROLLED_WINDOW, GailScrolledWindow, gail_scrolled_window, GTK_TYPE_SCROLLED_WINDOW)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_PANED, GailPaned, gail_paned, GTK_TYPE_PANED)
@@ -890,7 +888,6 @@ gail_accessibility_module_init (void)
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_NOTEBOOK, gail_notebook);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_PROGRESS_BAR, gail_progress_bar);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_TREE_VIEW, gail_tree_view);
-  GAIL_WIDGET_SET_FACTORY (GTK_TYPE_FRAME, gail_frame);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_TEXT, gail_text_cell);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_TOGGLE, gail_boolean_cell);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_PIXBUF, gail_image_cell);
diff --git a/gtk/a11y/gtkframeaccessible.c b/gtk/a11y/gtkframeaccessible.c
new file mode 100644
index 0000000..964ddb9
--- /dev/null
+++ b/gtk/a11y/gtkframeaccessible.c
@@ -0,0 +1,67 @@
+/* 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 <string.h>
+#include <gtk/gtk.h>
+#include "gtkframeaccessible.h"
+
+
+G_DEFINE_TYPE (GtkFrameAccessible, gtk_frame_accessible, GAIL_TYPE_CONTAINER)
+
+static void
+gtk_frame_accessible_initialize (AtkObject *accessible,
+                                 gpointer   data)
+{
+  ATK_OBJECT_CLASS (gtk_frame_accessible_parent_class)->initialize (accessible, data);
+
+  accessible->role = ATK_ROLE_PANEL;
+}
+
+static const gchar *
+gtk_frame_accessible_get_name (AtkObject *obj)
+{
+  const gchar *name;
+  GtkWidget *widget;
+
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+  if (widget == NULL)
+      return NULL;
+
+  name = ATK_OBJECT_CLASS (gtk_frame_accessible_parent_class)->get_name (obj);
+  if (name != NULL)
+    return name;
+
+  return gtk_frame_get_label (GTK_FRAME (widget));
+}
+
+static void
+gtk_frame_accessible_class_init (GtkFrameAccessibleClass *klass)
+{
+  AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+
+  class->initialize = gtk_frame_accessible_initialize;
+  class->get_name = gtk_frame_accessible_get_name;
+}
+
+static void
+gtk_frame_accessible_init (GtkFrameAccessible *frame)
+{
+}
diff --git a/gtk/a11y/gtkframeaccessible.h b/gtk/a11y/gtkframeaccessible.h
new file mode 100644
index 0000000..02e638e
--- /dev/null
+++ b/gtk/a11y/gtkframeaccessible.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_FRAME_ACCESSIBLE_H__
+#define __GTK_FRAME_ACCESSIBLE_H__
+
+#include "gailcontainer.h"
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_FRAME_ACCESSIBLE                      (gtk_frame_accessible_get_type ())
+#define GTK_FRAME_ACCESSIBLE(obj)                      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FRAME_ACCESSIBLE, GtkFrameAccessible))
+#define GTK_FRAME_ACCESSIBLE_CLASS(klass)              (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FRAME_ACCESSIBLE, GtkFrameAccessibleClass))
+#define GTK_IS_FRAME_ACCESSIBLE(obj)                   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FRAME_ACCESSIBLE))
+#define GTK_IS_FRAME_ACCESSIBLE_CLASS(klass)           (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FRAME_ACCESSIBLE))
+#define GTK_FRAME_ACCESSIBLE_GET_CLASS(obj)            (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FRAME_ACCESSIBLE, GtkFrameAccessibleClass))
+
+typedef struct _GtkFrameAccessible      GtkFrameAccessible;
+typedef struct _GtkFrameAccessibleClass GtkFrameAccessibleClass;
+
+struct _GtkFrameAccessible
+{
+  GailContainer parent;
+};
+
+struct _GtkFrameAccessibleClass
+{
+  GailContainerClass parent_class;
+};
+
+GType gtk_frame_accessible_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GTK_FRAME_ACCESSIBLE_H__ */
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index f63de80..07393de 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -33,6 +33,7 @@
 #include "gtkintl.h"
 #include "gtkbuildable.h"
 
+#include "a11y/gtkframeaccessible.h"
 
 /**
  * SECTION:gtkframe
@@ -221,6 +222,8 @@ gtk_frame_class_init (GtkFrameClass *class)
   class->compute_child_allocation = gtk_frame_real_compute_child_allocation;
 
   g_type_class_add_private (class, sizeof (GtkFramePrivate));
+
+  gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_FRAME_ACCESSIBLE);
 }
 
 static void



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