Fix the fileselector when choosing an icon.

SVN revision: 32172
This commit is contained in:
lok 2007-10-27 15:55:27 +00:00 committed by lok
parent acd700aba2
commit c96be05cc6
2 changed files with 40 additions and 21 deletions

View File

@ -568,7 +568,7 @@ _e_desktop_editor_cb_icon_select(void *data1, void *data2)
Evas_Object *o;
Evas_Coord mw, mh;
E_Desktop_Edit *editor;
char *dir = NULL;
char *path = NULL, *icon_path = NULL;
editor = data2;
cfdata = data1;
@ -586,22 +586,27 @@ _e_desktop_editor_cb_icon_select(void *data1, void *data2)
/* XXX change this to a generic icon selector (that can do either
* files from a dir, or icons in the current theme */
if (cfdata->icon)
dir = ecore_file_dir_get(cfdata->icon);
if (dir)
{
o = e_widget_fsel_add(dia->win->evas, dir, "/", NULL, NULL,
icon_path = efreet_icon_path_find(e_config->icon_theme,
cfdata->icon, "scalable");
path = ecore_file_dir_get(icon_path);
}
if (path)
{
o = e_widget_fsel_add(dia->win->evas, "/", path, NULL, NULL,
_e_desktop_edit_select_cb, cfdata,
NULL, cfdata, 1);
free(dir);
free(path);
}
else
{
o = e_widget_fsel_add(dia->win->evas, "~/", "/", NULL, NULL,
o = e_widget_fsel_add(dia->win->evas, "/", "~/", NULL, NULL,
_e_desktop_edit_select_cb, cfdata,
NULL, cfdata, 1);
}
if (icon_path) free(icon_path);
evas_object_show(o);
editor->icon_fsel = o;
e_widget_min_size_get(o, &mw, &mh);
@ -626,7 +631,7 @@ _e_desktop_editor_cb_exec_select(void *data1, void *data2)
Evas_Object *o;
Evas_Coord mw, mh;
E_Desktop_Edit *editor;
char *dir = NULL;
char *path = NULL;
editor = data2;
cfdata = data1;
@ -642,18 +647,25 @@ _e_desktop_editor_cb_exec_select(void *data1, void *data2)
/* absolute path to exe */
if (cfdata->exec)
dir = ecore_file_dir_get(cfdata->exec);
if (dir)
{
o = e_widget_fsel_add(dia->win->evas, dir, "/", NULL, NULL,
path = ecore_file_dir_get(cfdata->exec);
if (path && !ecore_file_exists(path))
{
free(path);
path = NULL;
}
}
if (path)
{
o = e_widget_fsel_add(dia->win->evas, "/", path, NULL, NULL,
_e_desktop_edit_select_cb, cfdata,
NULL, cfdata, 1);
free(dir);
free(path);
}
else
{
o = e_widget_fsel_add(dia->win->evas, "~/", "/", NULL, NULL,
o = e_widget_fsel_add(dia->win->evas, "/", "~/", NULL, NULL,
_e_desktop_edit_select_cb, cfdata,
NULL, cfdata, 1);
}

View File

@ -451,7 +451,7 @@ e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path)
{
E_Fm2_Smart_Data *sd;
Evas_List *l;
const char *realpath;
const char *realpath, *extended_path;
sd = evas_object_smart_data_get(obj);
if (!sd || !path) return; // safety
@ -489,7 +489,12 @@ e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path)
sd->config->theme.fixed = 0;
}
realpath = _e_fm2_dev_path_map(dev, path);
if (!strcmp(path, "~/"))
extended_path = e_user_homedir_get();
else
extended_path = path;
realpath = _e_fm2_dev_path_map(dev, extended_path);
/* If the path doesn't exist, popup a dialog */
if (dev && strncmp(dev, "removable:", 10)
&& !ecore_file_exists(realpath))
@ -530,7 +535,7 @@ e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path)
sd->order_file = 0;
if (dev) sd->dev = evas_stringshare_add(dev);
if (path) sd->path = evas_stringshare_add(path);
if (path) sd->path = evas_stringshare_add(extended_path);
sd->realpath = realpath;
_e_fm2_queue_free(obj);
_e_fm2_regions_free(obj);
@ -739,9 +744,11 @@ e_fm2_parent_go(Evas_Object *obj)
if (!sd->path) return;
path = strdup(sd->path);
if (sd->dev) dev = strdup(sd->dev);
p = strrchr(path, '/');
if (p) *p = 0;
e_fm2_path_set(obj, dev, path);
if ((p = strrchr(path, '/'))) *p = 0;
if (*path == 0)
e_fm2_path_set(obj, dev, "/");
else
e_fm2_path_set(obj, dev, path);
E_FREE(dev);
E_FREE(path);
}
@ -3888,7 +3895,7 @@ _e_fm2_icon_desktop_load(E_Fm2_Icon *ic)
ic->info.icon = NULL;
ic->info.link = NULL;
//Hack
if (!strncmp(ic->info.file, "|storage_serial_", 16)) ecore_file_unlink(buf);
if (!strncmp(ic->info.file, "|storage_", 9)) ecore_file_unlink(buf);
return 0;
}