sizegroup: Use for loops
For loops to loop over lists look nicer and actually do the right thing with "break" and "continue" statements. So they are vastly preferred to while loops.
This commit is contained in:
@@ -183,14 +183,11 @@ add_group_to_closure (GtkSizeGroup *group,
|
||||
*groups = g_slist_prepend (*groups, group);
|
||||
priv->visited = TRUE;
|
||||
|
||||
tmp_widgets = priv->widgets;
|
||||
while (tmp_widgets)
|
||||
for (tmp_widgets = priv->widgets; tmp_widgets; tmp_widgets = tmp_widgets->next)
|
||||
{
|
||||
GtkWidget *tmp_widget = tmp_widgets->data;
|
||||
|
||||
add_widget_to_closure (tmp_widget, mode, groups, widgets);
|
||||
|
||||
tmp_widgets = tmp_widgets->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,16 +205,13 @@ add_widget_to_closure (GtkWidget *widget,
|
||||
*widgets = g_slist_prepend (*widgets, widget);
|
||||
_gtk_widget_set_sizegroup_visited (widget, TRUE);
|
||||
|
||||
tmp_groups = _gtk_widget_get_sizegroups (widget);
|
||||
while (tmp_groups)
|
||||
for (tmp_groups = _gtk_widget_get_sizegroups (widget); tmp_groups; tmp_groups = tmp_groups->next)
|
||||
{
|
||||
GtkSizeGroup *tmp_group = tmp_groups->data;
|
||||
GtkSizeGroupPrivate *tmp_priv = tmp_group->priv;
|
||||
|
||||
if (tmp_priv->mode == GTK_SIZE_GROUP_BOTH || tmp_priv->mode == mode)
|
||||
add_group_to_closure (tmp_group, mode, groups, widgets);
|
||||
|
||||
tmp_groups = tmp_groups->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,8 +277,7 @@ queue_resize_on_widget (GtkWidget *widget,
|
||||
g_slist_foreach (widgets, (GFunc)mark_widget_unvisited, NULL);
|
||||
g_slist_foreach (groups, (GFunc)mark_group_unvisited, NULL);
|
||||
|
||||
tmp_list = widgets;
|
||||
while (tmp_list)
|
||||
for (tmp_list = widgets; tmp_list; tmp_list = tmp_list->next)
|
||||
{
|
||||
if (tmp_list->data == parent)
|
||||
{
|
||||
@@ -297,8 +290,6 @@ queue_resize_on_widget (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
queue_resize_on_widget (tmp_list->data, FALSE, flags);
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
g_slist_free (widgets);
|
||||
@@ -311,8 +302,7 @@ queue_resize_on_widget (GtkWidget *widget,
|
||||
g_slist_foreach (widgets, (GFunc)mark_widget_unvisited, NULL);
|
||||
g_slist_foreach (groups, (GFunc)mark_group_unvisited, NULL);
|
||||
|
||||
tmp_list = widgets;
|
||||
while (tmp_list)
|
||||
for (tmp_list = widgets; tmp_list; tmp_list = tmp_list->next)
|
||||
{
|
||||
if (tmp_list->data == parent)
|
||||
{
|
||||
@@ -325,8 +315,6 @@ queue_resize_on_widget (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
queue_resize_on_widget (tmp_list->data, FALSE, flags);
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
g_slist_free (widgets);
|
||||
@@ -700,8 +688,7 @@ compute_dimension (GtkWidget *widget,
|
||||
GtkSizeGroup *group = groups->data;
|
||||
GtkSizeGroupPrivate *priv = group->priv;
|
||||
|
||||
tmp_list = widgets;
|
||||
while (tmp_list)
|
||||
for (tmp_list = widgets; tmp_list; tmp_list = tmp_list->next)
|
||||
{
|
||||
GtkWidget *tmp_widget = tmp_list->data;
|
||||
gint min_dimension, nat_dimension;
|
||||
@@ -726,8 +713,6 @@ compute_dimension (GtkWidget *widget,
|
||||
|
||||
min_result = MAX (min_result, min_dimension);
|
||||
nat_result = MAX (nat_result, nat_dimension);
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user