[gtk+] a11y: Refactor function
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] a11y: Refactor function
- Date: Wed, 26 Feb 2014 01:40:45 +0000 (UTC)
commit bcdb4aa2a789303652a8a8cf23e2ccc1978c7374
Author: Benjamin Otte <otte redhat com>
Date: Wed Feb 26 01:47:50 2014 +0100
a11y: Refactor function
Make the intent of the function clear by implementing it that way.
gtk/a11y/gtktreeviewaccessible.c | 34 ++++++++++++++++------------------
1 files changed, 16 insertions(+), 18 deletions(-)
---
diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c
index 80312da..6c579b2 100644
--- a/gtk/a11y/gtktreeviewaccessible.c
+++ b/gtk/a11y/gtktreeviewaccessible.c
@@ -378,38 +378,36 @@ create_cell_accessible (GtkTreeView *treeview,
GtkTreeViewAccessible *accessible,
GtkTreeViewColumn *column)
{
- AtkObject *parent;
- GtkContainerCellAccessible *container = NULL;
GList *renderer_list;
GList *l;
GtkCellAccessible *cell;
renderer_list = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column));
- /* If there is not exactly one renderer in the list,
- * make a container
+ /* If there is exactly one renderer in the list (which is a
+ * common case), shortcut and don't make a container
*/
- if (g_list_length (renderer_list) != 1)
+ if (g_list_length (renderer_list) == 1)
{
- container = gtk_container_cell_accessible_new ();
- _gtk_cell_accessible_initialize (GTK_CELL_ACCESSIBLE (container), GTK_WIDGET (treeview), ATK_OBJECT
(accessible));
-
- parent = ATK_OBJECT (container);
+ cell = create_cell_accessible_for_renderer (renderer_list->data, GTK_WIDGET (treeview), ATK_OBJECT
(accessible));
}
else
- parent = ATK_OBJECT (accessible);
+ {
+ GtkContainerCellAccessible *container;
+
+ container = gtk_container_cell_accessible_new ();
+ _gtk_cell_accessible_initialize (GTK_CELL_ACCESSIBLE (container), GTK_WIDGET (treeview), ATK_OBJECT
(accessible));
- cell = NULL;
+ for (l = renderer_list; l; l = l->next)
+ {
+ cell = create_cell_accessible_for_renderer (l->data, GTK_WIDGET (treeview), ATK_OBJECT
(container));
+ gtk_container_cell_accessible_add_child (container, cell);
+ }
- for (l = renderer_list; l; l = l->next)
- {
- cell = create_cell_accessible_for_renderer (l->data, GTK_WIDGET (treeview), parent);
- if (container)
- gtk_container_cell_accessible_add_child (container, cell);
+ cell = GTK_CELL_ACCESSIBLE (container);
}
+
g_list_free (renderer_list);
- if (container)
- cell = GTK_CELL_ACCESSIBLE (container);
return cell;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]