Remove usage of Actor/Container.get_children()

ClutterBox and ClutterGroup are still using the get_children() method
instead of the child iteration API.
This commit is contained in:
Emmanuele Bassi 2011-12-19 11:53:48 +00:00 committed by Emmanuele Bassi
parent 62535bdc73
commit aa9e2a382c
2 changed files with 19 additions and 14 deletions

View File

@ -125,16 +125,15 @@ clutter_box_real_get_paint_volume (ClutterActor *actor,
ClutterPaintVolume *volume)
{
gboolean retval = FALSE;
GList *children, *l;
ClutterActor *child;
/* if we have a background color, and an allocation, then we need to
* set it as the base of our paint volume
*/
retval = clutter_paint_volume_set_from_allocation (volume, actor);
children = clutter_actor_get_children (actor);
/* bail out early if we don't have any child */
if (children == NULL)
if (clutter_actor_get_n_children (actor) == 0)
return retval;
retval = TRUE;
@ -142,9 +141,10 @@ clutter_box_real_get_paint_volume (ClutterActor *actor,
/* otherwise, union the paint volumes of our children, in case
* any one of them decides to paint outside the parent's allocation
*/
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;
const ClutterPaintVolume *child_volume;
/* This gets the paint volume of the child transformed into the
@ -156,8 +156,6 @@ clutter_box_real_get_paint_volume (ClutterActor *actor,
clutter_paint_volume_union (volume, child_volume);
}
g_list_free (children);
return retval;
}
@ -165,13 +163,16 @@ static void
clutter_box_real_pick (ClutterActor *actor,
const ClutterColor *pick)
{
GList *children;
ClutterActor *child;
CLUTTER_ACTOR_CLASS (clutter_box_parent_class)->pick (actor, pick);
children = clutter_actor_get_children (actor);
g_list_foreach (children, (GFunc) clutter_actor_paint, NULL);
g_list_free (children);
for (child = clutter_actor_get_first_child (actor);
child != NULL;
child = clutter_actor_get_next_sibling (child))
{
clutter_actor_paint (child);
}
}
static void

View File

@ -78,13 +78,17 @@ static void
clutter_group_real_pick (ClutterActor *actor,
const ClutterColor *pick)
{
GList *children = clutter_actor_get_children (actor);
ClutterActor *child;
/* Chain up so we get a bounding box pained (if we are reactive) */
CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor, pick);
g_list_foreach (children, (GFunc) clutter_actor_paint, NULL);
g_list_free (children);
for (child = clutter_actor_get_first_child (actor);
child != NULL;
child = clutter_actor_get_next_sibling (child))
{
clutter_actor_paint (child);
}
}
static void