actor: Implement remove_all_children using ActorIter
The remove_all_children() method is an ideal candidate for using the ActorIter API; the end result is more compact and easy to follow.
This commit is contained in:
parent
8f6da170bc
commit
d8a51726e1
@ -10466,24 +10466,18 @@ clutter_actor_remove_child (ClutterActor *self,
|
|||||||
void
|
void
|
||||||
clutter_actor_remove_all_children (ClutterActor *self)
|
clutter_actor_remove_all_children (ClutterActor *self)
|
||||||
{
|
{
|
||||||
ClutterActor *iter;
|
ClutterActorIter iter;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||||
|
|
||||||
if (self->priv->n_children == 0)
|
if (self->priv->n_children == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
iter = self->priv->first_child;
|
clutter_actor_iter_init (&iter, self);
|
||||||
while (iter != NULL)
|
while (clutter_actor_iter_next (&iter, NULL))
|
||||||
{
|
clutter_actor_iter_remove (&iter);
|
||||||
ClutterActor *next = iter->priv->next_sibling;
|
|
||||||
|
|
||||||
clutter_actor_remove_child_internal (self, iter,
|
|
||||||
REMOVE_CHILD_DEFAULT_FLAGS);
|
|
||||||
|
|
||||||
iter = next;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* sanity check */
|
||||||
g_assert (self->priv->first_child == NULL);
|
g_assert (self->priv->first_child == NULL);
|
||||||
g_assert (self->priv->last_child == NULL);
|
g_assert (self->priv->last_child == NULL);
|
||||||
g_assert (self->priv->n_children == 0);
|
g_assert (self->priv->n_children == 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user