[clutter] actor: Implement remove_all_children using ActorIter



commit d8a51726e13e98cdce2a57782e33a12e570086d9
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Feb 13 08:59:09 2012 +0000

    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.

 clutter/clutter-actor.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 1920717..946544e 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -10466,24 +10466,18 @@ clutter_actor_remove_child (ClutterActor *self,
 void
 clutter_actor_remove_all_children (ClutterActor *self)
 {
-  ClutterActor *iter;
+  ClutterActorIter iter;
 
   g_return_if_fail (CLUTTER_IS_ACTOR (self));
 
   if (self->priv->n_children == 0)
     return;
 
-  iter = self->priv->first_child;
-  while (iter != NULL)
-    {
-      ClutterActor *next = iter->priv->next_sibling;
-
-      clutter_actor_remove_child_internal (self, iter,
-                                           REMOVE_CHILD_DEFAULT_FLAGS);
-
-      iter = next;
-    }
+  clutter_actor_iter_init (&iter, self);
+  while (clutter_actor_iter_next (&iter, NULL))
+    clutter_actor_iter_remove (&iter);
 
+  /* sanity check */
   g_assert (self->priv->first_child == NULL);
   g_assert (self->priv->last_child == NULL);
   g_assert (self->priv->n_children == 0);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]