[gtk+/drop-gail] Move GailCalendar to GtkCalendarAccessible



commit 9b6907e521f51db2fb57dedb0dad793da5c36ca1
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Feb 25 00:53:17 2011 -0500

    Move GailCalendar to GtkCalendarAccessible

 gtk/Makefile.am             |    1 +
 gtk/gtkcalendar.c           |   35 +++++++++++++++++++++++++++
 gtk/gtkcalendaraccessible.h |   55 +++++++++++++++++++++++++++++++++++++++++++
 modules/other/gail/gail.c   |   17 ++++++-------
 4 files changed, 99 insertions(+), 9 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index ca53e82..cfa8829 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -385,6 +385,7 @@ gtk_private_h_sources =		\
 	gtkbindingsprivate.h	\
 	gtkbuilderprivate.h	\
 	gtkbuttonprivate.h	\
+	gtkcalendaraccessible.h	\
 	gtkcellareaboxcontextprivate.h	\
 	gtkcontaineraccessible.h \
 	gtkcssproviderprivate.h	\
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 59bac5e..2ebae21 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -4039,3 +4039,38 @@ gtk_calendar_get_detail_height_rows (GtkCalendar *calendar)
   g_return_val_if_fail (GTK_IS_CALENDAR (calendar), 0);
   return GTK_CALENDAR_GET_PRIVATE (calendar)->detail_height_rows;
 }
+
+
+/* --- Accessibility --- */
+
+#include "gtkaccessibility.h"
+#include "gtkcalendaraccessible.h"
+
+G_DEFINE_TYPE (GtkCalendarAccessible, gtk_calendar_accessible, GTK_TYPE_WIDGET_ACCESSIBLE)
+
+static void
+gtk_calendar_accessible_initialize (AtkObject *accessible,
+                                    gpointer   data)
+{
+  ATK_OBJECT_CLASS (gtk_calendar_accessible_parent_class)->initialize (accessible, data);
+
+  /* FIXME: this is the *only* change to GtkWidgetAccessible
+   * this does not deserve a separate class
+   */
+  atk_object_set_role (accessible, ATK_ROLE_CALENDAR);
+}
+
+static void
+gtk_calendar_accessible_class_init (GtkCalendarAccessibleClass *klass)
+{
+  AtkObjectClass *atkobject_class = ATK_OBJECT_CLASS (klass);
+
+  atkobject_class->initialize = gtk_calendar_accessible_initialize;
+}
+
+static void
+gtk_calendar_accessible_init (GtkCalendarAccessible *accessible)
+{
+}
+
+GTK_ACCESSIBLE_FACTORY(GTK_TYPE_CALENDAR_ACCESSIBLE, gtk_calendar_accessible)
diff --git a/gtk/gtkcalendaraccessible.h b/gtk/gtkcalendaraccessible.h
new file mode 100644
index 0000000..111c3e7
--- /dev/null
+++ b/gtk/gtkcalendaraccessible.h
@@ -0,0 +1,55 @@
+/* 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_CALENDAR_ACCESSIBLE_H__
+#define __GTK_CALENDAR_ACCESSIBLE_H__
+
+#include <gtk/gtkwidgetaccessible.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_CALENDAR_ACCESSIBLE (gtk_calendar_accessible_get_type ())
+#define GTK_CALENDAR_ACCESSIBLE(obj)(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CALENDAR_ACCESSIBLE, GtkCalendarAccessible))
+#define GTK_CALENDAR_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CALENDAR_ACCESSIBLE, GtkCalendarAccessibleClass))
+
+typedef struct _GtkCalendarAccessible GtkCalendarAccessible;
+typedef struct _GtkCalendarAccessibleClass GtkCalendarAccessibleClass;
+
+struct _GtkCalendarAccessible
+{
+  GtkWidgetAccessible parent;
+};
+
+struct _GtkCalendarAccessibleClass
+{
+  GtkWidgetAccessibleClass parent_class;
+};
+
+
+GType gtk_calendar_accessible_get_type (void) G_GNUC_CONST;
+GType gtk_calendar_accessible_factory_get_type (void) G_GNUC_CONST;
+
+
+G_END_DECLS
+
+#endif  /* __GTK_CALENDAR_ACCESSIBLE_H__ */
diff --git a/modules/other/gail/gail.c b/modules/other/gail/gail.c
index e3be7ca..b6a29bc 100644
--- a/modules/other/gail/gail.c
+++ b/modules/other/gail/gail.c
@@ -23,6 +23,11 @@
 #include <stdlib.h>
 
 #include <gtk/gtkx.h>
+#include <gtk/gtkcalendaraccessible.h>
+#include <gtk/gtkcontaineraccessible.h>
+#include <gtk/gtkimageaccessible.h>
+#include <gtk/gtkwidgetaccessible.h>
+
 #include "gail.h"
 #include "gailfactory.h"
 
@@ -856,14 +861,6 @@ gail_set_focus_object (AtkObject *focus_obj,
 extern void gnome_accessibility_module_init     (void);
 extern void gnome_accessibility_module_shutdown (void);
 
-/* This is only temporary until factory registration moves
- * to GTK+ proper
- */
-extern GType gtk_widget_accessible_factory_get_type (void);
-extern GType gtk_container_accessible_factory_get_type (void);
-extern GType gtk_image_accessible_factory_get_type (void);
-extern GType gtk_arrow_accessible_factory_get_type (void);
-
 static int gail_initialized = FALSE;
 
 static void
@@ -898,6 +895,9 @@ gail_accessibility_module_init (void)
   atk_registry_set_factory_type (atk_get_default_registry (),
                                  GTK_TYPE_ARROW,
                                  gtk_arrow_accessible_factory_get_type ());
+  atk_registry_set_factory_type (atk_get_default_registry (),
+                                 GTK_TYPE_CALENDAR,
+                                 gtk_calendar_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);
@@ -914,7 +914,6 @@ gail_accessibility_module_init (void)
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_LABEL, gail_label);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_STATUSBAR, gail_statusbar);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_NOTEBOOK, gail_notebook);
-  GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CALENDAR, gail_calendar);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_PROGRESS_BAR, gail_progress_bar);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SPIN_BUTTON, gail_spin_button);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_TREE_VIEW, gail_tree_view);



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