Enlightenment CVS committal
Author : morlenxus
Project : e17
Module : apps/e
Dir : e17/apps/e/src/modules/conf_wallpaper
Modified Files:
e_int_config_wallpaper_web.c
Log Message:
Show correct wallpaper name in thumbnail list - do not use thumbnail name.
===================================================================
RCS file:
/cvs/e/e17/apps/e/src/modules/conf_wallpaper/e_int_config_wallpaper_web.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- e_int_config_wallpaper_web.c 21 Mar 2008 14:23:16 -0000 1.11
+++ e_int_config_wallpaper_web.c 27 Mar 2008 08:03:27 -0000 1.12
@@ -26,7 +26,7 @@
struct _E_Config_Dialog_Data
{
Evas_Object *ofm, *o, *osfm, *ol;
- Ecore_List *thumbs, *medias;
+ Ecore_List *thumbs, *names, *medias;
Ecore_Con_Url *ecu;
Ecore_Event_Handler *hdata, *hcomplete;
FILE *feed;
@@ -100,6 +100,8 @@
cfdata->o = o;
cfdata->thumbs = ecore_list_new();
ecore_list_free_cb_set(cfdata->thumbs, free);
+ cfdata->names = ecore_list_new();
+ ecore_list_free_cb_set(cfdata->names, free);
cfdata->medias = ecore_list_new();
ecore_list_free_cb_set(cfdata->medias, free);
@@ -207,6 +209,7 @@
free(cfdata->tmpdir);
}
ecore_list_destroy(cfdata->thumbs);
+ ecore_list_destroy(cfdata->names);
ecore_list_destroy(cfdata->medias);
e_int_config_wallpaper_web_done(import->parent);
@@ -296,7 +299,7 @@
E_Config_Dialog_Data *cfdata;
FILE *fh;
char instr[1024];
- char *edj, *img, *title;
+ char *edj, *img, *name, *title;
int state = -1;
import = data;
@@ -314,7 +317,19 @@
state = 1;
}
- if ((strstr(instr, "<link>") != NULL) && (state == 1))
+ if ((strstr(instr, "<title>") != NULL) && (state == 1))
+ {
+ char *p;
+
+ name = strchr(instr, '>');
+ name++;
+ p = strchr(name, '<');
+ *p = 0;
+ name = strdup(name);
+ state = 2;
+ }
+
+ if ((strstr(instr, "<link>") != NULL) && (state == 2))
{
char *p;
@@ -326,11 +341,11 @@
if (!strcmp(p, ".edj"))
{
edj = strdup(edj);
- state = 2;
+ state = 3;
}
}
- if ((strstr(instr, "<enclosure") != NULL) && (state == 2))
+ if ((strstr(instr, "<enclosure") != NULL) && (state == 3))
{
char *p;
@@ -339,12 +354,13 @@
p = strchr(img, '"');
*p = 0;
img = strdup(img);
- state = 3;
+ state = 4;
}
- if ((strstr(instr, "</item>") != NULL) && (state == 3))
+ if ((strstr(instr, "</item>") != NULL) && (state == 4))
{
ecore_list_append(cfdata->thumbs, img);
+ ecore_list_append(cfdata->names, name);
ecore_list_append(cfdata->medias, edj);
state = 0;
}
@@ -371,7 +387,7 @@
{
Import *import;
E_Config_Dialog_Data *cfdata;
- char *src, *dest, *dtmp;
+ char *src, *dest, *dtmp, *name, *ext;
import = data;
cfdata = import->cfdata;
@@ -379,9 +395,12 @@
asprintf(&dtmp, "%s/.tmp", cfdata->tmpdir);
ecore_file_mkdir(dtmp);
ecore_list_first_goto(cfdata->thumbs);
+ ecore_list_first_goto(cfdata->names);
while ((src = ecore_list_next(cfdata->thumbs)))
{
- asprintf(&dest, "%s/%s", dtmp, ecore_file_file_get(src));
+ name = ecore_list_next(cfdata->names);
+ ext = strrchr(src, '.');
+ asprintf(&dest, "%s/%s%s", dtmp, name, ext);
ecore_file_download(src, dest, _get_thumb_complete, NULL, import);
}
}
@@ -426,14 +445,14 @@
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))
- cfdata->edj = ecore_list_index_goto(cfdata->medias,
ecore_list_index(cfdata->thumbs));
+ if (ecore_list_find(cfdata->names, ECORE_COMPARE_CB(_list_find),
icon_info->file))
+ cfdata->edj = ecore_list_index_goto(cfdata->medias,
ecore_list_index(cfdata->names));
}
static int
_list_find(const char *str1, const char *str2)
{
- return strcmp(ecore_file_file_get(str1), str2);
+ return strcmp(str1, ecore_file_strip_ext(str2));
}
static void
@@ -605,6 +624,8 @@
// Clean lists
if (!ecore_list_empty_is(cfdata->thumbs))
ecore_list_clear(cfdata->thumbs);
+ if (!ecore_list_empty_is(cfdata->names))
+ ecore_list_clear(cfdata->names);
if (!ecore_list_empty_is(cfdata->medias))
ecore_list_clear(cfdata->medias);
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs