[clutter] Drop some more ClutterContainer.get_children() uses



commit ab429f4f4547863e5afa98ed622d478107dbb783
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sun Dec 18 22:35:45 2011 +0000

    Drop some more ClutterContainer.get_children() uses

 clutter/clutter-layout-manager.c |   11 ++++-------
 clutter/clutter-script-parser.c  |   19 ++++++++-----------
 2 files changed, 12 insertions(+), 18 deletions(-)
---
diff --git a/clutter/clutter-layout-manager.c b/clutter/clutter-layout-manager.c
index 3bb196a..9538b96 100644
--- a/clutter/clutter-layout-manager.c
+++ b/clutter/clutter-layout-manager.c
@@ -156,13 +156,12 @@
  *                             ClutterAllocationFlags  flags)
  * {
  *   MyLayoutManager *self = MY_LAYOUT_MANAGER (manager);
- *   GList *children, *l;
+ *   ClutterActor *child;
  *
- *   children = clutter_container_get_children (container);
- *
- *   for (l = children; l != NULL; l = l-&gt;next)
+ *   for (child = clutter_actor_get_first_child (CLUTTER_ACTOR (container));
+ *        child != NULL;
+ *        child = clutter_actor_get_next_sibling (child))
  *     {
- *       ClutterActor *child = l->data;
  *       ClutterLayoutMeta *meta;
  *       MyLayoutMeta *my_meta;
  *
@@ -223,8 +222,6 @@
  *       /&ast; allocate the child &ast;/
  *       clutter_actor_allocate (child, &child_box, flags);
  *     }
- *
- *   g_list_free (children);
  * }
  *     </programlisting>
  *   </example>
diff --git a/clutter/clutter-script-parser.c b/clutter/clutter-script-parser.c
index 625f204..d3e1206 100644
--- a/clutter/clutter-script-parser.c
+++ b/clutter/clutter-script-parser.c
@@ -1832,20 +1832,19 @@ _clutter_script_check_unresolved (ClutterScript *script,
       ClutterActor *parent;
 
       parent = clutter_actor_get_parent (CLUTTER_ACTOR (oinfo->object));
-      if (parent != NULL && CLUTTER_IS_CONTAINER (parent))
+      if (parent != NULL)
         {
           ClutterContainer *container = CLUTTER_CONTAINER (parent);
-          GList *children, *l;
+          ClutterActor *child;
 
-          children = clutter_container_get_children (container);
-
-          for (l = children; l != NULL; l = l->next)
+          for (child = clutter_actor_get_first_child (parent);
+               child != NULL;
+               child = clutter_actor_get_next_sibling (child))
             {
-              GObject *child = l->data;
               ObjectInfo *child_info;
               const gchar *id_;
 
-              id_ = clutter_get_script_id (child);
+              id_ = clutter_get_script_id (G_OBJECT (child));
               if (id_ == NULL || *id_ == '\0')
                 continue;
 
@@ -1854,14 +1853,12 @@ _clutter_script_check_unresolved (ClutterScript *script,
                 continue;
 
               apply_child_properties (script, container,
-                                      CLUTTER_ACTOR (child),
+                                      child,
                                       child_info);
               apply_layout_properties (script, container,
-                                       CLUTTER_ACTOR (child),
+                                       child,
                                        child_info);
             }
-
-          g_list_free (children);
         }
     }
 



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