After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 668669 - Add iterator API for ClutterActor
Add iterator API for ClutterActor
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2012-01-25 15:45 UTC by Emmanuele Bassi (:ebassi)
Modified: 2012-01-27 11:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
actor: Add ClutterActorIter (17.23 KB, patch)
2012-01-25 15:45 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
stage: Use the iterator API instead of the DOM one (4.09 KB, patch)
2012-01-25 15:45 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
actor: Add 'reverse' to the iterator flags (4.12 KB, patch)
2012-01-25 15:55 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
actor: Add ClutterActorIter (17.91 KB, patch)
2012-01-26 17:12 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review
stage: Use the iterator API instead of the DOM one (3.85 KB, patch)
2012-01-26 17:12 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review
box: Use the ActorIter API (2.43 KB, patch)
2012-01-26 17:12 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review

Description Emmanuele Bassi (:ebassi) 2012-01-25 15:45:31 UTC
A proper iterator API saves us a bunch of type checks, and it provides a nice entry point for common operations like iterating over children and ancestors.
Comment 1 Emmanuele Bassi (:ebassi) 2012-01-25 15:45:34 UTC
Created attachment 206097 [details] [review]
actor: Add ClutterActorIter

Iterating over children and ancestors of an actor is a relatively common
operation. Currently, you only have one option: start a for() loop, get
the first child of the actor, and advance to the next sibling for the
list of children; or start a for() loop and advance to the parent of the
actor.

These operations can be easily done through the ClutterActor API, but
they all require going through the public API, and performing multiple
type checks on the arguments.

Along with the DOM API, it would be nice to have an ancillary, utility
API that uses an iterator structure to hold the state, and can be
advanced in a loop.
Comment 2 Emmanuele Bassi (:ebassi) 2012-01-25 15:45:36 UTC
Created attachment 206098 [details] [review]
stage: Use the iterator API instead of the DOM one

Whenever we're iterating over the children of the Stage we can now use
the ClutterActorIter API.
Comment 3 Emmanuele Bassi (:ebassi) 2012-01-25 15:55:46 UTC
Created attachment 206102 [details] [review]
actor: Add 'reverse' to the iterator flags

Iterating from the last child is another common task, and it should be
possible to perform it through the iterator API.
Comment 4 Emmanuele Bassi (:ebassi) 2012-01-26 17:12:30 UTC
Created attachment 206204 [details] [review]
actor: Add ClutterActorIter

Iterating over children and ancestors of an actor is a relatively common
operation. Currently, you only have one option: start a for() loop, get
the first child of the actor, and advance to the next sibling for the
list of children; or start a for() loop and advance to the parent of the
actor.

These operations can be easily done through the ClutterActor API, but
they all require going through the public API, and performing multiple
type checks on the arguments.

Along with the DOM API, it would be nice to have an ancillary, utility
API that uses an iterator structure to hold the state, and can be
advanced in a loop.
Comment 5 Emmanuele Bassi (:ebassi) 2012-01-26 17:12:32 UTC
Created attachment 206205 [details] [review]
stage: Use the iterator API instead of the DOM one

Whenever we're iterating over the children of the Stage we can now use
the ClutterActorIter API.
Comment 6 Emmanuele Bassi (:ebassi) 2012-01-26 17:12:35 UTC
Created attachment 206206 [details] [review]
box: Use the ActorIter API

And remove a useless override of the pick() virtual function while we're
at it.
Comment 7 Emmanuele Bassi (:ebassi) 2012-01-27 11:56:41 UTC
Attachment 206204 [details] pushed as 58ffcfb - actor: Add ClutterActorIter
Attachment 206205 [details] pushed as c6e1491 - stage: Use the iterator API instead of the DOM one
Attachment 206206 [details] pushed as 5c9c5d2 - box: Use the ActorIter API