diff options
author | Bastien Nocera | 2010-12-01 16:09:29 +0100 |
---|---|---|
committer | Nikias Bassen | 2010-12-01 16:09:29 +0100 |
commit | 59d520af8bbb6ff7702575036be387a9875b440d (patch) | |
tree | 7aa5a1b59fa2fb099b0b21ef705d01ae2090ce3f /src/sbitem.c | |
parent | 652e1793bc8a499d07299356a5f3f28a125c71b9 (diff) | |
download | sbmanager-59d520af8bbb6ff7702575036be387a9875b440d.tar.gz sbmanager-59d520af8bbb6ff7702575036be387a9875b440d.tar.bz2 |
Stop putting files in /tmp
Whether the wallpaper or the icons themselves, save them
in $XDG_CACHE_DIR, and simplify saving.
Diffstat (limited to 'src/sbitem.c')
-rw-r--r-- | src/sbitem.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/sbitem.c b/src/sbitem.c index b49a98f..9b49186 100644 --- a/src/sbitem.c +++ b/src/sbitem.c @@ -117,9 +117,28 @@ void g_func_sbitem_free(SBItem *item, gpointer data) char *sbitem_get_icon_filename(SBItem *item) { - char *value = sbitem_get_display_identifier(item); + static gboolean create_dir = FALSE; + const char *value; + char *filename, *path; + + if (create_dir == FALSE) { + path = g_build_filename (g_get_user_cache_dir (), + "libimobiledevice", + "icons", NULL); + if (g_mkdir_with_parents (path, 0755) >= 0) + create_dir = TRUE; + g_free (path); + } + + value = sbitem_get_display_identifier(item); if (!value) return NULL; - return g_strdup_printf("/tmp/%s.png", value); + filename = g_strdup_printf ("%s.png", value); + path = g_build_filename (g_get_user_cache_dir (), + "libimobiledevice", + "icons", + filename, NULL); + g_free (filename); + return path; } |