extra: only override progress if we are not muted

otherwise we could never reach the done callback which wants to be
waited for.
This commit is contained in:
Marcel Hollerbach 2017-02-16 18:07:05 +01:00
parent 39e8e45008
commit fe62d65bca
4 changed files with 34 additions and 10 deletions

View File

@ -175,6 +175,7 @@ _small_preview_done_cb(void *data)
evas_object_show(p->image);
free(preview);
}
p->req = NULL;
evas_object_show(p->image);
evas_object_hide(p->progress);
}

View File

@ -19,6 +19,7 @@ Eina_List *_background_list = NULL;
#define sec_strdup(v) v ? eina_strbuf_string_steal(v) : NULL
void _extra_theme_cache_load();
static Eina_Bool extra_request_may_override(Extra_Request *req, Extra_Progress *progress);
#define GEN_FILE_NAME(buf, t) eina_strbuf_append_printf(buf, "%s-%d.edj", t->id, t->version);
@ -420,7 +421,10 @@ extra_theme_preview_download(Extra_Progress *progress, Extra_Theme *theme)
if (priv->preview)
{
priv->preview->progress = *progress;
if (extra_request_may_override(priv->preview, progress))
return priv->preview;
else
return NULL;
}
remote = _extra_preview_remote_generate("themes", theme->id);
@ -461,10 +465,12 @@ extra_theme_download(Extra_Progress *progress, Extra_Theme *theme)
EINA_SAFETY_ON_NULL_RETURN_VAL(progress, NULL);
EINA_SAFETY_ON_NULL_RETURN_VAL(theme, NULL);
if (priv->main)
if (priv->preview)
{
priv->main->progress = *progress;
return priv->main;
if (extra_request_may_override(priv->preview, progress))
return priv->preview;
else
return NULL;
}
urlstr = extra_theme_download_url_get(theme);
@ -685,10 +691,12 @@ extra_background_download(Extra_Progress *progress, Extra_Background *background
EINA_SAFETY_ON_NULL_RETURN_VAL(progress, NULL);
EINA_SAFETY_ON_NULL_RETURN_VAL(background, NULL);
if (priv->main)
if (priv->preview)
{
memcpy(&priv->preview->progress, progress, sizeof(Extra_Progress));
return priv->main;
if (extra_request_may_override(priv->preview, progress))
return priv->preview;
else
return NULL;
}
urlstr = extra_background_download_url_get(background);
@ -732,8 +740,10 @@ extra_background_preview_download(Extra_Progress *progress, Extra_Background *ba
if (priv->preview)
{
memcpy(&priv->preview->progress, progress, sizeof(Extra_Progress));
return priv->preview;
if (extra_request_may_override(priv->preview, progress))
return priv->preview;
else
return NULL;
}
remote = _extra_preview_remote_generate("backgrounds", background->id);
@ -764,7 +774,19 @@ extra_request_mute(Extra_Request *req)
{
if(!req) return;
req->muted = EINA_TRUE;
req->progress.data = NULL;
req->progress.progress_cb = NULL;
req->progress.done_cb = NULL;
}
static Eina_Bool
extra_request_may_override(Extra_Request *req, Extra_Progress *progress)
{
if (!req->muted) return EINA_FALSE;
memcpy(&req->progress, progress, sizeof(Extra_Progress));
return EINA_TRUE;
}

View File

@ -274,7 +274,7 @@ _download_check_progress_cb(void *data EINA_UNUSED, const char *file,
}
else
{
INF("Everything is ok\n");
INF("Everything is ok %s %ld\n", file, dltotal);
ecore_file_download_abort(job->cache);
_download_job_free(job);
}

View File

@ -40,6 +40,7 @@ typedef struct {
struct _Extra_Request
{
Eina_Bool muted;
Extra_Progress progress;
};