[gtk+/drop-gail: 20/24] Move GailFrame to GtkFrameAccessible



commit b643caf71a633c2ee29b2fb628b4e8d1653825cf
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Feb 25 00:05:54 2011 -0500

    Move GailFrame to GtkFrameAccessible

 gtk/Makefile.am           |    1 +
 gtk/gtkframe.c            |   50 +++++++++++++++++++++++++++++++++++++++
 gtk/gtkframeaccessible.h  |   57 +++++++++++++++++++++++++++++++++++++++++++++
 modules/other/gail/gail.c |    6 +++-
 4 files changed, 112 insertions(+), 2 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index b40b81c..cb1b723 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -402,6 +402,7 @@ gtk_private_h_sources =		\
 	gtkfilechooserutils.h	\
 	gtkfilesystem.h		\
 	gtkfilesystemmodel.h	\
+	gtkframeaccessible.h	\
 	gtkiconcache.h		\
 	gtkimageaccessible.h	\
 	gtkimageprivate.h	\
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index 5f201cc..b058c41 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -1013,3 +1013,53 @@ gtk_frame_get_preferred_width_for_height (GtkWidget *widget,
   GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_width, natural_width);
 }
 
+/* --- Accessibility --- */
+
+#include "gtkaccessibility.h"
+#include "gtkframeaccessible.h"
+
+G_DEFINE_TYPE (GtkFrameAccessible, gtk_frame_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE)
+
+static void
+gtk_frame_accessible_initialize (AtkObject *accessible,
+                                 gpointer  data)
+{
+  ATK_OBJECT_CLASS (gtk_frame_accessible_parent_class)->initialize (accessible, data);
+
+  atk_object_set_role (accessible, ATK_ROLE_PANEL);
+}
+
+static const gchar*
+gtk_frame_accessible_get_name (AtkObject *obj)
+{
+  const gchar *name;
+  GtkWidget *widget;
+
+  name = ATK_OBJECT_CLASS (gtk_frame_accessible_parent_class)->get_name (obj);
+  if (name != NULL)
+    return name;
+
+
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+  if (widget == NULL)
+    return NULL;
+
+  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)
+{
+}
+
+GTK_ACCESSIBLE_FACTORY(GTK_TYPE_FRAME_ACCESSIBLE, gtk_frame_accessible)
+
diff --git a/gtk/gtkframeaccessible.h b/gtk/gtkframeaccessible.h
new file mode 100644
index 0000000..2d1b0f6
--- /dev/null
+++ b/gtk/gtkframeaccessible.h
@@ -0,0 +1,57 @@
+/* GTK - The GIMP Toolkit
+ * Copyright 2011 Red Hat, 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.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_FRAME_ACCESSIBLE_H__
+#define __GTK_FRAME_ACCESSIBLE_H__
+
+#include <gtk/gtkcontaineraccessible.h>
+#include <gtk/gtkframe.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_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
+{
+  GtkContainerAccessible parent;
+};
+
+struct _GtkFrameAccessibleClass
+{
+  GtkContainerAccessibleClass parent_class;
+};
+
+
+GType gtk_frame_accessible_get_type (void) G_GNUC_CONST;
+GType gtk_frame_accessible_factory_get_type (void) G_GNUC_CONST;
+
+
+G_END_DECLS
+
+#endif  /* __GTK_FRAME_ACCESSIBLE_H__ */
diff --git a/modules/other/gail/gail.c b/modules/other/gail/gail.c
index 73fac3c..0bb92eb 100644
--- a/modules/other/gail/gail.c
+++ b/modules/other/gail/gail.c
@@ -28,6 +28,7 @@
 #include <gtk/gtkboxaccessible.h>
 #include <gtk/gtkcalendaraccessible.h>
 #include <gtk/gtkcontaineraccessible.h>
+#include <gtk/gtkframeaccessible.h>
 #include <gtk/gtkimageaccessible.h>
 #include <gtk/gtkpanedaccessible.h>
 #include <gtk/gtkprogressbaraccessible.h>
@@ -101,7 +102,6 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_NOTEBOOK, GailNotebook, gail_notebook, GTK_TYP
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_CALENDAR, GailCalendar, gail_calendar, GTK_TYPE_CALENDAR)
 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_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_SCROLLBAR, GailScrollbar, gail_scrollbar, GTK_TYPE_SCROLLBAR)
@@ -911,6 +911,9 @@ gail_accessibility_module_init (void)
   atk_registry_set_factory_type (atk_get_default_registry (),
                                  GTK_TYPE_PANED,
                                  gtk_paned_accessible_factory_get_type ());
+  atk_registry_set_factory_type (atk_get_default_registry (),
+                                 GTK_TYPE_FRAME,
+                                 gtk_frame_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);
@@ -929,7 +932,6 @@ gail_accessibility_module_init (void)
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_NOTEBOOK, gail_notebook);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SPIN_BUTTON, gail_spin_button);
   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);



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