fixed-layout: Use the Actor iteration API

Forgot to migrate the FixedLayout layout manager like we did for the
other layout managers provided by Clutter.
This commit is contained in:
Emmanuele Bassi 2011-12-18 22:34:51 +00:00
parent 4d75e7a0f4
commit ec6873958b

View File

@ -53,18 +53,19 @@ clutter_fixed_layout_get_preferred_width (ClutterLayoutManager *manager,
gfloat *min_width_p, gfloat *min_width_p,
gfloat *nat_width_p) gfloat *nat_width_p)
{ {
GList *children, *l; ClutterActor *actor, *child;
gdouble min_right; gdouble min_right;
gdouble natural_right; gdouble natural_right;
min_right = 0; min_right = 0;
natural_right = 0; natural_right = 0;
children = clutter_container_get_children (container); actor = CLUTTER_ACTOR (container);
for (l = children; l != NULL; l = l->next) for (child = clutter_actor_get_first_child (actor);
child != NULL;
child = clutter_actor_get_next_sibling (child))
{ {
ClutterActor *child = l->data;
gfloat child_x, child_min, child_natural; gfloat child_x, child_min, child_natural;
child_x = clutter_actor_get_x (child); child_x = clutter_actor_get_x (child);
@ -80,8 +81,6 @@ clutter_fixed_layout_get_preferred_width (ClutterLayoutManager *manager,
natural_right = child_x + child_natural; natural_right = child_x + child_natural;
} }
g_list_free (children);
if (min_width_p) if (min_width_p)
*min_width_p = min_right; *min_width_p = min_right;
@ -96,18 +95,19 @@ clutter_fixed_layout_get_preferred_height (ClutterLayoutManager *manager,
gfloat *min_height_p, gfloat *min_height_p,
gfloat *nat_height_p) gfloat *nat_height_p)
{ {
GList *children, *l; ClutterActor *actor, *child;
gdouble min_bottom; gdouble min_bottom;
gdouble natural_bottom; gdouble natural_bottom;
min_bottom = 0; min_bottom = 0;
natural_bottom = 0; natural_bottom = 0;
children = clutter_container_get_children (container); actor = CLUTTER_ACTOR (container);
for (l = children; l != NULL; l = l->next) for (child = clutter_actor_get_first_child (actor);
child != NULL;
child = clutter_actor_get_next_sibling (child))
{ {
ClutterActor *child = l->data;
gfloat child_y, child_min, child_natural; gfloat child_y, child_min, child_natural;
child_y = clutter_actor_get_y (child); child_y = clutter_actor_get_y (child);
@ -123,8 +123,6 @@ clutter_fixed_layout_get_preferred_height (ClutterLayoutManager *manager,
natural_bottom = child_y + child_natural; natural_bottom = child_y + child_natural;
} }
g_list_free (children);
if (min_height_p) if (min_height_p)
*min_height_p = min_bottom; *min_height_p = min_bottom;
@ -138,18 +136,14 @@ clutter_fixed_layout_allocate (ClutterLayoutManager *manager,
const ClutterActorBox *allocation, const ClutterActorBox *allocation,
ClutterAllocationFlags flags) ClutterAllocationFlags flags)
{ {
GList *children, *l; ClutterActor *child;
children = clutter_container_get_children (container); for (child = clutter_actor_get_first_child (CLUTTER_ACTOR (container));
child != NULL;
for (l = children; l != NULL; l = l->next) child = clutter_actor_get_next_sibling (child))
{ {
ClutterActor *child = l->data;
clutter_actor_allocate_preferred_size (child, flags); clutter_actor_allocate_preferred_size (child, flags);
} }
g_list_free (children);
} }
void void