extra: if a image cannot be set delete the file and redownload it

this should fix cases where people dont see complete images because they
are corrupted. For example because the app was closed when then image
was not fully downloaded.
This commit is contained in:
Marcel Hollerbach 2017-01-31 20:18:05 +01:00
parent 633f335cc4
commit c32bfdb144
1 changed files with 17 additions and 4 deletions

View File

@ -155,7 +155,11 @@ _small_preview_done_cb(void *data)
preview = p->acc.preview_get(p->data);
if (preview)
{
elm_image_file_set(p->image , preview, NULL);
if (!elm_image_file_set(p->image , preview, NULL))
{
//the download failed, do nothing here, we likly will run into the same problem. And we should not spam our download requests
ecore_file_remove(preview);
}
evas_object_show(p->image);
free(preview);
}
@ -195,10 +199,19 @@ extra_ui_small_preview_new(Extra_Ui_Small_Preview_Accessor acc, Evas_Object *par
preview = acc.preview_get(data);
if (preview)
{
elm_image_file_set(small->image, preview, NULL);
free(preview);
if (!elm_image_file_set(small->image, preview, NULL))
{
ecore_file_remove(preview);
free(preview);
preview = NULL;
}
else
{
free(preview);
}
}
else
if (!preview)
{
small->p.data = small;
small->p.done_cb = _small_preview_done_cb;