forked from enlightenment/enlightenment
parent
c370c256b3
commit
c350457acf
|
@ -12,7 +12,8 @@
|
||||||
|
|
||||||
typedef struct _Import Import;
|
typedef struct _Import Import;
|
||||||
|
|
||||||
struct _Import {
|
struct _Import
|
||||||
|
{
|
||||||
int magic;
|
int magic;
|
||||||
|
|
||||||
E_Config_Dialog *parent;
|
E_Config_Dialog *parent;
|
||||||
|
@ -41,7 +42,7 @@ struct _E_Config_Dialog_Data
|
||||||
const char *source;
|
const char *source;
|
||||||
};
|
};
|
||||||
|
|
||||||
const char tmpdir_tpl[] = "/tmp/wallpXXXXXX";
|
#define TEMPLATE "/tmp/wallpXXXXXX";
|
||||||
|
|
||||||
static void _file_double_click_cb(void *data, Evas_Object *obj, void *ev_info);
|
static void _file_double_click_cb(void *data, Evas_Object *obj, void *ev_info);
|
||||||
static void _file_click_cb(void *data, Evas_Object *obj, void *ev_info);
|
static void _file_click_cb(void *data, Evas_Object *obj, void *ev_info);
|
||||||
|
@ -74,8 +75,7 @@ e_int_config_wallpaper_web(E_Config_Dialog *parent)
|
||||||
E_Fm2_Config fmc;
|
E_Fm2_Config fmc;
|
||||||
|
|
||||||
import = E_NEW(Import, 1);
|
import = E_NEW(Import, 1);
|
||||||
if (!import)
|
if (!import) return NULL;
|
||||||
return NULL;
|
|
||||||
|
|
||||||
import->magic = MAGIC_IMPORT;
|
import->magic = MAGIC_IMPORT;
|
||||||
|
|
||||||
|
@ -202,18 +202,12 @@ e_int_config_wallpaper_web_del(E_Dialog *dia)
|
||||||
cfdata = import->cfdata;
|
cfdata = import->cfdata;
|
||||||
|
|
||||||
if (cfdata->pending_downloads == 1)
|
if (cfdata->pending_downloads == 1)
|
||||||
{
|
|
||||||
ecore_file_download_abort_all();
|
ecore_file_download_abort_all();
|
||||||
}
|
|
||||||
|
|
||||||
if (cfdata->hdata)
|
if (cfdata->hdata)
|
||||||
{
|
|
||||||
ecore_event_handler_del(cfdata->hdata);
|
ecore_event_handler_del(cfdata->hdata);
|
||||||
}
|
|
||||||
if (cfdata->hcomplete)
|
if (cfdata->hcomplete)
|
||||||
{
|
|
||||||
ecore_event_handler_del(cfdata->hcomplete);
|
ecore_event_handler_del(cfdata->hcomplete);
|
||||||
}
|
|
||||||
ecore_file_download_shutdown();
|
ecore_file_download_shutdown();
|
||||||
ecore_con_url_shutdown();
|
ecore_con_url_shutdown();
|
||||||
|
|
||||||
|
@ -253,7 +247,8 @@ _feed_complete(void *data, int type, void *event)
|
||||||
ecore_event_handler_del(cfdata->hcomplete);
|
ecore_event_handler_del(cfdata->hcomplete);
|
||||||
cfdata->hdata = NULL;
|
cfdata->hdata = NULL;
|
||||||
cfdata->hcomplete = NULL;
|
cfdata->hcomplete = NULL;
|
||||||
if (euc->status == 200) {
|
if (euc->status == 200)
|
||||||
|
{
|
||||||
asprintf(&title, _("[%s] Getting feed... DONE!"), cfdata->source);
|
asprintf(&title, _("[%s] Getting feed... DONE!"), cfdata->source);
|
||||||
e_dialog_title_set(import->dia, title);
|
e_dialog_title_set(import->dia, title);
|
||||||
_parse_feed(data);
|
_parse_feed(data);
|
||||||
|
@ -331,9 +326,7 @@ _parse_feed(void *data)
|
||||||
while (fgets(instr, 255, fh) != NULL)
|
while (fgets(instr, 255, fh) != NULL)
|
||||||
{
|
{
|
||||||
if (strstr(instr, "<rss version") != NULL)
|
if (strstr(instr, "<rss version") != NULL)
|
||||||
{
|
|
||||||
state = 0;
|
state = 0;
|
||||||
}
|
|
||||||
|
|
||||||
if ((strstr(instr, "<item>") != NULL) && (state == 0))
|
if ((strstr(instr, "<item>") != NULL) && (state == 0))
|
||||||
{
|
{
|
||||||
|
@ -410,11 +403,7 @@ _get_thumbs(void *data)
|
||||||
while (src = ecore_list_next(cfdata->thumbs))
|
while (src = ecore_list_next(cfdata->thumbs))
|
||||||
{
|
{
|
||||||
asprintf(&dest, "%s/%s", dtmp, ecore_file_file_get(src));
|
asprintf(&dest, "%s/%s", dtmp, ecore_file_file_get(src));
|
||||||
ecore_file_download(src,
|
ecore_file_download(src, dest, _get_thumb_complete, NULL, import);
|
||||||
dest,
|
|
||||||
_get_thumb_complete,
|
|
||||||
NULL,
|
|
||||||
import);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,10 +443,9 @@ _file_click_cb(void *data, Evas_Object *obj, void *ev_info)
|
||||||
import = data;
|
import = data;
|
||||||
cfdata = import->cfdata;
|
cfdata = import->cfdata;
|
||||||
sels = e_fm2_selected_list_get(cfdata->ofm);
|
sels = e_fm2_selected_list_get(cfdata->ofm);
|
||||||
if (!sels)
|
if (!sels) return;
|
||||||
return;
|
if (cfdata->ready_for_edj == 0) return;
|
||||||
if (cfdata->ready_for_edj == 0)
|
|
||||||
return;
|
|
||||||
icon_info = sels->data;
|
icon_info = sels->data;
|
||||||
if (ecore_list_find(cfdata->thumbs, ECORE_COMPARE_CB(_list_find), icon_info->file))
|
if (ecore_list_find(cfdata->thumbs, ECORE_COMPARE_CB(_list_find), icon_info->file))
|
||||||
cfdata->edj = ecore_list_index_goto(cfdata->medias, ecore_list_index(cfdata->thumbs));
|
cfdata->edj = ecore_list_index_goto(cfdata->medias, ecore_list_index(cfdata->thumbs));
|
||||||
|
@ -491,9 +479,8 @@ _dia_ok_cb(void *data, E_Dialog *dia)
|
||||||
if (sels)
|
if (sels)
|
||||||
{
|
{
|
||||||
_download_media(import);
|
_download_media(import);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
e_int_config_wallpaper_web_del(dia);
|
e_int_config_wallpaper_web_del(dia);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,11 +538,8 @@ _get_thumb_complete(void *data, const char *file, int status)
|
||||||
cfdata = import->cfdata;
|
cfdata = import->cfdata;
|
||||||
if (got != ecore_list_count(cfdata->thumbs))
|
if (got != ecore_list_count(cfdata->thumbs))
|
||||||
{
|
{
|
||||||
asprintf(&title,
|
asprintf(&title, _("[%s] Download %d images of %d"),
|
||||||
_("[%s] Download %d images of %d"),
|
cfdata->source, got, ecore_list_index(cfdata->thumbs));
|
||||||
cfdata->source,
|
|
||||||
got,
|
|
||||||
ecore_list_index(cfdata->thumbs));
|
|
||||||
e_dialog_title_set(import->dia, title);
|
e_dialog_title_set(import->dia, title);
|
||||||
cfdata->ready_for_edj = 0;
|
cfdata->ready_for_edj = 0;
|
||||||
asprintf(&dst, "%s/%s", cfdata->tmpdir, ecore_file_file_get(file));
|
asprintf(&dst, "%s/%s", cfdata->tmpdir, ecore_file_file_get(file));
|
||||||
|
@ -575,7 +559,8 @@ _get_thumb_complete(void *data, const char *file, int status)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
_download_media_progress_cb(void *data, const char *file, long int dltotal, long int dlnow, long int ultotal, long int ulnow)
|
_download_media_progress_cb(void *data, const char *file, long int dltotal,
|
||||||
|
long int dlnow, long int ultotal, long int ulnow)
|
||||||
{
|
{
|
||||||
Import *import;
|
Import *import;
|
||||||
double status;
|
double status;
|
||||||
|
@ -584,16 +569,14 @@ _download_media_progress_cb(void *data, const char *file, long int dltotal, long
|
||||||
|
|
||||||
import = data;
|
import = data;
|
||||||
|
|
||||||
if (dlnow == 0 || dltotal == 0)
|
if ((dlnow == 0) || (dltotal == 0))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (last)
|
if (last)
|
||||||
{
|
{
|
||||||
status = (double) ((double) dlnow) / ((double) dltotal);
|
status = (double) ((double) dlnow) / ((double) dltotal);
|
||||||
asprintf(&title,
|
asprintf(&title, _("[%s] Downloading of edje file... %d%% done"),
|
||||||
_("[%s] Downloading of edje file... %d%% done"),
|
import->cfdata->source, (int) (status * 100.0));
|
||||||
import->cfdata->source,
|
|
||||||
(int) (status * 100.0));
|
|
||||||
e_dialog_title_set(import->dia, title);
|
e_dialog_title_set(import->dia, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -614,7 +597,7 @@ _get_feed(char *url, void *data)
|
||||||
import = data;
|
import = data;
|
||||||
cfdata = import->cfdata;
|
cfdata = import->cfdata;
|
||||||
|
|
||||||
tpl = strdup(tmpdir_tpl);
|
tpl = strdup(TEMPLATE);
|
||||||
cfdata->tmpdir = mkdtemp(tpl);
|
cfdata->tmpdir = mkdtemp(tpl);
|
||||||
free(tpl);
|
free(tpl);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue