Drop use of factories for cell accessibles

This commit is contained in:
Matthias Clasen 2011-07-03 12:40:40 -04:00
parent 5a10e9b0b4
commit b83122dc05
4 changed files with 12 additions and 142 deletions

View File

@ -70,7 +70,6 @@ gail_private_h_sources = \
gailcontainercell.h \
gtkentryaccessible.h \
gtkexpanderaccessible.h \
gailfactory.h \
gtkframeaccessible.h \
gtkimageaccessible.h \
gailimagecell.h \

View File

@ -23,17 +23,9 @@
#include <stdlib.h>
#include <gtk/gtkx.h>
#include "gailbooleancell.h"
#include "gailcell.h"
#include "gailcontainercell.h"
#include "gailimagecell.h"
#include "gailrenderercell.h"
#include "gailtextcell.h"
#include "gailtoplevel.h"
#include "gailutil.h"
#include "gailfactory.h"
#define GNOME_ACCESSIBILITY_ENV "GNOME_ACCESSIBILITY"
static gboolean gail_focus_watcher (GSignalInvocationHint *ihint,
@ -76,11 +68,6 @@ static guint focus_notify_handler = 0;
static guint focus_tracker_id = 0;
static GQuark quark_focus_object = 0;
GAIL_IMPLEMENT_FACTORY_WITH_FUNC_DUMMY (GAIL_TYPE_RENDERER_CELL, GailRendererCell, gail_renderer_cell, GTK_TYPE_CELL_RENDERER, gail_renderer_cell_new)
GAIL_IMPLEMENT_FACTORY_WITH_FUNC_DUMMY (GAIL_TYPE_BOOLEAN_CELL, GailBooleanCell, gail_boolean_cell, GTK_TYPE_CELL_RENDERER_TOGGLE, gail_boolean_cell_new)
GAIL_IMPLEMENT_FACTORY_WITH_FUNC_DUMMY (GAIL_TYPE_IMAGE_CELL, GailImageCell, gail_image_cell, GTK_TYPE_CELL_RENDERER_PIXBUF, gail_image_cell_new)
GAIL_IMPLEMENT_FACTORY_WITH_FUNC_DUMMY (GAIL_TYPE_TEXT_CELL, GailTextCell, gail_text_cell, GTK_TYPE_CELL_RENDERER_TEXT, gail_text_cell_new)
static AtkObject*
gail_get_accessible_for_widget (GtkWidget *widget,
gboolean *transient)
@ -820,11 +807,6 @@ gail_accessibility_module_init (void)
if (a_t_support)
fprintf (stderr, "GTK Accessibility Module initialized\n");
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);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER, gail_renderer_cell);
atk_focus_tracker_init (gail_focus_tracker_init);
focus_tracker_id = atk_add_focus_tracker (gail_focus_tracker);

View File

