mojito-cleanup.patch 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. diff --git a/plugins/housekeeping/gsd-housekeeping-manager.c b/plugins/housekeeping/gsd-housekeeping-manager.c
  2. index f84cfad..e8f474a 100644
  3. --- a/plugins/housekeeping/gsd-housekeeping-manager.c
  4. +++ b/plugins/housekeeping/gsd-housekeeping-manager.c
  5. @@ -85,9 +85,13 @@ thumb_data_free (gpointer data)
  6. }
  7. }
  8. +typedef enum {
  9. + HASH,
  10. + HASH_PNG
  11. +} FileType;
  12. static GList *
  13. -read_dir_for_purge (const char *path, GList *files)
  14. +read_dir_for_purge (const char *path, GList *files, FileType type)
  15. {
  16. GFile *read_path;
  17. GFileEnumerator *enum_dir;
  18. @@ -105,9 +109,20 @@ read_dir_for_purge (const char *path, GList *files)
  19. GFileInfo *info;
  20. while ((info = g_file_enumerator_next_file (enum_dir, NULL, NULL)) != NULL) {
  21. const char *name;
  22. + gboolean prune = FALSE;
  23. +
  24. name = g_file_info_get_name (info);
  25. - if (strlen (name) == 36 && strcmp (name + 32, ".png") == 0) {
  26. + switch (type) {
  27. + case HASH:
  28. + prune = (strlen (name) == 36);
  29. + break;
  30. + case HASH_PNG:
  31. + prune = (strlen (name) == 36 && strcmp (name + 32, ".png") == 0);
  32. + break;
  33. + }
  34. +
  35. + if (prune) {
  36. ThumbData *td;
  37. GFile *entry;
  38. char *entry_path;
  39. @@ -197,14 +212,14 @@ purge_thumbnail_cache (void)
  40. ".thumbnails",
  41. "normal",
  42. NULL);
  43. - files = read_dir_for_purge (path, NULL);
  44. + files = read_dir_for_purge (path, NULL, HASH_PNG);
  45. g_free (path);
  46. path = g_build_filename (g_get_home_dir (),
  47. ".thumbnails",
  48. "large",
  49. NULL);
  50. - files = read_dir_for_purge (path, files);
  51. + files = read_dir_for_purge (path, files, HASH_PNG);
  52. g_free (path);
  53. path = g_build_filename (g_get_home_dir (),
  54. @@ -212,7 +227,14 @@ purge_thumbnail_cache (void)
  55. "fail",
  56. "gnome-thumbnail-factory",
  57. NULL);
  58. - files = read_dir_for_purge (path, files);
  59. + files = read_dir_for_purge (path, files, HASH_PNG);
  60. + g_free (path);
  61. +
  62. + path = g_build_filename (g_get_user_cache_dir (),
  63. + "mojito",
  64. + "thumbnails",
  65. + NULL);
  66. + files = read_dir_for_purge (path, files, HASH);
  67. g_free (path);
  68. g_get_current_time (&current_time);