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.
This commit is contained in:
Matthias Clasen 2011-07-08 22:52:03 -04:00
parent 56fb725a7e
commit 4c76d9fe31
6 changed files with 119 additions and 78 deletions

View File

@ -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

View File

@ -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);
}

52
gtk/a11y/gailmisc.c Normal file
View File

@ -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)
{
}

51
gtk/a11y/gailmisc.h Normal file
View File

@ -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__ */

View File

@ -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;
AtkUtilClass *atk_class = ATK_UTIL_CLASS (klass);
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;
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 ();
}

View File

@ -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