Drag e_fm into the ecore_desktop world. Needs a review, I'm only guessing here.

SVN revision: 25208
This commit is contained in:
David Walter Seikel 2006-08-30 12:24:13 +00:00
parent b7a8ed9cff
commit 643a546807
1 changed files with 54 additions and 37 deletions

View File

@ -577,7 +577,8 @@ _e_fm2_dev_path_map(const char *dev, const char *path)
} }
else if (CMP("favorites")) { else if (CMP("favorites")) {
/* this is a virtual device - it's where your favorites list is /* this is a virtual device - it's where your favorites list is
* stored - a dir with .desktop files or symlinks (in fact anything * stored - a dir with
.desktop files or symlinks (in fact anything
* you like * you like
*/ */
s = e_user_homedir_get(); s = e_user_homedir_get();
@ -1473,11 +1474,21 @@ _e_fm2_icon_icon_set(E_Fm2_Icon *ic)
* if ic->info.icon == blah.xxx then use relative path to icon dirs * if ic->info.icon == blah.xxx then use relative path to icon dirs
* if ic->info.icon == blah/blah2.xxx then use relative path to icon dirs * if ic->info.icon == blah/blah2.xxx then use relative path to icon dirs
*/ */
/* theme icon */ if (ic->info.icon[0] == '/')
ic->obj_icon = edje_object_add(evas_object_evas_get(ic->sd->obj)); {
e_util_edje_icon_set(ic->obj_icon, ic->info.icon); /* path to icon file */
edje_object_part_swallow(ic->obj, "e.swallow.icon", ic->obj_icon); ic->obj_icon = e_icon_add(evas_object_evas_get(ic->sd->obj));
evas_object_show(ic->obj_icon); e_icon_file_set(ic->obj_icon, ic->info.icon);
e_icon_fill_inside_set(ic->obj_icon, 1);
}
else
{
/* theme icon */
ic->obj_icon = edje_object_add(evas_object_evas_get(ic->sd->obj));
e_util_edje_icon_set(ic->obj_icon, ic->info.icon);
}
edje_object_part_swallow(ic->obj, "e.swallow.icon", ic->obj_icon);
evas_object_show(ic->obj_icon);
return; return;
} }
if (S_ISDIR(ic->info.statinfo.st_mode)) if (S_ISDIR(ic->info.statinfo.st_mode))
@ -1632,39 +1643,45 @@ _e_fm2_icon_desktop_load(E_Fm2_Icon *ic)
{ {
char buf[4096], key[256], val[4096]; char buf[4096], key[256], val[4096];
FILE *f; FILE *f;
Ecore_Desktop *desktop;
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file); snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file);
f = fopen(buf, "rb");
if (!f) return 0; desktop = ecore_desktop_get(buf, NULL);
if (!fgets(buf, sizeof(buf), f)) goto error; if (desktop)
if (strcmp(buf, "[Desktop Entry]\n")) goto error; {
while (fscanf(f, "%255[^=]=%4095[^\n]\n", key, val) == 2) if (desktop->name) ic->info.label = evas_stringshare_add(desktop->name);
{ if (desktop->generic) ic->info.generic = evas_stringshare_add(desktop->generic);
if (!strcmp(key, "Name")) if (desktop->comment) ic->info.comment = evas_stringshare_add(desktop->comment);
ic->info.label = evas_stringshare_add(val);
else if (!strcmp(key, "Comment")) if (desktop->file) ic->info.link = _e_fm2_icon_desktop_url_eval(desktop->file);
ic->info.comment = evas_stringshare_add(val); if (desktop->URL) ic->info.link = _e_fm2_icon_desktop_url_eval(desktop->URL);
else if (!strcmp(key, "Generic")) if (desktop->path) ic->info.link = _e_fm2_icon_desktop_url_eval(desktop->path);
ic->info.generic = evas_stringshare_add(val);
else if (!strcmp(key, "Icon")) if (desktop->icon)
ic->info.icon = evas_stringshare_add(val); {
else if (!strcmp(key, "Type")) char *v;
{
if (!strcmp(val, "Mount")) ic->info.mount = 1; /* FIXME: Use a real icon size. */
else if (!strcmp(val, "Link")) v = (char *) ecore_desktop_icon_find(desktop->icon, NULL, e_config->icon_theme);
{ if (v)
} ic->info.icon = evas_stringshare_add(v);
else }
goto error;
} if (desktop->type)
else if (!strcmp(key, "File")) {
ic->info.link = _e_fm2_icon_desktop_url_eval(val); if (!strcmp(desktop->type, "Mount")) ic->info.mount = 1;
else if (!strcmp(key, "URL")) else if (!strcmp(desktop->type, "Link"))
ic->info.link = _e_fm2_icon_desktop_url_eval(val); {
else if (!strcmp(key, "Path")) }
ic->info.link = _e_fm2_icon_desktop_url_eval(val); else if (!strcmp(desktop->type, "Application"))
} {
fclose(f); }
else
goto error;
}
}
return 1; return 1;
error: error:
if (ic->info.label) evas_stringshare_del(ic->info.label); if (ic->info.label) evas_stringshare_del(ic->info.label);