diff options
author | Christian Kellner <gicmo@src.gnome.org> | 2008-08-02 14:26:01 +0000 |
---|---|---|
committer | Christian Kellner <gicmo@src.gnome.org> | 2008-08-02 14:26:01 +0000 |
commit | cd541d27b18b1b8b5aa9fae837c7230b6c066d5c (patch) | |
tree | c2266e78e617410f750805a9ec1eb02550253826 /daemon | |
parent | 1a057044210dae08d2e45a76bb267bc780c1e12c (diff) | |
download | gvfs-cd541d27b18b1b8b5aa9fae837c7230b6c066d5c.tar.gz |
Bug 509740 – Trash icon not updated ...
Create the home trash directory if it doesn't already exist
so we can monitor it for changes and update the trash icon
svn path=/trunk/; revision=1849
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/gvfsbackendtrash.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/daemon/gvfsbackendtrash.c b/daemon/gvfsbackendtrash.c index de12635d..3a4a9b26 100644 --- a/daemon/gvfsbackendtrash.c +++ b/daemon/gvfsbackendtrash.c @@ -531,12 +531,32 @@ list_trash_dirs (void) GList *topdirs_info; struct stat statbuf; gboolean has_trash_files; + int stat_result; dirs = NULL; has_trash_files = FALSE; home_trash = g_build_filename (g_get_user_data_dir (), "Trash", NULL); - if (lstat (home_trash, &statbuf) == 0 && + + stat_result = g_lstat (home_trash, &statbuf); + + /* If the home trash directory doesn't exist at this point, we must create + * it in order to monitor it. */ + if (stat_result != 0) + { + gchar *home_trash_files = g_build_filename (home_trash, "files", NULL); + gchar *home_trash_info = g_build_filename (home_trash, "info", NULL); + + g_mkdir_with_parents (home_trash_files, 0700); + g_mkdir_with_parents (home_trash_info, 0700); + + g_free (home_trash_files); + g_free (home_trash_info); + + stat_result = g_lstat (home_trash, &statbuf); + } + + if (stat_result == 0 && S_ISDIR (statbuf.st_mode)) { dirs = g_list_prepend (dirs, home_trash); |