summaryrefslogtreecommitdiffstats
path: root/meta/recipes-gnome/gnome/gnome-settings-daemon/mojito-cleanup.patch
blob: 1aff2d6d6f6d53db39c5167d255e910d2293a067 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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 (&current_time);