forked from enlightenment/efl
elm_map: Make more robust elm_map
Summary: Make more robust elm_map even if the user wipe is cache directory or import an already filled tile cache. @fix T7443 Reviewers: zmike, cedric Reviewed By: zmike Subscribers: thierry1970, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7443 Differential Revision: https://phab.enlightenment.org/D7617
This commit is contained in:
parent
5da43b2aa7
commit
5f85e61f6a
|
@ -797,7 +797,7 @@ _download_job(void *data)
|
||||||
|
|
||||||
EINA_LIST_REVERSE_FOREACH_SAFE(sd->download_list, l, ll, gi)
|
EINA_LIST_REVERSE_FOREACH_SAFE(sd->download_list, l, ll, gi)
|
||||||
{
|
{
|
||||||
Eina_Bool ret;
|
Eina_Bool ret, file_exists;
|
||||||
|
|
||||||
if ((gi->g->zoom != sd->zoom) || !(_grid_item_in_viewport(gi)))
|
if ((gi->g->zoom != sd->zoom) || !(_grid_item_in_viewport(gi)))
|
||||||
{
|
{
|
||||||
|
@ -807,21 +807,41 @@ _download_job(void *data)
|
||||||
if (sd->download_num >= MAX_CONCURRENT_DOWNLOAD)
|
if (sd->download_num >= MAX_CONCURRENT_DOWNLOAD)
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
|
|
||||||
ret = ecore_file_download_full
|
file_exists = ecore_file_exists(gi->file);
|
||||||
(gi->url, gi->file, _downloaded_cb, NULL, gi, &(gi->job), sd->ua);
|
if (!file_exists)
|
||||||
|
|
||||||
if ((!ret) || (!gi->job))
|
|
||||||
ERR("Can't start to download from %s to %s", gi->url, gi->file);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
sd->download_list = eina_list_remove(sd->download_list, gi);
|
/* Check here if we can download into this directory even if this one
|
||||||
|
disappear due to some user black magic */
|
||||||
|
char *dir_path;
|
||||||
|
dir_path = ecore_file_dir_get(gi->file);
|
||||||
|
if (!ecore_file_exists(dir_path)) ecore_file_mkpath(dir_path);
|
||||||
|
free(dir_path);
|
||||||
|
ret = ecore_file_download_full
|
||||||
|
(gi->url, gi->file, _downloaded_cb, NULL, gi, &(gi->job), sd->ua);
|
||||||
|
|
||||||
|
if ((!ret) || (!gi->job))
|
||||||
|
{
|
||||||
|
ERR("Can't start to download from %s to %s", gi->url, gi->file);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
sd->try_num++;
|
sd->try_num++;
|
||||||
sd->download_num++;
|
sd->download_num++;
|
||||||
|
}
|
||||||
|
sd->download_list = eina_list_remove(sd->download_list, gi);
|
||||||
|
efl_event_callback_legacy_call
|
||||||
|
(obj, ELM_MAP_EVENT_TILE_LOAD, NULL);
|
||||||
|
if (sd->download_num == 1)
|
||||||
|
edje_object_signal_emit(wd->resize_obj,
|
||||||
|
"elm,state,busy,start", "elm");
|
||||||
|
if (file_exists)
|
||||||
|
{
|
||||||
|
/* It seem the file already exists, try to load it and let
|
||||||
|
_grid_item_update do his job. If this file isn't a image the func
|
||||||
|
will invalidate it and try to redownload it. */
|
||||||
|
_grid_item_update(gi);
|
||||||
|
gi->wsd->finish_num++;
|
||||||
efl_event_callback_legacy_call
|
efl_event_callback_legacy_call
|
||||||
(obj, ELM_MAP_EVENT_TILE_LOAD, NULL);
|
((gi->wsd)->obj, ELM_MAP_EVENT_TILE_LOADED, NULL);
|
||||||
if (sd->download_num == 1)
|
|
||||||
edje_object_signal_emit(wd->resize_obj,
|
|
||||||
"elm,state,busy,start", "elm");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue