e: show desktop according to XDG_DESKTOP_DIR if set

SVN revision: 62572
This commit is contained in:
Boris Faure 2011-08-18 19:11:34 +00:00
parent 413cbb8ae6
commit b2d2229fdc
2 changed files with 44 additions and 9 deletions

View File

@ -26,3 +26,4 @@ Hannes Janetzek <hannes.janetzek@gmail.com>
Mike Blumenkrantz (discomfitor/zmike) <mike@zentific.com>
Leif Middelschulte <leif.middelschulte@gmail.com>
yoz (Michael Bouchaud) <michael.bouchaud@gmail.com>
billiob (Boris Faure) <billiob@gmail.com>

View File

@ -3229,21 +3229,55 @@ _e_fm2_dev_path_map(const char *dev, const char *path)
}
else if (strcmp(dev, "desktop") == 0)
{
char *custom_desktop_dir = getenv("XDG_DESKTOP_DIR");
/* this is a virtual device - it's where your favorites list is
* stored - a dir with
.desktop files or symlinks (in fact anything
* you like
*/
if (custom_desktop_dir)
{
int len;
custom_desktop_dir = e_util_shell_env_path_eval(custom_desktop_dir);
len = strlen(custom_desktop_dir);
if (len >= sizeof(buf))
{
free(custom_desktop_dir);
return NULL;
}
strncpy(buf, custom_desktop_dir, sizeof(buf));
if (strcmp(path, "/"))
{
if (len + 1 + strlen(path) >= sizeof(buf))
{
free(custom_desktop_dir);
return NULL;
}
buf[len++] = '/';
strncpy(buf + len, path, sizeof(buf) - len);
}
free(custom_desktop_dir);
}
else
{
if (strcmp(path, "/") == 0)
{
if (e_user_homedir_concat(buf, sizeof(buf), _("Desktop")) >= sizeof(buf))
if (e_user_homedir_concat(buf, sizeof(buf),
_("Desktop")) >= sizeof(buf))
return NULL;
}
else
{
if (e_user_homedir_snprintf(buf, sizeof(buf), "%s/%s", _("Desktop"), path) >= sizeof(buf))
if (e_user_homedir_snprintf(buf, sizeof(buf), "%s/%s",
_("Desktop"), path)
>= sizeof(buf))
return NULL;
}
}
ecore_file_mkpath(buf);
}
else if (strcmp(dev, "temp") == 0)