elementary: use new ethumb async exists API.

SVN revision: 58978
This commit is contained in:
Cedric BAIL 2011-04-27 18:07:18 +00:00
parent 8c7b5da537
commit 0502444c42
1 changed files with 42 additions and 10 deletions

View File

@ -35,6 +35,7 @@ struct _Widget_Data
int id;
const char *file;
const char *key;
Ethumb_Exists *exists;
} thumb;
Ecore_Event_Handler *eeh;
Elm_Thumb_Animation_Setting anim_setting;
@ -87,6 +88,11 @@ _del_hook(Evas_Object *obj)
if (wd->thumb.id >= 0)
ethumb_client_generate_cancel(_elm_ethumb_client, wd->thumb.id,
NULL, NULL, NULL);
if (wd->thumb.exists)
{
ethumb_client_thumb_exists_cancel(wd->thumb.exists);
wd->thumb.exists = NULL;
}
#endif
eina_stringshare_del(wd->file);
@ -239,19 +245,15 @@ _finished_thumb_cb(void *data, Ethumb_Client *c __UNUSED__, int id, const char *
}
static void
_thumb_apply(Widget_Data *wd)
_thumb_exists(Ethumb_Client *client, Ethumb_Exists *thread,
Eina_Bool exists, void *data)
{
if (wd->thumb.id > 0)
{
ethumb_client_generate_cancel
(_elm_ethumb_client, wd->thumb.id, NULL, NULL, NULL);
wd->thumb.id = -1;
}
Widget_Data *wd = data;
if (!wd->file) return;
if (ethumb_client_thumb_exists_check(thread))
return ;
ethumb_client_file_set(_elm_ethumb_client, wd->file, wd->key);
if (ethumb_client_thumb_exists(_elm_ethumb_client))
if (exists)
{
const char *thumb_path, *thumb_key;
@ -274,6 +276,29 @@ _thumb_apply(Widget_Data *wd)
edje_object_signal_emit(wd->frame, EDJE_SIGNAL_GENERATE_ERROR, "elm");
evas_object_smart_callback_call(wd->self, SIG_GENERATE_ERROR, NULL);
}
}
static void
_thumb_apply(Widget_Data *wd)
{
if (wd->thumb.id > 0)
{
ethumb_client_generate_cancel
(_elm_ethumb_client, wd->thumb.id, NULL, NULL, NULL);
wd->thumb.id = -1;
}
if (wd->thumb.exists)
{
ethumb_client_thumb_exists_cancel(wd->thumb.exists);
wd->thumb.exists = NULL;
}
if (!wd->file) return;
ethumb_client_file_set(_elm_ethumb_client, wd->file, wd->key);
ethumb_client_thumb_exists(_elm_ethumb_client, _thumb_exists, wd);
}
static Eina_Bool
@ -322,6 +347,12 @@ _thumb_hide_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void
evas_object_smart_callback_call(wd->self, SIG_GENERATE_STOP, NULL);
}
if (wd->thumb.exists)
{
ethumb_client_thumb_exists_cancel(wd->thumb.exists);
wd->thumb.exists = NULL;
}
if (wd->eeh)
{
ecore_event_handler_del(wd->eeh);
@ -442,6 +473,7 @@ elm_thumb_add(Evas_Object *parent)
wd->key = NULL;
wd->eeh = NULL;
wd->thumb.id = -1;
wd->thumb.exists = NULL;
wd->on_hold = EINA_FALSE;
wd->is_video = EINA_FALSE;
wd->was_video = EINA_FALSE;