[actor] Use foreach_with_internals()

ClutterContainer provides a foreach_with_internals() vfunc for
iterating over all of a container's children, be them added using
the Container API or be them internal to the container itself.

We should be using the foreach_with_internals() function instead
of the plain foreach().
This commit is contained in:
Emmanuele Bassi 2009-05-01 12:31:06 +01:00
parent e260296cb5
commit 5d2d8297e2

View File

@ -814,31 +814,30 @@ clutter_actor_real_map (ClutterActor *self)
clutter_actor_queue_redraw (self); clutter_actor_queue_redraw (self);
if (CLUTTER_IS_CONTAINER (self)) if (CLUTTER_IS_CONTAINER (self))
clutter_container_foreach (CLUTTER_CONTAINER (self), clutter_container_foreach_with_internals (CLUTTER_CONTAINER (self),
CLUTTER_CALLBACK (clutter_actor_map), CLUTTER_CALLBACK (clutter_actor_map),
NULL); NULL);
} }
/** /**
* clutter_actor_map: * clutter_actor_map:
* @self: A #ClutterActor * @self: A #ClutterActor
* *
* Sets the #CLUTTER_ACTOR_MAPPED flag on the actor * Sets the #CLUTTER_ACTOR_MAPPED flag on the actor and possibly maps
* and possibly maps and realizes its children * and realizes its children if they are visible. Does nothing if the
* if they are visible. Does nothing if the
* actor is not visible. * actor is not visible.
* *
* Calling this is allowed in only one case: * Calling this is allowed in only one case: you are implementing the
* you are implementing the "map" virtual function * #ClutterActor::map virtual function in an actor and you need to map
* in an actor and you need to map the children of * the children of that actor. It is not necessary to call this
* that actor. It is not necessary to call this * if you implement #ClutterContainer because the default implementation
* if you implement #ClutterContainer because the * will automatically map children of containers.
* default implementation will automatically map
* children of containers.
* *
* When overriding map, it is mandatory to chain up to the parent * When overriding map, it is mandatory to chain up to the parent
* implementation. * implementation.
**/ *
* Since: 1.0
*/
void void
clutter_actor_map (ClutterActor *self) clutter_actor_map (ClutterActor *self)
{ {
@ -859,9 +858,9 @@ clutter_actor_real_unmap (ClutterActor *self)
g_assert (CLUTTER_ACTOR_IS_MAPPED (self)); g_assert (CLUTTER_ACTOR_IS_MAPPED (self));
if (CLUTTER_IS_CONTAINER (self)) if (CLUTTER_IS_CONTAINER (self))
clutter_container_foreach (CLUTTER_CONTAINER (self), clutter_container_foreach_with_internals (CLUTTER_CONTAINER (self),
CLUTTER_CALLBACK (clutter_actor_unmap), CLUTTER_CALLBACK (clutter_actor_unmap),
NULL); NULL);
CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_MAPPED); CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_MAPPED);
/* notify on parent mapped after potentially unmapping /* notify on parent mapped after potentially unmapping
@ -893,17 +892,17 @@ clutter_actor_real_unmap (ClutterActor *self)
* Unsets the #CLUTTER_ACTOR_MAPPED flag on the actor and possibly * Unsets the #CLUTTER_ACTOR_MAPPED flag on the actor and possibly
* unmaps its children if they were mapped. * unmaps its children if they were mapped.
* *
* Calling this is allowed in only one case: * Calling this is allowed in only one case: you are implementing the
* you are implementing the "unmap" virtual function * #ClutterActor::unmap virtual function in an actor and you need to
* in an actor and you need to unmap the children of * unmap the children of that actor. It is not necessary to call this
* that actor. It is not necessary to call this * if you implement #ClutterContainer because the default implementation
* if you implement #ClutterContainer because the * will automatically unmap children of containers.
* default implementation will automatically unmap
* children of containers.
* *
* When overriding unmap, it is mandatory to chain up to the parent * When overriding unmap, it is mandatory to chain up to the parent
* implementation. * implementation.
**/ *
* Since: 1.0
*/
void void
clutter_actor_unmap (ClutterActor *self) clutter_actor_unmap (ClutterActor *self)
{ {
@ -1141,9 +1140,9 @@ clutter_actor_real_unrealize (ClutterActor *self)
g_assert (!CLUTTER_ACTOR_IS_MAPPED (self)); g_assert (!CLUTTER_ACTOR_IS_MAPPED (self));
if (CLUTTER_IS_CONTAINER (self)) if (CLUTTER_IS_CONTAINER (self))
clutter_container_foreach (CLUTTER_CONTAINER (self), clutter_container_foreach_with_internals (CLUTTER_CONTAINER (self),
CLUTTER_CALLBACK (clutter_actor_unrealize_not_hiding), CLUTTER_CALLBACK (clutter_actor_unrealize_not_hiding),
NULL); NULL);
} }
/** /**