77 lines
2.9 KiB
Diff
77 lines
2.9 KiB
Diff
|
Upstream-Status: Pending
|
||
|
|
||
|
diff --git a/plugins/housekeeping/gsd-housekeeping-manager.c b/plugins/housekeeping/gsd-housekeeping-manager.c
|
||
|
index f84cfad..e8f474a 100644
|
||
|
--- a/plugins/housekeeping/gsd-housekeeping-manager.c
|
||
|
+++ b/plugins/housekeeping/gsd-housekeeping-manager.c
|
||
|
@@ -85,9 +85,13 @@ thumb_data_free (gpointer data)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
+typedef enum {
|
||
|
+ HASH,
|
||
|
+ HASH_PNG
|
||
|
+} FileType;
|
||
|
|
||
|
static GList *
|
||
|
-read_dir_for_purge (const char *path, GList *files)
|
||
|
+read_dir_for_purge (const char *path, GList *files, FileType type)
|
||
|
{
|
||
|
GFile *read_path;
|
||
|
GFileEnumerator *enum_dir;
|
||
|
@@ -105,9 +109,20 @@ read_dir_for_purge (const char *path, GList *files)
|
||
|
GFileInfo *info;
|
||
|
while ((info = g_file_enumerator_next_file (enum_dir, NULL, NULL)) != NULL) {
|
||
|
const char *name;
|
||
|
+ gboolean prune = FALSE;
|
||
|
+
|
||
|
name = g_file_info_get_name (info);
|
||
|
|
||
|
- if (strlen (name) == 36 && strcmp (name + 32, ".png") == 0) {
|
||
|
+ switch (type) {
|
||
|
+ case HASH:
|
||
|
+ prune = (strlen (name) == 36);
|
||
|
+ break;
|
||
|
+ case HASH_PNG:
|
||
|
+ prune = (strlen (name) == 36 && strcmp (name + 32, ".png") == 0);
|
||
|
+ break;
|
||
|
+ }
|
||
|
+
|
||
|
+ if (prune) {
|
||
|
ThumbData *td;
|
||
|
GFile *entry;
|
||
|
char *entry_path;
|
||
|
@@ -197,14 +212,14 @@ purge_thumbnail_cache (void)
|
||
|
".thumbnails",
|
||
|
"normal",
|
||
|
NULL);
|
||
|
- files = read_dir_for_purge (path, NULL);
|
||
|
+ files = read_dir_for_purge (path, NULL, HASH_PNG);
|
||
|
g_free (path);
|
||
|
|
||
|
path = g_build_filename (g_get_home_dir (),
|
||
|
".thumbnails",
|
||
|
"large",
|
||
|
NULL);
|
||
|
- files = read_dir_for_purge (path, files);
|
||
|
+ files = read_dir_for_purge (path, files, HASH_PNG);
|
||
|
g_free (path);
|
||
|
|
||
|
path = g_build_filename (g_get_home_dir (),
|
||
|
@@ -212,7 +227,14 @@ purge_thumbnail_cache (void)
|
||
|
"fail",
|
||
|
"gnome-thumbnail-factory",
|
||
|
NULL);
|
||
|
- files = read_dir_for_purge (path, files);
|
||
|
+ files = read_dir_for_purge (path, files, HASH_PNG);
|
||
|
+ g_free (path);
|
||
|
+
|
||
|
+ path = g_build_filename (g_get_user_cache_dir (),
|
||
|
+ "mojito",
|
||
|
+ "thumbnails",
|
||
|
+ NULL);
|
||
|
+ files = read_dir_for_purge (path, files, HASH);
|
||
|
g_free (path);
|
||
|
|
||
|
g_get_current_time (¤t_time);
|