diff options
author | Benjamin Otte <otte@redhat.com> | 2014-02-26 01:47:50 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2014-02-26 02:36:08 +0100 |
commit | bcdb4aa2a789303652a8a8cf23e2ccc1978c7374 (patch) | |
tree | d3b4f83b20297285a0e26c375af9f2394e23d842 | |
parent | 5ea4dbf3e06a2d5003b2351eff3607c7a64169ce (diff) | |
download | gtk+-bcdb4aa2a789303652a8a8cf23e2ccc1978c7374.tar.gz |
a11y: Refactor function
Make the intent of the function clear by implementing it that way.
-rw-r--r-- | 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 80312da392..6c579b29fe 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; } |