From 9047f9d2bccc1c008548ef3c734cdd43df5cd33a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Mon, 5 Nov 2007 17:12:11 +0000 Subject: [PATCH] * clutter/clutter-container.[ch]: removed find_child_by_id method from interface (and all implementations of it) since this functionality is now implemented using a global hash. * clutter/clutter-box.c: * clutter/clutter-group.c: --- ChangeLog | 8 ++++++ clutter/clutter-box.c | 35 ----------------------- clutter/clutter-container.c | 23 --------------- clutter/clutter-container.h | 7 ----- clutter/clutter-group.c | 57 ------------------------------------- 5 files changed, 8 insertions(+), 122 deletions(-) diff --git a/ChangeLog b/ChangeLog index fd09dea34..b5f2a6832 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-11-05 Øyvind Kolås + + * clutter/clutter-container.[ch]: removed find_child_by_id method + from interface (and all implementations of it) since this + functionality is now implemented using a global hash. + * clutter/clutter-box.c: + * clutter/clutter-group.c: + 2007-11-01 Emmanuele Bassi * clutter/clutter-script.c: Do not keep ownership of the diff --git a/clutter/clutter-box.c b/clutter/clutter-box.c index ddaa67db2..fd8778e10 100644 --- a/clutter/clutter-box.c +++ b/clutter/clutter-box.c @@ -128,40 +128,6 @@ clutter_box_foreach (ClutterContainer *container, } } -static ClutterActor * -clutter_box_find_child_by_id (ClutterContainer *container, - guint child_id) -{ - ClutterBox *self = CLUTTER_BOX (container); - ClutterActor *actor = NULL; - GList *l; - - if (clutter_actor_get_id (CLUTTER_ACTOR (self)) == child_id) - return CLUTTER_ACTOR (self); - - for (l = self->children; l; l = l->next) - { - ClutterBoxChild *child = l->data; - - if (clutter_actor_get_id (child->actor) == child_id) - { - actor = child->actor; - break; - } - - if (CLUTTER_IS_CONTAINER (child->actor)) - { - ClutterContainer *c = CLUTTER_CONTAINER (child->actor); - - actor = clutter_container_find_child_by_id (c, child_id); - if (actor) - break; - } - } - - return actor; -} - static void clutter_box_raise (ClutterContainer *container, ClutterActor *actor, @@ -307,7 +273,6 @@ clutter_container_iface_init (ClutterContainerIface *iface) iface->add = clutter_box_add; iface->remove = clutter_box_remove; iface->foreach = clutter_box_foreach; - iface->find_child_by_id = clutter_box_find_child_by_id; iface->raise = clutter_box_raise; iface->lower = clutter_box_lower; iface->sort_depth_order = clutter_box_sort_depth_order; diff --git a/clutter/clutter-container.c b/clutter/clutter-container.c index a56cad1f7..a1e9f33ea 100644 --- a/clutter/clutter-container.c +++ b/clutter/clutter-container.c @@ -379,29 +379,6 @@ clutter_container_foreach (ClutterContainer *container, CLUTTER_CONTAINER_GET_IFACE (container)->foreach (container, callback, user_data); } -/** - * clutter_container_find_child_by_id: - * @container: a #ClutterContainer - * @child_id: the unique id of an actor - * - * Finds a child actor of a container by its unique ID. Search recurses - * into any child container. - * - * Return value: The child actor with the requested id, or %NULL if no - * actor with that id was found - * - * Since: 0.6 - */ -ClutterActor * -clutter_container_find_child_by_id (ClutterContainer *container, - guint child_id) -{ - g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL); - - return CLUTTER_CONTAINER_GET_IFACE (container)->find_child_by_id (container, - child_id); -} - /** * clutter_container_raise_child: * @container: a #ClutterContainer diff --git a/clutter/clutter-container.h b/clutter/clutter-container.h index 9934162c0..1fb541bf4 100644 --- a/clutter/clutter-container.h +++ b/clutter/clutter-container.h @@ -46,9 +46,6 @@ typedef struct _ClutterContainerIface ClutterContainerIface; * @add: virtual function for adding an actor to the container * @remove: virtual function for removing an actor from the container * @foreach: virtual function for iterating over the container's children - * @find_child_by_id: virtual function for searching a container children - * using its unique id. Should recurse through its children. This function - * is used when "picking" actors (e.g. by clutter_stage_get_actor_at_pos()) * @raise: virtual function for raising a child * @lower: virtual function for lowering a child * @sort_depth_order: virtual function for sorting the children of a @@ -73,8 +70,6 @@ struct _ClutterContainerIface void (* foreach) (ClutterContainer *container, ClutterCallback callback, gpointer user_data); - ClutterActor *(* find_child_by_id) (ClutterContainer *container, - guint child_id); void (* raise) (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling); @@ -112,8 +107,6 @@ GList * clutter_container_get_children (ClutterContainer *container); void clutter_container_foreach (ClutterContainer *container, ClutterCallback callback, gpointer user_data); -ClutterActor *clutter_container_find_child_by_id (ClutterContainer *container, - guint child_id); ClutterActor *clutter_container_find_child_by_name(ClutterContainer *container, const gchar *child_name); void clutter_container_raise_child (ClutterContainer *container, diff --git a/clutter/clutter-group.c b/clutter/clutter-group.c index 89df11e66..bf17e5e1e 100644 --- a/clutter/clutter-group.c +++ b/clutter/clutter-group.c @@ -285,41 +285,6 @@ clutter_group_real_foreach (ClutterContainer *container, (* callback) (CLUTTER_ACTOR (l->data), user_data); } -static ClutterActor * -clutter_group_real_find_child_by_id (ClutterContainer *container, - guint child_id) -{ - ClutterGroup *self = CLUTTER_GROUP (container); - ClutterGroupPrivate *priv = self->priv; - ClutterActor *actor = NULL; - GList *l; - - if (clutter_actor_get_id (CLUTTER_ACTOR (self)) == child_id) - return CLUTTER_ACTOR (self); - - for (l = priv->children; l; l = l->next) - { - ClutterActor *child = l->data; - - if (clutter_actor_get_id (child) == child_id) - { - actor = child; - break; - } - - if (CLUTTER_IS_CONTAINER (child)) - { - ClutterContainer *c = CLUTTER_CONTAINER (child); - - actor = clutter_container_find_child_by_id (c, child_id); - if (actor) - break; - } - } - - return actor; -} - static void clutter_group_real_raise (ClutterContainer *container, ClutterActor *actor, @@ -440,7 +405,6 @@ clutter_container_iface_init (ClutterContainerIface *iface) iface->add = clutter_group_real_add; iface->remove = clutter_group_real_remove; iface->foreach = clutter_group_real_foreach; - iface->find_child_by_id = clutter_group_real_find_child_by_id; iface->raise = clutter_group_real_raise; iface->lower = clutter_group_real_lower; iface->sort_depth_order = clutter_group_real_sort_depth_order; @@ -681,27 +645,6 @@ clutter_group_get_nth_child (ClutterGroup *self, return g_list_nth_data (self->priv->children, index_); } -/** - * clutter_group_find_child_by_id: - * @self: A #ClutterGroup - * @id: A unique #Clutteractor ID - * - * Finds a child actor of a group by its unique ID. Search recurses - * into any child groups. - * - * Returns: the #ClutterActor if found, or NULL. - * - * Deprecated: 0.6: Use clutter_container_find_child_by_id() instead. - */ -ClutterActor * -clutter_group_find_child_by_id (ClutterGroup *self, - guint id) -{ - g_return_val_if_fail (CLUTTER_IS_GROUP (self), NULL); - - return clutter_container_find_child_by_id (CLUTTER_CONTAINER (self), id); -} - /** * clutter_group_raise: * @self: a #ClutterGroup