@ -1,110 +0,0 @@
/* GAIL - The GNOME Accessibility Implementation Library
* Copyright 2002 Sun Microsystems Inc.
* Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
* Copyright (C) 2007 Christian Persch
*
* 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_FACTORY_H__
#define _GAIL_FACTORY_H__
#include <glib-object.h>
#include <atk/atk.h>
#define _GAIL_IMPLEMENT_FACTORY_CREATE_ACCESSIBLE(GAIL_TYPE, TYPE) \
{ \
AtkObject *accessible; \
\
g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (object, TYPE), NULL); \
\
accessible = g_object_new (GAIL_TYPE, NULL); \
atk_object_initialize (accessible, object); \
\
return accessible; \
}
#define _GAIL_IMPLEMENT_FACTORY_BEGIN(GAIL_TYPE, TypeName, type_name) \
\
static GType \
type_name##_factory_get_accessible_type (void) \
{ \
return GAIL_TYPE; \
} \
\
static AtkObject* \
type_name##_factory_create_accessible (GObject *object) \
{
#define _GAIL_IMPLEMENT_FACTORY_END(GAIL_TYPE, TypeName, type_name) \
} \
\
static void \
type_name##_factory_class_init (AtkObjectFactoryClass *klass) \
{ \
klass->create_accessible = type_name ## _factory_create_accessible; \
klass->get_accessible_type = type_name ## _factory_get_accessible_type;\
} \
\
GType \
type_name##_factory_get_type (void) \
{ \
static volatile gsize g_define_type_id__volatile = 0; \
if (g_once_init_enter (&g_define_type_id__volatile)) \
{ \
GType g_define_type_id = \
g_type_register_static_simple (ATK_TYPE_OBJECT_FACTORY, \
g_intern_static_string (#TypeName "Factory"), \
sizeof (AtkObjectFactoryClass), \
(GClassInitFunc) type_name##_factory_class_init, \
sizeof (AtkObjectFactory), \
(GInstanceInitFunc) NULL, \
(GTypeFlags) 0); \
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); \
} \
return g_define_type_id__volatile; \
}
/* Implements a AtkObjectFactory creating accessibles of type
* @GAIL_TYPE for objects of type @TYPE.
*/
#define GAIL_IMPLEMENT_FACTORY(GAIL_TYPE, TypeName, type_name, TYPE) \
_GAIL_IMPLEMENT_FACTORY_BEGIN (GAIL_TYPE, TypeName, type_name) \
_GAIL_IMPLEMENT_FACTORY_CREATE_ACCESSIBLE (GAIL_TYPE, TYPE) \
_GAIL_IMPLEMENT_FACTORY_END (GAIL_TYPE, TypeName, type_name)
/* Implements a AtkObjectFactory creating accessibles of type
* @GAIL_TYPE with creation func @create_accessible.
*/
#define GAIL_IMPLEMENT_FACTORY_WITH_FUNC(GAIL_TYPE, TypeName, type_name, create_accessible) \
_GAIL_IMPLEMENT_FACTORY_BEGIN (GAIL_TYPE, TypeName, type_name) \
{ return create_accessible (GTK_WIDGET (object)); } \
_GAIL_IMPLEMENT_FACTORY_END (GAIL_TYPE, TypeName, type_name)
#define GAIL_IMPLEMENT_FACTORY_WITH_FUNC_DUMMY(GAIL_TYPE, TypeName, type_name, TYPE, create_accessible) \
_GAIL_IMPLEMENT_FACTORY_BEGIN (GAIL_TYPE, TypeName, type_name) \
{ \
g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (object, TYPE), NULL);\
return create_accessible (); \
} \
_GAIL_IMPLEMENT_FACTORY_END (GAIL_TYPE, TypeName, type_name)
#define GAIL_WIDGET_SET_FACTORY(widget_type, type_as_function) \
atk_registry_set_factory_type (atk_get_default_registry (), \
widget_type, \
type_as_function ## _factory_get_type ())
#endif /* _GAIL_FACTORY_H__ */

View File

@ -27,6 +27,7 @@
#include "gtktreeviewaccessible.h"
#include "gailrenderercell.h"
#include "gailbooleancell.h"
#include "gailimagecell.h"
#include "gailcontainercell.h"
#include "gailtextcell.h"
#include "gailcellparent.h"
@ -477,8 +478,6 @@ gtk_tree_view_accessible_ref_child (AtkObject *obj,
GtkTreeViewColumn *tv_col;
GtkTreeSelection *selection;
GtkTreePath *path;
AtkRegistry *default_registry;
AtkObjectFactory *factory;
AtkObject *child;
AtkObject *parent;
GtkTreeViewColumn *expander_tv;
@ -579,11 +578,7 @@ gtk_tree_view_accessible_ref_child (AtkObject *obj,
GtkCellRenderer *fake_renderer;
fake_renderer = g_object_new (GTK_TYPE_CELL_RENDERER_TEXT, NULL);
default_registry = atk_get_default_registry ();
factory = atk_registry_get_factory (default_registry,
G_OBJECT_TYPE (fake_renderer));
child = atk_object_factory_create_accessible (factory,
G_OBJECT (fake_renderer));
child = gail_text_cell_new ();
cell = GAIL_CELL (child);
renderer_cell = GAIL_RENDERER_CELL (child);
renderer_cell->renderer = fake_renderer;
@ -610,13 +605,17 @@ gtk_tree_view_accessible_ref_child (AtkObject *obj,
renderer = GTK_CELL_RENDERER (l->data);
if (GTK_IS_CELL_RENDERER_TEXT (renderer))
g_object_get (G_OBJECT (renderer), "editable", &editable, NULL);
{
g_object_get (G_OBJECT (renderer), "editable", &editable, NULL);
child = gail_text_cell_new ();
}
else if (GTK_IS_CELL_RENDERER_TOGGLE (renderer))
child = gail_boolean_cell_new ();
else if (GTK_IS_CELL_RENDERER_PIXBUF (renderer))
child = gail_image_cell_new ();
else
child = gail_renderer_cell_new ();
default_registry = atk_get_default_registry ();
factory = atk_registry_get_factory (default_registry,
G_OBJECT_TYPE (renderer));
child = atk_object_factory_create_accessible (factory,
G_OBJECT (renderer));
cell = GAIL_CELL (child);
renderer_cell = GAIL_RENDERER_CELL (child);