forked from enlightenment/enlightenment
parent
d3fe458ab8
commit
3d7ff04e75
|
@ -122,7 +122,7 @@ _ilist_fill(E_Config_Dialog_Data *cfdata)
|
|||
e_widget_ilist_clear(cfdata->o_list);
|
||||
e_widget_ilist_go(cfdata->o_list);
|
||||
|
||||
cur_profile = e_config_profile_get ();
|
||||
cur_profile = e_config_profile_get();
|
||||
for (l = e_config_profile_list(); l; l = l->next)
|
||||
{
|
||||
Evas_Object *ob;
|
||||
|
@ -153,7 +153,7 @@ _ilist_cb_selected(void *data)
|
|||
cfdata = data;
|
||||
if (!cfdata) return;
|
||||
|
||||
cur_profile = e_config_profile_get ();
|
||||
cur_profile = e_config_profile_get();
|
||||
if (!strcmp (cur_profile, cfdata->sel_profile))
|
||||
{
|
||||
e_widget_disabled_set(cfdata->o_select, 1);
|
||||
|
@ -175,7 +175,7 @@ _cb_add(void *data, void *data2)
|
|||
if (!cfdata) return;
|
||||
|
||||
if (cfdata->dia_new_profile)
|
||||
e_win_raise (cfdata->dia_new_profile->win);
|
||||
e_win_raise(cfdata->dia_new_profile->win);
|
||||
else
|
||||
cfdata->dia_new_profile = _dia_new_profile(cfdata);
|
||||
}
|
||||
|
@ -189,10 +189,10 @@ _cb_select(void *data, void *data2)
|
|||
cfdata = data;
|
||||
if (!cfdata) return;
|
||||
|
||||
e_config_save_flush ();
|
||||
e_config_profile_set (cfdata->sel_profile);
|
||||
e_config_profile_save ();
|
||||
e_config_save_block_set (1);
|
||||
e_config_save_flush();
|
||||
e_config_profile_set(cfdata->sel_profile);
|
||||
e_config_profile_save();
|
||||
e_config_save_block_set(1);
|
||||
|
||||
a = e_action_find("restart");
|
||||
if ((a) && (a->func.go)) a->func.go(NULL, NULL);
|
||||
|
@ -225,7 +225,7 @@ _cb_dialog_yes(void *data)
|
|||
d = data;
|
||||
if (!data) return;
|
||||
|
||||
e_config_profile_del (d->cfdata->sel_profile);
|
||||
e_config_profile_del(d->cfdata->sel_profile);
|
||||
e_config_save_queue();
|
||||
_ilist_fill(d->cfdata);
|
||||
}
|
||||
|
@ -316,17 +316,17 @@ _new_profile_cb_ok(void *data, E_Dialog *dia)
|
|||
cfdata = data;
|
||||
if (!cfdata) return;
|
||||
|
||||
snprintf (cur_profile, sizeof (cur_profile), "%s", e_config_profile_get ());
|
||||
snprintf(cur_profile, sizeof (cur_profile), "%s", e_config_profile_get());
|
||||
|
||||
if (cfdata->new_profile)
|
||||
{
|
||||
e_config_profile_add(cfdata->new_profile);
|
||||
if (cfdata->new_profile_type)
|
||||
{
|
||||
e_config_profile_set (cfdata->new_profile);
|
||||
e_config_save();
|
||||
e_config_profile_set (cur_profile);
|
||||
}
|
||||
e_config_profile_add(cfdata->new_profile);
|
||||
if (cfdata->new_profile_type)
|
||||
{
|
||||
e_config_profile_set(cfdata->new_profile);
|
||||
e_config_save();
|
||||
e_config_profile_set(cur_profile);
|
||||
}
|
||||
}
|
||||
|
||||
e_object_unref(E_OBJECT(dia));
|
||||
|
|
|
@ -43,26 +43,26 @@ struct _E_Config_Dialog_Data
|
|||
|
||||
char tmpdir_tpl[17] = "/tmp/wallpXXXXXX";
|
||||
|
||||
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 int _feed_complete (void *data, int type, void *event);
|
||||
static int _feed_data (void *data, int type, void *event);
|
||||
static void _get_feed (char *url, void *data);
|
||||
static void _parse_feed (void *data);
|
||||
static void _get_thumbs (void *data);
|
||||
void _get_thumb_complete (void *data, const char *file, int status);
|
||||
static void _source_sel_cb (void *data);
|
||||
static void _reset (void *data);
|
||||
static int _list_find (const char *str1, const char *str2);
|
||||
static void _dia_del_cb (void *obj);
|
||||
static void _dia_close_cb (void *data, E_Dialog *dia);
|
||||
static void _dia_ok_cb (void *data, E_Dialog *dia);
|
||||
static void _download_media (Import *import);
|
||||
int _download_media_progress_cb (void *data, const char *file, long int dltotal, long int dlnow, long int ultotal, long int ulnow);
|
||||
void _download_media_complete_cb (void *data, const char *file, int status);
|
||||
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 int _feed_complete(void *data, int type, void *event);
|
||||
static int _feed_data(void *data, int type, void *event);
|
||||
static void _get_feed(char *url, void *data);
|
||||
static void _parse_feed(void *data);
|
||||
static void _get_thumbs(void *data);
|
||||
void _get_thumb_complete(void *data, const char *file, int status);
|
||||
static void _source_sel_cb(void *data);
|
||||
static void _reset(void *data);
|
||||
static int _list_find(const char *str1, const char *str2);
|
||||
static void _dia_del_cb(void *obj);
|
||||
static void _dia_close_cb(void *data, E_Dialog *dia);
|
||||
static void _dia_ok_cb(void *data, E_Dialog *dia);
|
||||
static void _download_media(Import *import);
|
||||
int _download_media_progress_cb(void *data, const char *file, long int dltotal, long int dlnow, long int ultotal, long int ulnow);
|
||||
void _download_media_complete_cb(void *data, const char *file, int status);
|
||||
|
||||
EAPI E_Dialog *
|
||||
e_int_config_wallpaper_web (E_Config_Dialog *parent)
|
||||
e_int_config_wallpaper_web(E_Config_Dialog *parent)
|
||||
{
|
||||
Evas *evas;
|
||||
E_Dialog *dia;
|
||||
|
@ -73,31 +73,31 @@ e_int_config_wallpaper_web (E_Config_Dialog *parent)
|
|||
Evas_Coord mw, mh;
|
||||
E_Fm2_Config fmc;
|
||||
|
||||
import = E_NEW (Import, 1);
|
||||
import = E_NEW(Import, 1);
|
||||
if (!import)
|
||||
return NULL;
|
||||
|
||||
import->magic = MAGIC_IMPORT;
|
||||
|
||||
dia = e_dialog_new (parent->con, "E", "_wallpaper_web_dialog");
|
||||
dia = e_dialog_new(parent->con, "E", "_wallpaper_web_dialog");
|
||||
if (!dia)
|
||||
{
|
||||
E_FREE (import);
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
E_FREE(import);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dia->data = import;
|
||||
e_object_del_attach_func_set (E_OBJECT(dia), _dia_del_cb);
|
||||
e_win_centered_set (dia->win, 1);
|
||||
e_object_del_attach_func_set(E_OBJECT(dia), _dia_del_cb);
|
||||
e_win_centered_set(dia->win, 1);
|
||||
|
||||
evas = e_win_evas_get (dia->win);
|
||||
evas = e_win_evas_get(dia->win);
|
||||
|
||||
cfdata = E_NEW (E_Config_Dialog_Data, 1);
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
|
||||
ecore_con_url_init ();
|
||||
ecore_file_download_init ();
|
||||
ecore_con_url_init();
|
||||
ecore_file_download_init();
|
||||
|
||||
cfdata->ecu = ecore_con_url_new ("http://fake.url");
|
||||
cfdata->ecu = ecore_con_url_new("http://fake.url");
|
||||
|
||||
cfdata->ready_for_edj = 0;
|
||||
cfdata->pending_downloads = 0;
|
||||
|
@ -107,35 +107,35 @@ e_int_config_wallpaper_web (E_Config_Dialog *parent)
|
|||
|
||||
import->parent = parent;
|
||||
|
||||
e_dialog_title_set (dia, _("Choose a website from list..."));
|
||||
e_dialog_title_set(dia, _("Choose a website from list..."));
|
||||
|
||||
o = e_widget_list_add (evas, 0, 1);
|
||||
o = e_widget_list_add(evas, 0, 1);
|
||||
cfdata->o = o;
|
||||
cfdata->thumbs = ecore_list_new ();
|
||||
cfdata->medias = ecore_list_new ();
|
||||
of = e_widget_framelist_add (evas, "Sources", 1);
|
||||
ol = e_widget_ilist_add (evas, 24, 24, &cfdata->ol_val);
|
||||
cfdata->thumbs = ecore_list_new();
|
||||
cfdata->medias = ecore_list_new();
|
||||
of = e_widget_framelist_add(evas, "Sources", 1);
|
||||
ol = e_widget_ilist_add(evas, 24, 24, &cfdata->ol_val);
|
||||
cfdata->ol = ol;
|
||||
e_widget_ilist_append (ol, NULL, _("get-e.org - Static"),
|
||||
e_widget_ilist_append(ol, NULL, _("get-e.org - Static"),
|
||||
_source_sel_cb, import,
|
||||
"http://www.get-e.org/Backgrounds/Static/feed.xml");
|
||||
e_widget_ilist_append (ol, NULL, _("get-e.org - Animated"),
|
||||
e_widget_ilist_append(ol, NULL, _("get-e.org - Animated"),
|
||||
_source_sel_cb, import,
|
||||
"http://www.get-e.org/Backgrounds/Animated/feed.xml");
|
||||
/*e_widget_ilist_append (ol, NULL, _("get-e.org - Local copy"),
|
||||
/*e_widget_ilist_append(ol, NULL, _("get-e.org - Local copy"),
|
||||
_source_sel_cb, import,
|
||||
"http://localhost/get_e_feed.xml");*/
|
||||
/*e_widget_ilist_append (ol, NULL, "Flickr test",
|
||||
/*e_widget_ilist_append(ol, NULL, "Flickr test",
|
||||
_source_sel_cb, import,
|
||||
"http://api.flickr.com/services/feeds/photos_public.gne?tags=birro&lang=it-it&format=rss_200_enc");*/
|
||||
e_widget_ilist_go (ol);
|
||||
e_widget_ilist_go(ol);
|
||||
|
||||
|
||||
e_widget_framelist_object_append (of, ol);
|
||||
e_widget_list_object_append (o, of, 1, 1, 0.5);
|
||||
e_widget_framelist_object_append(of, ol);
|
||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||
|
||||
ofm = e_fm2_add (evas);
|
||||
memset (&fmc, 0, sizeof (E_Fm2_Config));
|
||||
ofm = e_fm2_add(evas);
|
||||
memset(&fmc, 0, sizeof(E_Fm2_Config));
|
||||
cfdata->ofm = ofm;
|
||||
fmc.view.mode = E_FM2_VIEW_MODE_GRID_ICONS;
|
||||
fmc.view.open_dirs_in_place = 1;
|
||||
|
@ -155,45 +155,45 @@ e_int_config_wallpaper_web (E_Config_Dialog *parent)
|
|||
fmc.list.sort.dirs.last = 1;
|
||||
fmc.selection.single = 1;
|
||||
fmc.selection.windows_modifiers = 0;
|
||||
e_fm2_config_set (ofm, &fmc);
|
||||
e_fm2_icon_menu_flags_set (ofm, E_FM2_MENU_NO_SHOW_HIDDEN);
|
||||
e_fm2_config_set(ofm, &fmc);
|
||||
e_fm2_icon_menu_flags_set(ofm, E_FM2_MENU_NO_SHOW_HIDDEN);
|
||||
|
||||
evas_object_smart_callback_add (ofm,
|
||||
"selected",
|
||||
_file_double_click_cb,
|
||||
import);
|
||||
evas_object_smart_callback_add (ofm,
|
||||
"selection_change",
|
||||
_file_click_cb,
|
||||
import);
|
||||
evas_object_smart_callback_add(ofm,
|
||||
"selected",
|
||||
_file_double_click_cb,
|
||||
import);
|
||||
evas_object_smart_callback_add(ofm,
|
||||
"selection_change",
|
||||
_file_click_cb,
|
||||
import);
|
||||
|
||||
osfm = e_widget_scrollframe_pan_add (evas, ofm,
|
||||
osfm = e_widget_scrollframe_pan_add(evas, ofm,
|
||||
e_fm2_pan_set,
|
||||
e_fm2_pan_get,
|
||||
e_fm2_pan_max_get,
|
||||
e_fm2_pan_child_size_get);
|
||||
cfdata->osfm = osfm;
|
||||
e_widget_list_object_append (cfdata->o, cfdata->osfm, 1, 1, 0.5);
|
||||
e_widget_min_size_set (osfm, 320, 320);
|
||||
e_widget_list_object_append(cfdata->o, cfdata->osfm, 1, 1, 0.5);
|
||||
e_widget_min_size_set(osfm, 320, 320);
|
||||
|
||||
e_widget_min_size_set (o, 580, 370);
|
||||
e_widget_min_size_get (o, &mw, &mh);
|
||||
e_dialog_content_set (dia, o, mw, mh);
|
||||
e_widget_min_size_set(o, 580, 370);
|
||||
e_widget_min_size_get(o, &mw, &mh);
|
||||
e_dialog_content_set(dia, o, mw, mh);
|
||||
|
||||
e_dialog_button_add (dia, _("OK"), NULL, _dia_ok_cb, import);
|
||||
e_dialog_button_add (dia, _("Cancel"), NULL, _dia_close_cb, import);
|
||||
e_dialog_button_disable_num_set (dia, 0, 1);
|
||||
e_dialog_button_add(dia, _("OK"), NULL, _dia_ok_cb, import);
|
||||
e_dialog_button_add(dia, _("Cancel"), NULL, _dia_close_cb, import);
|
||||
e_dialog_button_disable_num_set(dia, 0, 1);
|
||||
|
||||
e_dialog_resizable_set (dia, 1);
|
||||
e_dialog_show (dia);
|
||||
e_dialog_resizable_set(dia, 1);
|
||||
e_dialog_show(dia);
|
||||
|
||||
e_dialog_border_icon_set (dia, "enlightenment/background");
|
||||
e_dialog_border_icon_set(dia, "enlightenment/background");
|
||||
|
||||
return dia;
|
||||
}
|
||||
|
||||
void
|
||||
e_int_config_wallpaper_web_del (E_Dialog *dia)
|
||||
e_int_config_wallpaper_web_del(E_Dialog *dia)
|
||||
{
|
||||
Import *import;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
@ -203,37 +203,37 @@ e_int_config_wallpaper_web_del (E_Dialog *dia)
|
|||
|
||||
if (cfdata->pending_downloads == 1)
|
||||
{
|
||||
ecore_file_download_abort_all ();
|
||||
ecore_file_download_abort_all();
|
||||
}
|
||||
|
||||
if (cfdata->hdata)
|
||||
{
|
||||
ecore_event_handler_del (cfdata->hdata);
|
||||
ecore_event_handler_del(cfdata->hdata);
|
||||
}
|
||||
if (cfdata->hcomplete)
|
||||
{
|
||||
ecore_event_handler_del (cfdata->hcomplete);
|
||||
ecore_event_handler_del(cfdata->hcomplete);
|
||||
}
|
||||
ecore_file_download_shutdown();
|
||||
ecore_con_url_shutdown ();
|
||||
ecore_con_url_shutdown();
|
||||
|
||||
if (cfdata->tmpdir)
|
||||
{
|
||||
if (ecore_file_is_dir (cfdata->tmpdir))
|
||||
if (ecore_file_is_dir(cfdata->tmpdir))
|
||||
{
|
||||
ecore_file_recursive_rm (cfdata->tmpdir);
|
||||
ecore_file_rmdir (cfdata->tmpdir);
|
||||
ecore_file_recursive_rm(cfdata->tmpdir);
|
||||
ecore_file_rmdir(cfdata->tmpdir);
|
||||
}
|
||||
}
|
||||
|
||||
e_int_config_wallpaper_web_done (import->parent);
|
||||
E_FREE (import->cfdata);
|
||||
E_FREE (import);
|
||||
e_object_unref (E_OBJECT(dia));
|
||||
e_int_config_wallpaper_web_done(import->parent);
|
||||
E_FREE(import->cfdata);
|
||||
E_FREE(import);
|
||||
e_object_unref(E_OBJECT(dia));
|
||||
}
|
||||
|
||||
static int
|
||||
_feed_complete (void *data, int type, void *event)
|
||||
_feed_complete(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_Con_Event_Url_Complete *euc;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
@ -247,28 +247,28 @@ _feed_complete (void *data, int type, void *event)
|
|||
cfdata = import->cfdata;
|
||||
if (cfdata->ecu != euc->url_con) return 1;
|
||||
|
||||
fclose (cfdata->feed);
|
||||
fclose(cfdata->feed);
|
||||
cfdata->feed = NULL;
|
||||
ecore_event_handler_del (cfdata->hdata);
|
||||
ecore_event_handler_del (cfdata->hcomplete);
|
||||
ecore_event_handler_del(cfdata->hdata);
|
||||
ecore_event_handler_del(cfdata->hcomplete);
|
||||
cfdata->hdata = NULL;
|
||||
cfdata->hcomplete = NULL;
|
||||
if (euc->status == 200) {
|
||||
asprintf(&title, _("[%s] Getting feed... DONE!"), cfdata->source);
|
||||
e_dialog_title_set (import->dia, title);
|
||||
_parse_feed (data);
|
||||
e_dialog_title_set(import->dia, title);
|
||||
_parse_feed(data);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
asprintf(&title, _("[%s] Getting feed... FAILED!"), cfdata->source);
|
||||
e_dialog_title_set (import->dia, title);
|
||||
e_dialog_title_set(import->dia, title);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_feed_data (void *data, int type, void *event)
|
||||
_feed_data(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_Con_Event_Url_Data *eud;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
@ -282,12 +282,12 @@ _feed_data (void *data, int type, void *event)
|
|||
|
||||
if (cfdata->ecu != eud->url_con) return 1;
|
||||
|
||||
fwrite (eud->data, sizeof(unsigned char), eud->size, cfdata->feed);
|
||||
fwrite(eud->data, sizeof(unsigned char), eud->size, cfdata->feed);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_source_sel_cb (void *data)
|
||||
_source_sel_cb(void *data)
|
||||
{
|
||||
Import *import;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
@ -296,10 +296,10 @@ _source_sel_cb (void *data)
|
|||
cfdata = import->cfdata;
|
||||
if ((cfdata->busy == 0) && (cfdata->pending_downloads == 0))
|
||||
{
|
||||
cfdata->source = e_widget_ilist_selected_label_get (cfdata->ol);
|
||||
cfdata->source = e_widget_ilist_selected_label_get(cfdata->ol);
|
||||
cfdata->busy = 1;
|
||||
_reset (import);
|
||||
_get_feed (cfdata->ol_val, import);
|
||||
_reset(import);
|
||||
_get_feed(cfdata->ol_val, import);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -308,7 +308,7 @@ _source_sel_cb (void *data)
|
|||
}
|
||||
|
||||
static void
|
||||
_parse_feed (void *data)
|
||||
_parse_feed(void *data)
|
||||
{
|
||||
Import *import;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
@ -327,73 +327,73 @@ _parse_feed (void *data)
|
|||
cfdata = import->cfdata;
|
||||
|
||||
cfdata->pending_downloads = 0;
|
||||
fh = fopen ("/tmp/feed.xml", "r");
|
||||
while (fgets (instr, 255, fh) != NULL)
|
||||
fh = fopen("/tmp/feed.xml", "r");
|
||||
while (fgets(instr, 255, fh) != NULL)
|
||||
{
|
||||
if (strstr (instr, "<rss version") != NULL)
|
||||
if (strstr(instr, "<rss version") != NULL)
|
||||
{
|
||||
state = 0;
|
||||
}
|
||||
|
||||
if ((strstr (instr, "<item>") != NULL) && (state == 0))
|
||||
if ((strstr(instr, "<item>") != NULL) && (state == 0))
|
||||
{
|
||||
edj = NULL;
|
||||
img = NULL;
|
||||
state = 1;
|
||||
}
|
||||
|
||||
if ((strstr (instr, "<link>") != NULL) && (state == 1))
|
||||
if ((strstr(instr, "<link>") != NULL) && (state == 1))
|
||||
{
|
||||
tinstr = strdup (instr);
|
||||
edj = strtok (tinstr, ">");
|
||||
edj = strtok (NULL, "<");
|
||||
tmpstr = strrchr (ecore_file_file_get (edj), '.');
|
||||
if (strstr (tmpstr, "edj") != NULL)
|
||||
tinstr = strdup(instr);
|
||||
edj = strtok(tinstr, ">");
|
||||
edj = strtok(NULL, "<");
|
||||
tmpstr = strrchr(ecore_file_file_get(edj), '.');
|
||||
if (strstr(tmpstr, "edj") != NULL)
|
||||
state = 2;
|
||||
}
|
||||
|
||||
if ((strstr (instr, "<enclosure") != NULL) && (state == 2))
|
||||
if ((strstr(instr, "<enclosure") != NULL) && (state == 2))
|
||||
{
|
||||
tinstr = strdup (instr);
|
||||
img = strtok (tinstr, "\"");
|
||||
img = strtok (NULL, "\"");
|
||||
strcat (img, "\n");
|
||||
tinstr = strdup(instr);
|
||||
img = strtok(tinstr, "\"");
|
||||
img = strtok(NULL, "\"");
|
||||
strcat(img, "\n");
|
||||
state = 3;
|
||||
}
|
||||
|
||||
if ((strstr (instr, "</item>") != NULL) && (state == 3))
|
||||
if ((strstr(instr, "</item>") != NULL) && (state == 3))
|
||||
{
|
||||
timg = strdup (img);
|
||||
timg = strdup(img);
|
||||
timg[strlen(timg) - 1] = 0;
|
||||
ecore_list_append (cfdata->thumbs, strdup (timg));
|
||||
ecore_list_append (cfdata->medias, strdup (edj));
|
||||
ecore_list_append(cfdata->thumbs, strdup(timg));
|
||||
ecore_list_append(cfdata->medias, strdup(edj));
|
||||
state = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (timg)
|
||||
free (timg);
|
||||
free(timg);
|
||||
if (tinstr)
|
||||
free (tinstr);
|
||||
free(tinstr);
|
||||
fclose(fh);
|
||||
|
||||
if ((state != -1) && (state == 0))
|
||||
{
|
||||
asprintf(&title, _("[%s] Parsing feed... DONE!"), cfdata->source);
|
||||
e_dialog_title_set (import->dia, title);
|
||||
e_fm2_path_set (cfdata->ofm, cfdata->tmpdir, "/");
|
||||
_get_thumbs (import);
|
||||
e_dialog_title_set(import->dia, title);
|
||||
e_fm2_path_set(cfdata->ofm, cfdata->tmpdir, "/");
|
||||
_get_thumbs(import);
|
||||
}
|
||||
else
|
||||
{
|
||||
asprintf(&title, _("[%s] Parsing feed... FAILED!"), cfdata->source);
|
||||
cfdata->busy = 0;
|
||||
e_dialog_title_set (import->dia, title);
|
||||
e_dialog_title_set(import->dia, title);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_get_thumbs (void *data)
|
||||
_get_thumbs(void *data)
|
||||
{
|
||||
Import *import;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
@ -407,27 +407,27 @@ _get_thumbs (void *data)
|
|||
asprintf(&dtmp, "%s/.tmp", cfdata->tmpdir);
|
||||
ecore_file_mkdir(dtmp);
|
||||
ecore_list_first_goto(cfdata->thumbs);
|
||||
while (src = ecore_list_next (cfdata->thumbs))
|
||||
while (src = ecore_list_next(cfdata->thumbs))
|
||||
{
|
||||
asprintf(&dest, "%s/%s", dtmp, ecore_file_file_get(src));
|
||||
ecore_file_download (src,
|
||||
dest,
|
||||
_get_thumb_complete,
|
||||
NULL,
|
||||
import);
|
||||
ecore_file_download(src,
|
||||
dest,
|
||||
_get_thumb_complete,
|
||||
NULL,
|
||||
import);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_dia_del_cb (void *obj)
|
||||
_dia_del_cb(void *obj)
|
||||
{
|
||||
E_Dialog *dia = obj;
|
||||
|
||||
e_int_config_wallpaper_web_del (dia);
|
||||
e_int_config_wallpaper_web_del(dia);
|
||||
}
|
||||
|
||||
static void
|
||||
_file_double_click_cb (void *data, Evas_Object *obj, void *ev_info)
|
||||
_file_double_click_cb(void *data, Evas_Object *obj, void *ev_info)
|
||||
{
|
||||
/*E_Config_Dialog_Data *cfdata;
|
||||
Evas_List *sels;
|
||||
|
@ -444,7 +444,7 @@ _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)
|
||||
_file_click_cb(void *data, Evas_Object *obj, void *ev_info)
|
||||
{
|
||||
Import *import;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
@ -453,33 +453,33 @@ _file_click_cb (void *data, Evas_Object *obj, void *ev_info)
|
|||
|
||||
import = data;
|
||||
cfdata = import->cfdata;
|
||||
sels = e_fm2_selected_list_get (cfdata->ofm);
|
||||
sels = e_fm2_selected_list_get(cfdata->ofm);
|
||||
if (!sels)
|
||||
return;
|
||||
if (cfdata->ready_for_edj == 0)
|
||||
return;
|
||||
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));
|
||||
}
|
||||
|
||||
static int
|
||||
_list_find (const char *str1, const char *str2)
|
||||
_list_find(const char *str1, const char *str2)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
tmp = strdup (str1);
|
||||
return strcmp(ecore_file_file_get (tmp), str2);
|
||||
tmp = strdup(str1);
|
||||
return strcmp(ecore_file_file_get(tmp), str2);
|
||||
}
|
||||
|
||||
static void
|
||||
_dia_close_cb (void *data, E_Dialog *dia)
|
||||
_dia_close_cb(void *data, E_Dialog *dia)
|
||||
{
|
||||
e_int_config_wallpaper_web_del (dia);
|
||||
e_int_config_wallpaper_web_del(dia);
|
||||
}
|
||||
|
||||
static void
|
||||
_dia_ok_cb (void *data, E_Dialog *dia)
|
||||
_dia_ok_cb(void *data, E_Dialog *dia)
|
||||
{
|
||||
Import *import;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
@ -487,18 +487,18 @@ _dia_ok_cb (void *data, E_Dialog *dia)
|
|||
|
||||
import = data;
|
||||
cfdata = import->cfdata;
|
||||
sels = e_fm2_selected_list_get (cfdata->ofm);
|
||||
sels = e_fm2_selected_list_get(cfdata->ofm);
|
||||
if (sels)
|
||||
{
|
||||
_download_media (import);
|
||||
_download_media(import);
|
||||
return;
|
||||
}
|
||||
|
||||
e_int_config_wallpaper_web_del (dia);
|
||||
e_int_config_wallpaper_web_del(dia);
|
||||
}
|
||||
|
||||
static void
|
||||
_download_media (Import *import)
|
||||
_download_media(Import *import)
|
||||
{
|
||||
Import *i;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
@ -512,19 +512,19 @@ _download_media (Import *import)
|
|||
cfdata = i->cfdata;
|
||||
|
||||
cfdata->pending_downloads = 1;
|
||||
file = ecore_file_file_get (cfdata->edj);
|
||||
homedir = e_user_homedir_get ();
|
||||
file = ecore_file_file_get(cfdata->edj);
|
||||
homedir = e_user_homedir_get();
|
||||
asprintf(&buf, "%s/.e/e/backgrounds/%s", homedir, file);
|
||||
asprintf(&title, _("[%s] Downloading of edje file..."), cfdata->source);
|
||||
e_dialog_title_set (i->dia, title);
|
||||
ecore_file_download (cfdata->edj, buf,
|
||||
e_dialog_title_set(i->dia, title);
|
||||
ecore_file_download(cfdata->edj, buf,
|
||||
_download_media_complete_cb,
|
||||
_download_media_progress_cb,
|
||||
i);
|
||||
}
|
||||
|
||||
void
|
||||
_download_media_complete_cb (void *data, const char *file, int status)
|
||||
_download_media_complete_cb(void *data, const char *file, int status)
|
||||
{
|
||||
Import *import;
|
||||
char *dest;
|
||||
|
@ -532,14 +532,14 @@ _download_media_complete_cb (void *data, const char *file, int status)
|
|||
import = data;
|
||||
import->cfdata->pending_downloads = 0;
|
||||
asprintf(&dest, "%s/.e/e/backgrounds/%s",
|
||||
e_user_homedir_get (),
|
||||
ecore_file_file_get (import->cfdata->edj));
|
||||
e_int_config_wallpaper_update (import->parent, dest);
|
||||
e_int_config_wallpaper_web_del (import->dia);
|
||||
e_user_homedir_get(),
|
||||
ecore_file_file_get(import->cfdata->edj));
|
||||
e_int_config_wallpaper_update(import->parent, dest);
|
||||
e_int_config_wallpaper_web_del(import->dia);
|
||||
}
|
||||
|
||||
void
|
||||
_get_thumb_complete (void *data, const char *file, int status)
|
||||
_get_thumb_complete(void *data, const char *file, int status)
|
||||
{
|
||||
Import *import;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
@ -549,17 +549,17 @@ _get_thumb_complete (void *data, const char *file, int status)
|
|||
|
||||
import = data;
|
||||
cfdata = import->cfdata;
|
||||
if (got != ecore_list_count (cfdata->thumbs))
|
||||
if (got != ecore_list_count(cfdata->thumbs))
|
||||
{
|
||||
asprintf (&title,
|
||||
_("[%s] Download %d images of %d"),
|
||||
cfdata->source,
|
||||
got,
|
||||
ecore_list_index (cfdata->thumbs));
|
||||
e_dialog_title_set (import->dia, title);
|
||||
asprintf(&title,
|
||||
_("[%s] Download %d images of %d"),
|
||||
cfdata->source,
|
||||
got,
|
||||
ecore_list_index(cfdata->thumbs));
|
||||
e_dialog_title_set(import->dia, title);
|
||||
cfdata->ready_for_edj = 0;
|
||||
asprintf(&dst, "%s/%s", cfdata->tmpdir, ecore_file_file_get (file));
|
||||
ecore_file_mv (file, dst);
|
||||
asprintf(&dst, "%s/%s", cfdata->tmpdir, ecore_file_file_get(file));
|
||||
ecore_file_mv(file, dst);
|
||||
got++;
|
||||
}
|
||||
else
|
||||
|
@ -568,14 +568,14 @@ _get_thumb_complete (void *data, const char *file, int status)
|
|||
cfdata->busy = 0;
|
||||
cfdata->ready_for_edj = 1;
|
||||
asprintf(&title, _("[%s] Choose an image from list"), cfdata->source);
|
||||
e_dialog_title_set (import->dia, title);
|
||||
e_dialog_button_disable_num_set (import->dia, 0, 0);
|
||||
e_dialog_title_set(import->dia, title);
|
||||
e_dialog_button_disable_num_set(import->dia, 0, 0);
|
||||
cfdata->pending_downloads = 0;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
double status;
|
||||
|
@ -590,11 +590,11 @@ _download_media_progress_cb (void *data, const char *file, long int dltotal, lon
|
|||
if (last)
|
||||
{
|
||||
status = (double) ((double) dlnow) / ((double) dltotal);
|
||||
asprintf (&title,
|
||||
_("[%s] Downloading of edje file... %d%% done"),
|
||||
import->cfdata->source,
|
||||
(int) (status * 100.0));
|
||||
e_dialog_title_set (import->dia, title);
|
||||
asprintf(&title,
|
||||
_("[%s] Downloading of edje file... %d%% done"),
|
||||
import->cfdata->source,
|
||||
(int) (status * 100.0));
|
||||
e_dialog_title_set(import->dia, title);
|
||||
}
|
||||
|
||||
last = dlnow;
|
||||
|
@ -603,7 +603,7 @@ _download_media_progress_cb (void *data, const char *file, long int dltotal, lon
|
|||
}
|
||||
|
||||
static void
|
||||
_get_feed (char *url, void *data)
|
||||
_get_feed(char *url, void *data)
|
||||
{
|
||||
Import *import;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
@ -613,29 +613,29 @@ _get_feed (char *url, void *data)
|
|||
import = data;
|
||||
cfdata = import->cfdata;
|
||||
|
||||
cfdata->tmpdir = mkdtemp (strdup (tmpdir_tpl));
|
||||
cfdata->tmpdir = mkdtemp(strdup(tmpdir_tpl));
|
||||
|
||||
ecore_con_url_url_set (cfdata->ecu, url);
|
||||
ecore_file_download_abort_all ();
|
||||
if (cfdata->hdata) ecore_event_handler_del (cfdata->hdata);
|
||||
if (cfdata->hcomplete) ecore_event_handler_del (cfdata->hcomplete);
|
||||
if (cfdata->feed) fclose (cfdata->feed);
|
||||
ecore_con_url_url_set(cfdata->ecu, url);
|
||||
ecore_file_download_abort_all();
|
||||
if (cfdata->hdata) ecore_event_handler_del(cfdata->hdata);
|
||||
if (cfdata->hcomplete) ecore_event_handler_del(cfdata->hcomplete);
|
||||
if (cfdata->feed) fclose(cfdata->feed);
|
||||
|
||||
cfdata->hdata = ecore_event_handler_add (ECORE_CON_EVENT_URL_DATA,
|
||||
_feed_data,
|
||||
import);
|
||||
cfdata->hcomplete = ecore_event_handler_add (ECORE_CON_EVENT_URL_COMPLETE,
|
||||
cfdata->hdata = ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA,
|
||||
_feed_data,
|
||||
import);
|
||||
cfdata->hcomplete = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE,
|
||||
_feed_complete,
|
||||
import);
|
||||
|
||||
asprintf(&title, _("[%s] Getting feed..."), cfdata->source);
|
||||
e_dialog_title_set (import->dia, title); //
|
||||
cfdata->feed = fopen ("/tmp/feed.xml", "w+");
|
||||
ecore_con_url_send (cfdata->ecu, NULL, 0, NULL);
|
||||
e_dialog_title_set(import->dia, title); //
|
||||
cfdata->feed = fopen("/tmp/feed.xml", "w+");
|
||||
ecore_con_url_send(cfdata->ecu, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_reset (void *data)
|
||||
_reset(void *data)
|
||||
{
|
||||
Import *import;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
@ -646,8 +646,8 @@ _reset (void *data)
|
|||
// If there's pending downloads, stop it
|
||||
if (cfdata->pending_downloads == 1)
|
||||
{
|
||||
ecore_file_download_abort_all ();
|
||||
//ecore_file_download_shutdown ();
|
||||
ecore_file_download_abort_all();
|
||||
//ecore_file_download_shutdown();
|
||||
}
|
||||
cfdata->pending_downloads = 0;
|
||||
|
||||
|
@ -655,25 +655,25 @@ _reset (void *data)
|
|||
cfdata->busy = 0;
|
||||
|
||||
// Clean lists
|
||||
if (!ecore_list_empty_is (cfdata->thumbs))
|
||||
ecore_list_clear (cfdata->thumbs);
|
||||
if (!ecore_list_empty_is (cfdata->medias))
|
||||
ecore_list_clear (cfdata->medias);
|
||||
if (!ecore_list_empty_is(cfdata->thumbs))
|
||||
ecore_list_clear(cfdata->thumbs);
|
||||
if (!ecore_list_empty_is(cfdata->medias))
|
||||
ecore_list_clear(cfdata->medias);
|
||||
|
||||
// Clean existing data
|
||||
if (ecore_file_exists ("/tmp/feed.xml"))
|
||||
ecore_file_unlink ("/tmp/feed.xml");
|
||||
if (ecore_file_exists("/tmp/feed.xml"))
|
||||
ecore_file_unlink("/tmp/feed.xml");
|
||||
|
||||
// Remove temporary data
|
||||
if (cfdata->tmpdir)
|
||||
{
|
||||
if (ecore_file_is_dir (cfdata->tmpdir))
|
||||
if (ecore_file_is_dir(cfdata->tmpdir))
|
||||
{
|
||||
ecore_file_recursive_rm (cfdata->tmpdir);
|
||||
ecore_file_rmdir (cfdata->tmpdir);
|
||||
ecore_file_recursive_rm(cfdata->tmpdir);
|
||||
ecore_file_rmdir(cfdata->tmpdir);
|
||||
}
|
||||
}
|
||||
|
||||
// Disable OK button
|
||||
e_dialog_button_disable_num_set (import->dia, 0, 1);
|
||||
e_dialog_button_disable_num_set(import->dia, 0, 1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue