[clutter] actor: Add ClutterActorIter.destroy()
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] actor: Add ClutterActorIter.destroy()
- Date: Thu, 9 Feb 2012 15:52:13 +0000 (UTC)
commit d0e945fb70814ce1f75afef3baebd1b3cd352cb9
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Thu Feb 9 15:49:30 2012 +0000
actor: Add ClutterActorIter.destroy()
Similar to the clutter_actor_iter_remove(), but it'll call destroy()
instead of remove_child().
We can also reimplement the ::destroy default handler using it, and make
it more compact.
clutter/clutter-actor.c | 49 ++++++++++++++++++++++++++++++++++++++++------
clutter/clutter-actor.h | 1 +
2 files changed, 43 insertions(+), 7 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 98a72b0..62b11db 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -4758,15 +4758,10 @@ static void
clutter_actor_real_destroy (ClutterActor *actor)
{
ClutterActorIter iter;
- ClutterActor *child;
clutter_actor_iter_init (&iter, actor);
- while (clutter_actor_iter_next (&iter, &child))
- {
- g_object_ref (child);
- clutter_actor_iter_remove (&iter);
- clutter_actor_destroy (child);
- }
+ while (clutter_actor_iter_next (&iter, NULL))
+ clutter_actor_iter_destroy (&iter);
}
static GObject *
@@ -15739,3 +15734,43 @@ clutter_actor_iter_remove (ClutterActorIter *iter)
ri->age += 1;
}
}
+
+/**
+ * clutter_actor_iter_destroy:
+ * @iter: a #ClutterActorIter
+ *
+ * Safely destroys the #ClutterActor currently pointer to by the iterator
+ * from its parent.
+ *
+ * This function can only be called after clutter_actor_iter_next() or
+ * clutter_actor_iter_prev() returned %TRUE, and cannot be called more
+ * than once for the same actor.
+ *
+ * This function will call clutter_actor_destroy() internally.
+ *
+ * Since: 1.10
+ */
+void
+clutter_actor_iter_destroy (ClutterActorIter *iter)
+{
+ RealActorIter *ri = (RealActorIter *) iter;
+ ClutterActor *cur;
+
+ g_return_if_fail (iter != NULL);
+ g_return_if_fail (ri->root != NULL);
+#ifndef G_DISABLE_ASSERT
+ g_return_if_fail (ri->age == ri->root->priv->age);
+#endif
+ g_return_if_fail (ri->current != NULL);
+
+ cur = ri->current;
+
+ if (cur != NULL)
+ {
+ ri->current = cur->priv->prev_sibling;
+
+ clutter_actor_destroy (cur);
+
+ ri->age += 1;
+ }
+}
diff --git a/clutter/clutter-actor.h b/clutter/clutter-actor.h
index d6504f8..45d110d 100644
--- a/clutter/clutter-actor.h
+++ b/clutter/clutter-actor.h
@@ -521,6 +521,7 @@ gboolean clutter_actor_iter_next
gboolean clutter_actor_iter_prev (ClutterActorIter *iter,
ClutterActor **child);
void clutter_actor_iter_remove (ClutterActorIter *iter);
+void clutter_actor_iter_destroy (ClutterActorIter *iter);
/* Transformations */
gboolean clutter_actor_is_rotated (ClutterActor *self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]