From 2821b86d81cbacfc748f7a1c1193bff4155c8916 Mon Sep 17 00:00:00 2001 From: raster Date: Wed, 28 Dec 2011 06:00:37 +0000 Subject: [PATCH] actually allow cursion levels to be set/limited. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@66590 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/Evas.h | 11 ++++++----- src/lib/canvas/evas_name.c | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/lib/Evas.h b/src/lib/Evas.h index a0a29e5..1939f3d 100644 --- a/src/lib/Evas.h +++ b/src/lib/Evas.h @@ -5805,21 +5805,22 @@ EAPI Evas_Object *evas_object_name_find (const Evas *e, const c * Retrieves the object from children of the given objec with the given name. * @param obj The parent (smart) object whose children to search. * @param name The given name. - * @param recurse set to EINA_TRUE if this is to recurse down child objects. + * @param recurse Set to the number of child levels to recurse (0 == don't recurse, 1 == only look at the children of @p obj or their immediate children, but no further etc.). * @return If successful, the Evas object with the given name. Otherwise, * @c NULL. * * This looks for the evas object given a name by evas_object_name_set(), but - * it ONLY looks at the children of the biecjt *p obj, and will only recurse - * into thsoe children if @p recurse is set to EINA_TRUE. If the name is not + * it ONLY looks at the children of the object *p obj, and will only recurse + * into those children if @p recurse is greater than 0. If the name is not * unique within immediate children (or the whole child tree) then it is not - * defined which child object will be returned. + * defined which child object will be returned. If @p recurse is set to -1 then + * it will recurse without limit. * * @since 1.2 * * @ingroup Evas_Object_Group_Find */ -EAPI Evas_Object *evas_object_name_child_find (const Evas_Object *obj, const char *name, Eina_Bool recurse) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; +EAPI Evas_Object *evas_object_name_child_find (const Evas_Object *obj, const char *name, int recurse) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; /** * Retrieve the Evas object stacked at the top of a given position in diff --git a/src/lib/canvas/evas_name.c b/src/lib/canvas/evas_name.c index 2a74805..167d508 100644 --- a/src/lib/canvas/evas_name.c +++ b/src/lib/canvas/evas_name.c @@ -40,7 +40,7 @@ evas_object_name_find(const Evas *e, const char *name) } static Evas_Object * -_evas_object_name_child_find(const Evas_Object *obj, const char *name, Eina_Bool recurse) +_evas_object_name_child_find(const Evas_Object *obj, const char *name, int recurse) { const Eina_Inlist *lst; Evas_Object *child; @@ -52,9 +52,9 @@ _evas_object_name_child_find(const Evas_Object *obj, const char *name, Eina_Bool if (child->delete_me) continue; if (!child->name) continue; if (!strcmp(name, child->name)) return child; - if (recurse) + if (recurse != 0) { - if ((obj = _evas_object_name_child_find(child, name, recurse))) + if ((obj = _evas_object_name_child_find(child, name, recurse - 1))) return obj; } } @@ -62,7 +62,7 @@ _evas_object_name_child_find(const Evas_Object *obj, const char *name, Eina_Bool } EAPI Evas_Object * -evas_object_name_child_find(const Evas_Object *obj, const char *name, Eina_Bool recurse) +evas_object_name_child_find(const Evas_Object *obj, const char *name, int recurse) { MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return NULL; -- 2.7.4