diff options
author | Benjamin Otte <otte@redhat.com> | 2015-09-18 03:49:09 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2015-10-28 19:44:27 +0100 |
commit | 1f2e21ab9ae8e0e3b109b4785d1c434d422ccef6 (patch) | |
tree | 8e3b12236a5259ed261dd0477a76a73faa31a158 /gtk/gtksizegroup.c | |
parent | 0721d964e462ac399ca888036d009cb3a9ea5256 (diff) | |
download | gtk+-1f2e21ab9ae8e0e3b109b4785d1c434d422ccef6.tar.gz |
sizegroup: Refactor function
Get rid of continues in loop. This allows doing more complex things in
future commits.
Diffstat (limited to 'gtk/gtksizegroup.c')
-rw-r--r-- | gtk/gtksizegroup.c | 53 |
1 files changed, 23 insertions, 30 deletions
diff --git a/gtk/gtksizegroup.c b/gtk/gtksizegroup.c index 091bcc9097..d6276a90f5 100644 --- a/gtk/gtksizegroup.c +++ b/gtk/gtksizegroup.c @@ -239,43 +239,36 @@ queue_resize_on_widget (GtkWidget *widget, while (parent) { - GSList *widget_groups; - GHashTableIter iter; - gpointer current; - if (widget == parent) real_queue_resize (widget); - if (widget == parent && !check_siblings) + if (!check_siblings || _gtk_widget_get_sizegroups (parent) == NULL) { - parent = _gtk_widget_get_parent (parent); - continue; + check_siblings = TRUE; } - - widget_groups = _gtk_widget_get_sizegroups (parent); - if (!widget_groups) - { - parent = _gtk_widget_get_parent (parent); - continue; - } - - g_hash_table_remove_all (widgets); - g_hash_table_remove_all (groups); - add_widget_to_closure (widgets, groups, parent, -1); - - g_hash_table_iter_init (&iter, widgets); - while (g_hash_table_iter_next (&iter, ¤t, NULL)) - { - if (current == parent) - { - /* do nothing */ - } - else if (current == widget) + else + { + GHashTableIter iter; + gpointer current; + + g_hash_table_remove_all (widgets); + g_hash_table_remove_all (groups); + add_widget_to_closure (widgets, groups, parent, -1); + + g_hash_table_iter_init (&iter, widgets); + while (g_hash_table_iter_next (&iter, ¤t, NULL)) { - g_warning ("A container and its child are part of this SizeGroup"); + if (current == parent) + { + /* do nothing */ + } + else if (current == widget) + { + g_warning ("A container and its child are part of this SizeGroup"); + } + else + queue_resize_on_widget (current, FALSE); } - else - queue_resize_on_widget (current, FALSE); } parent = _gtk_widget_get_parent (parent); |