From dd518e0601cc8ae57a5ea10bee85a4876b22d215 Mon Sep 17 00:00:00 2001 From: sachiel Date: Fri, 29 Oct 2010 17:14:55 +0000 Subject: [PATCH] B-B-B-B-BETA BREAKER! As for Evas callbacks, let's have a del_full() version for the Edje signals. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@53997 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/Edje.h | 1 + src/lib/edje_program.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/src/lib/Edje.h b/src/lib/Edje.h index e88d33a..0879156 100644 --- a/src/lib/Edje.h +++ b/src/lib/Edje.h @@ -542,6 +542,7 @@ typedef Evas_Object *(*Edje_Item_Provider_Cb) (void *data, Evas_Object *obj, c /* edje_program.c */ EAPI void edje_object_signal_callback_add (Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data); EAPI void *edje_object_signal_callback_del (Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func); + EAPI void *edje_object_signal_callback_del_full(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data); EAPI void edje_object_signal_emit (Evas_Object *obj, const char *emission, const char *source); EAPI void edje_object_play_set (Evas_Object *obj, Eina_Bool play); EAPI Eina_Bool edje_object_play_get (const Evas_Object *obj); diff --git a/src/lib/edje_program.c b/src/lib/edje_program.c index 209af77..ff51b30 100644 --- a/src/lib/edje_program.c +++ b/src/lib/edje_program.c @@ -150,6 +150,7 @@ edje_object_signal_callback_add(Evas_Object *obj, const char *emission, const ch * pointer that was passed to this call will be returned. * * @see edje_object_signal_callback_add(). + * @see edje_object_signal_callback_del_full(). * */ EAPI void * @@ -195,6 +196,68 @@ edje_object_signal_callback_del(Evas_Object *obj, const char *emission, const ch } /** + * @brief Remove a signal-triggered callback from an object. + * + * @param obj A valid Evas_Object handle. + * @param emission The emission string. + * @param source The source string. + * @param func The callback function. + * @param data The user data passed to the callback. + * @return The data pointer + * + * This function removes a callback, previously attached to the + * emittion of a signal, from the object @a obj. The parameters @a + * emission, @a sourcei, @a func and @a data must match exactly those + * passed to a previous call to edje_object_signal_callback_add(). The data + * pointer that was passed to this call will be returned. + * + * @see edje_object_signal_callback_add(). + * @see edje_object_signal_callback_del(). + * + */ +EAPI void * +edje_object_signal_callback_del_full(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data) +{ + Edje *ed; + Eina_List *l; + Edje_Signal_Callback *escb; + + if ((!emission) || (!source) || (!func)) return NULL; + ed = _edje_fetch(obj); + if (!ed) return NULL; + if (ed->delete_me) return NULL; + EINA_LIST_FOREACH(ed->callbacks, l, escb) + { + if ((escb->func == func) && (escb->data == data) && + ((!escb->signal && !emission[0]) || + (escb->signal && !strcmp(escb->signal, emission))) && + ((!escb->source && !source[0]) || + (escb->source && !strcmp(escb->source, source)))) + { + void *data; + + data = escb->data; + if (ed->walking_callbacks) + { + escb->delete_me = 1; + ed->delete_callbacks = 1; + } + else + { + _edje_callbacks_patterns_clean(ed); + + ed->callbacks = eina_list_remove_list(ed->callbacks, l); + if (escb->signal) eina_stringshare_del(escb->signal); + if (escb->source) eina_stringshare_del(escb->source); + free(escb); + } + return data; + } + } + return NULL; +} + +/** * @brief Send a signal to an edje object. * * @param obj A valid Evas_Object handle. -- 2.7.4