a11y: Use cell renderer creation funcs unconditionally

Also delete the previous "new" functions and actually set the real cell
renderer here.
This commit is contained in:
Benjamin Otte 2011-12-15 23:08:16 +01:00
parent c5433e852b
commit 8ac579602c
8 changed files with 2 additions and 78 deletions

View File

@ -86,26 +86,3 @@ _gtk_boolean_cell_accessible_init (GtkBooleanCellAccessible *cell)
{
}
AtkObject *
_gtk_boolean_cell_accessible_new (void)
{
GObject *object;
AtkObject *atk_object;
GtkRendererCellAccessible *cell;
GtkBooleanCellAccessible *boolean_cell;
object = g_object_new (GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE, NULL);
atk_object = ATK_OBJECT (object);
atk_object->role = ATK_ROLE_TABLE_CELL;
cell = GTK_RENDERER_CELL_ACCESSIBLE (object);
cell->renderer = gtk_cell_renderer_toggle_new ();
g_object_ref_sink (cell->renderer);
boolean_cell = GTK_BOOLEAN_CELL_ACCESSIBLE (object);
boolean_cell->cell_value = FALSE;
boolean_cell->cell_sensitive = TRUE;
return atk_object;
}

View File

@ -48,7 +48,6 @@ struct _GtkBooleanCellAccessibleClass
};
GType _gtk_boolean_cell_accessible_get_type (void);
AtkObject *_gtk_boolean_cell_accessible_new (void);
G_END_DECLS

View File

@ -60,28 +60,6 @@ _gtk_image_cell_accessible_class_init (GtkImageCellAccessibleClass *klass)
renderer_cell_class->property_list = property_list;
}
AtkObject *
_gtk_image_cell_accessible_new (void)
{
GObject *object;
AtkObject *atk_object;
GtkRendererCellAccessible *cell;
object = g_object_new (GTK_TYPE_IMAGE_CELL_ACCESSIBLE, NULL);
g_return_val_if_fail (object != NULL, NULL);
atk_object = ATK_OBJECT (object);
atk_object->role = ATK_ROLE_TABLE_CELL;
cell = GTK_RENDERER_CELL_ACCESSIBLE (object);
cell->renderer = gtk_cell_renderer_pixbuf_new ();
g_object_ref_sink (cell->renderer);
return atk_object;
}
static void
_gtk_image_cell_accessible_init (GtkImageCellAccessible *image_cell)
{

View File

@ -49,7 +49,6 @@ struct _GtkImageCellAccessibleClass
};
GType _gtk_image_cell_accessible_get_type (void);
AtkObject *_gtk_image_cell_accessible_new (void);
G_END_DECLS

View File

@ -125,6 +125,7 @@ _gtk_renderer_cell_accessible_new (GtkCellRenderer *renderer)
g_return_val_if_fail (GTK_IS_CELL_RENDERER (renderer), NULL);
object = g_object_new (_gtk_cell_renderer_get_accessible_type (renderer),
"renderer", renderer,
NULL);
atk_object_set_role (object, ATK_ROLE_TABLE_CELL);

View File

@ -245,28 +245,6 @@ _gtk_text_cell_accessible_init (GtkTextCellAccessible *text_cell)
text_cell->cell_length = 0;
}
AtkObject *
_gtk_text_cell_accessible_new (void)
{
GObject *object;
AtkObject *atk_object;
GtkRendererCellAccessible *cell;
object = g_object_new (GTK_TYPE_TEXT_CELL_ACCESSIBLE, NULL);
g_return_val_if_fail (object != NULL, NULL);
atk_object = ATK_OBJECT (object);
atk_object->role = ATK_ROLE_TABLE_CELL;
cell = GTK_RENDERER_CELL_ACCESSIBLE(object);
cell->renderer = gtk_cell_renderer_text_new ();
g_object_ref_sink (cell->renderer);
return atk_object;
}
static gchar *
gtk_text_cell_accessible_get_text (AtkText *atk_text,
gint start_pos,

View File

@ -49,7 +49,6 @@ struct _GtkTextCellAccessibleClass
};
GType _gtk_text_cell_accessible_get_type (void);
AtkObject *_gtk_text_cell_accessible_new (void);
G_END_DECLS

View File

@ -455,14 +455,7 @@ gtk_tree_view_accessible_ref_child (AtkObject *obj,
{
renderer = GTK_CELL_RENDERER (l->data);
if (GTK_IS_CELL_RENDERER_TEXT (renderer))
child = _gtk_text_cell_accessible_new ();
else if (GTK_IS_CELL_RENDERER_TOGGLE (renderer))
child = _gtk_boolean_cell_accessible_new ();
else if (GTK_IS_CELL_RENDERER_PIXBUF (renderer))
child = _gtk_image_cell_accessible_new ();
else
child = _gtk_renderer_cell_accessible_new (renderer);
child = _gtk_renderer_cell_accessible_new (renderer);
cell = GTK_CELL_ACCESSIBLE (child);
renderer_cell = GTK_RENDERER_CELL_ACCESSIBLE (child);