[gtk+] Separate GailUtil and GailMisc



commit 4c76d9fe3160f3dc7da20efb9b229eb87f993643
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jul 8 22:52:03 2011 -0400

    Separate GailUtil and GailMisc
    
    Not sure how these ended up as siamese twins in the same
    source file. Of course, separating them doesn't make them
    any more beautiful.

 gtk/a11y/Makefile.am |    8 ++++--
 gtk/a11y/gail.c      |    4 ++-
 gtk/a11y/gailmisc.c  |   52 +++++++++++++++++++++++++++++++++++++++++++
 gtk/a11y/gailmisc.h  |   51 ++++++++++++++++++++++++++++++++++++++++++
 gtk/a11y/gailutil.c  |   60 ++++++-------------------------------------------
 gtk/a11y/gailutil.h  |   24 +-------------------
 6 files changed, 120 insertions(+), 79 deletions(-)
---
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am
index e9e96e1..de8a6e1 100644
--- a/gtk/a11y/Makefile.am
+++ b/gtk/a11y/Makefile.am
@@ -48,9 +48,10 @@ gail_c_sources =			\
 	gtktogglebuttonaccessible.c	\
 	gtktoplevelaccessible.c		\
 	gtktreeviewaccessible.c		\
-	gailutil.c			\
 	gtkwidgetaccessible.c		\
-	gtkwindowaccessible.c
+	gtkwindowaccessible.c		\
+	gailutil.c			\
+	gailmisc.c
 
 libgailincludedir=$(includedir)/gail-3.0/gail
 
@@ -99,8 +100,9 @@ gail_private_h_sources =		\
 	gtktogglebuttonaccessible.h	\
 	gtktoplevelaccessible.h		\
 	gtktreeviewaccessible.h		\
+	gtkwindowaccessible.h		\
 	gailutil.h			\
-	gtkwindowaccessible.h
+	gailmisc.h
 
 gail_public_h_sources =	\
 	gtkwidgetaccessible.h
diff --git a/gtk/a11y/gail.c b/gtk/a11y/gail.c
index 06d8b5e..2146719 100644
--- a/gtk/a11y/gail.c
+++ b/gtk/a11y/gail.c
@@ -24,6 +24,7 @@
 
 #include <gtk/gtkx.h>
 #include "gailutil.h"
+#include "gailmisc.h"
 
 
 static gboolean gail_focus_watcher      (GSignalInvocationHint *ihint,
@@ -799,5 +800,6 @@ gail_accessibility_module_init (void)
 
   /* Initialize the GailUtility class */
   g_type_class_unref (g_type_class_ref (GAIL_TYPE_UTIL));
-  g_type_class_unref (g_type_class_ref (GAIL_TYPE_MISC));
+
+  atk_misc_instance = g_object_new (GAIL_TYPE_MISC, NULL);
 }
diff --git a/gtk/a11y/gailmisc.c b/gtk/a11y/gailmisc.c
new file mode 100644
index 0000000..9ce021c
--- /dev/null
+++ b/gtk/a11y/gailmisc.c
@@ -0,0 +1,52 @@
+/* GAIL - The GNOME Accessibility Implementation Library
+ * Copyright 2001, 2002, 2003 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 <gtk/gtk.h>
+#include "gailmisc.h"
+
+
+G_DEFINE_TYPE (GailMisc, gail_misc, ATK_TYPE_MISC)
+
+static void
+gail_misc_threads_enter (AtkMisc *misc)
+{
+  GDK_THREADS_ENTER ();
+}
+
+static void
+gail_misc_threads_leave (AtkMisc *misc)
+{
+  GDK_THREADS_LEAVE ();
+}
+
+static void
+gail_misc_class_init (GailMiscClass *klass)
+{
+  AtkMiscClass *misc_class = ATK_MISC_CLASS (klass);
+
+  misc_class->threads_enter = gail_misc_threads_enter;
+  misc_class->threads_leave = gail_misc_threads_leave;
+}
+
+static void
+gail_misc_init (GailMisc *misc)
+{
+}
diff --git a/gtk/a11y/gailmisc.h b/gtk/a11y/gailmisc.h
new file mode 100644
index 0000000..741508b
--- /dev/null
+++ b/gtk/a11y/gailmisc.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 __GAIL_MISC_H__
+#define __GAIL_MISC_H__
+
+#include <atk/atk.h>
+
+G_BEGIN_DECLS
+
+#define GAIL_TYPE_MISC                           (gail_misc_get_type ())
+#define GAIL_MISC(obj)                           (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_MISC, GailMisc))
+#define GAIL_MISC_CLASS(klass)                   (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_MISC, GailMiscClass))
+#define GAIL_IS_MISC(obj)                        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_MISC))
+#define GAIL_IS_MISC_CLASS(klass)                (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_MISC))
+#define GAIL_MISC_GET_CLASS(obj)                 (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_MISC, GailMiscClass))
+
+typedef struct _GailMisc      GailMisc;
+typedef struct _GailMiscClass GailMiscClass;
+
+struct _GailMisc
+{
+  AtkMisc parent;
+};
+
+struct _GailMiscClass
+{
+  AtkMiscClass parent_class;
+};
+
+GType gail_misc_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GAIL_MISC_H__ */
diff --git a/gtk/a11y/gailutil.c b/gtk/a11y/gailutil.c
index 053f148..f529d1a 100644
--- a/gtk/a11y/gailutil.c
+++ b/gtk/a11y/gailutil.c
@@ -40,14 +40,6 @@ static AtkObject*	gail_util_get_root			(void);
 static const gchar *gail_util_get_toolkit_name		(void);
 static const gchar *gail_util_get_toolkit_version      (void);
 
