eina_hash_del(_exists_request, async->dup, async);
}
-static void
-_ethumb_client_exists_cancel(void *data, Ecore_Thread *thread)
-{
- Ethumb_Async_Exists_Cb *cb;
- Ethumb_Async_Exists *async = data;
- Ethumb *tmp = async->source->ethumb;
-
- async->source->ethumb = async->dup;
- async->source->ethumb_dirty = ethumb_cmp(tmp, async->dup);
-
- EINA_LIST_FREE(async->callbacks, cb)
- cb->exists_cb(async->source, (Ethumb_Exists*) async, EINA_FALSE, (void*) cb->data);
-
- async->source->ethumb = tmp;
- async->thread = NULL;
-
- eina_hash_del(_exists_request, async->dup, async);
-}
-
/**
* @endcond
*/
EINA_REFCOUNT_INIT(async);
async->thread = ecore_thread_run(_ethumb_client_exists_heavy,
_ethumb_client_exists_end,
- _ethumb_client_exists_cancel,
+ _ethumb_client_exists_end,
async);
eina_hash_direct_add(_exists_request, async->dup, async);
* @param exists the request to cancel.
*/
EAPI void
-ethumb_client_thumb_exists_cancel(Ethumb_Exists *exists)
+ethumb_client_thumb_exists_cancel(Ethumb_Exists *exists, Ethumb_Client_Thumb_Exists_Cb exists_cb, const void *data)
{
+ Ethumb_Async_Exists_Cb *cb;
Ethumb_Async_Exists *async = (Ethumb_Async_Exists*) exists;
+ Eina_List *l;
+
+ EINA_LIST_FOREACH(async->callbacks, l, cb)
+ if (cb->exists_cb == exists_cb && cb->data == data)
+ {
+ async->callbacks = eina_list_remove_list(async->callbacks, l);
+ break;
+ }
EINA_REFCOUNT_UNREF(async, _ethumb_async_cancel);
}
if (!async) return EINA_TRUE;
+ if (async->callbacks) return EINA_FALSE;
+
return ecore_thread_check(async->thread);
}
EAPI void ethumb_client_file_free(Ethumb_Client *client);
EAPI Ethumb_Exists *ethumb_client_thumb_exists(Ethumb_Client *client, Ethumb_Client_Thumb_Exists_Cb exists_cb, const void *data);
-EAPI void ethumb_client_thumb_exists_cancel(Ethumb_Exists *exists);
+EAPI void ethumb_client_thumb_exists_cancel(Ethumb_Exists *exists, Ethumb_Client_Thumb_Exists_Cb exists_cb, const void *data);
EAPI Eina_Bool ethumb_client_thumb_exists_check(Ethumb_Exists *exists);
EAPI int ethumb_client_generate(Ethumb_Client *client, Ethumb_Client_Generate_Cb generated_cb, const void *data, Eina_Free_Cb free_data);
EAPI void ethumb_client_generate_cancel(Ethumb_Client *client, int id, Ethumb_Client_Generate_Cancel_Cb cancel_cb, const void *data, Eina_Free_Cb free_data);