-/* AtkMisc */
-static void		gail_misc_class_init			(GailMiscClass		*klass);
-static void             gail_misc_init                          (GailMisc               *misc);
-
-static void gail_misc_threads_enter (AtkMisc *misc);
-static void gail_misc_threads_leave (AtkMisc *misc);
-
-/* Misc */
 
 static void		_listener_info_destroy			(gpointer		data);
 static guint            add_listener	                        (GSignalEmissionHook    listener,
@@ -100,26 +92,18 @@ G_DEFINE_TYPE (GailUtil, gail_util, ATK_TYPE_UTIL)
 static void	 
 gail_util_class_init (GailUtilClass *klass)
 {
-  AtkUtilClass *atk_class;
-  gpointer data;
-
-  data = g_type_class_peek (ATK_TYPE_UTIL);
-  atk_class = ATK_UTIL_CLASS (data);
-
-  atk_class->add_global_event_listener =
-    gail_util_add_global_event_listener;
-  atk_class->remove_global_event_listener =
-    gail_util_remove_global_event_listener;
-  atk_class->add_key_event_listener =
-    gail_util_add_key_event_listener;
-  atk_class->remove_key_event_listener =
-    gail_util_remove_key_event_listener;
+  AtkUtilClass *atk_class = ATK_UTIL_CLASS (klass);
+
+  atk_class->add_global_event_listener = gail_util_add_global_event_listener;
+  atk_class->remove_global_event_listener = gail_util_remove_global_event_listener;
+  atk_class->add_key_event_listener = gail_util_add_key_event_listener;
+  atk_class->remove_key_event_listener = gail_util_remove_key_event_listener;
   atk_class->get_root = gail_util_get_root;
   atk_class->get_toolkit_name = gail_util_get_toolkit_name;
   atk_class->get_toolkit_version = gail_util_get_toolkit_version;
 
-  listener_list = g_hash_table_new_full(g_int_hash, g_int_equal, NULL, 
-     _listener_info_destroy);
+  listener_list = g_hash_table_new_full (g_int_hash, g_int_equal,
+                                         NULL, _listener_info_destroy);
 }
 
 static void
@@ -607,31 +591,3 @@ configure_event_watcher (GSignalInvocationHint  *hint,
       return FALSE;
     }
 }
-
-G_DEFINE_TYPE (GailMisc, gail_misc, ATK_TYPE_MISC)
-
-static void	 
-gail_misc_class_init (GailMiscClass *klass)
-{
-  AtkMiscClass *miscclass = ATK_MISC_CLASS (klass);
-  miscclass->threads_enter =
-    gail_misc_threads_enter;
-  miscclass->threads_leave =
-    gail_misc_threads_leave;
-  atk_misc_instance = g_object_new (GAIL_TYPE_MISC, NULL);
-}
-
-static void
-gail_misc_init (GailMisc *misc)
-{
-}
-
-static void gail_misc_threads_enter (AtkMisc *misc)
-{
-  GDK_THREADS_ENTER ();
-}
-
-static void gail_misc_threads_leave (AtkMisc *misc)
-{
-  GDK_THREADS_LEAVE ();
-}
diff --git a/gtk/a11y/gailutil.h b/gtk/a11y/gailutil.h
index acc44d1..0e533c2 100644
--- a/gtk/a11y/gailutil.h
+++ b/gtk/a11y/gailutil.h
@@ -40,34 +40,12 @@ struct _GailUtil
   GList *listener_list;
 };
 
-GType gail_util_get_type (void);
-
 struct _GailUtilClass
 {
   AtkUtilClass parent_class;
 };
 
-#define GAIL_TYPE_MISC                           (gail_misc_get_type ())
-#define GAIL_MISC(obj)                           (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_MISC, GailMisc))
-#define GAIL_MISC_CLASS(klass)                   (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_MISC, GailMiscClass))
-#define GAIL_IS_MISC(obj)                        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_MISC))
-#define GAIL_IS_MISC_CLASS(klass)                (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_MISC))
-#define GAIL_MISC_GET_CLASS(obj)                 (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_MISC, GailMiscClass))
-
-typedef struct _GailMisc                  GailMisc;
-typedef struct _GailMiscClass             GailMiscClass;
-  
-struct _GailMisc
-{
-  AtkMisc parent;
-};
-
-GType gail_misc_get_type (void);
-
-struct _GailMiscClass
-{
-  AtkMiscClass parent_class;
-};
+GType gail_util_get_type (void);
 
 G_END_DECLS
 



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