aboutsummaryrefslogtreecommitdiffstats
path: root/main/tumbler/cachedir.patch
blob: 97570ac8243f7ba6bd6b9090fffd650bfed25c48 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
From 28ddddbb7ff0890ecab3b326ab78c659666e410c Mon Sep 17 00:00:00 2001
From: Jeremy Whiting <jpwhiting@kde.org>
Date: Wed, 6 Aug 2014 15:26:36 -0600
Subject: [PATCH] Change thumbnails to go into $XDG_CACHE_HOME/thumbnails as
 per spec change.

---
 plugins/xdg-cache/xdg-cache-cache.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/plugins/xdg-cache/xdg-cache-cache.c b/plugins/xdg-cache/xdg-cache-cache.c
index 6c85523..3afe316 100644
--- a/plugins/xdg-cache/xdg-cache-cache.c
+++ b/plugins/xdg-cache/xdg-cache-cache.c
@@ -507,7 +507,7 @@ xdg_cache_cache_is_thumbnail (TumblerCache *cache,
                               const gchar  *uri)
 {
   XDGCacheCache *xdg_cache = XDG_CACHE_CACHE (cache);
-  const gchar   *home;
+  const gchar   *cachedir;
   const gchar   *dirname;
   gboolean       is_thumbnail = FALSE;
   GList         *iter;
@@ -520,9 +520,9 @@ xdg_cache_cache_is_thumbnail (TumblerCache *cache,
 
   for (iter = xdg_cache->flavors; !is_thumbnail && iter != NULL; iter = iter->next)
     {
-      home = xdg_cache_cache_get_home ();
+      cachedir = g_get_user_cache_dir ();
       dirname = tumbler_thumbnail_flavor_get_name (iter->data);
-      path = g_build_filename (home, ".thumbnails", dirname, NULL);
+      path = g_build_filename (cachedir, "thumbnails", dirname, NULL);
 
       flavor_dir = g_file_new_for_path (path);
       file = g_file_new_for_uri (uri);
@@ -570,7 +570,7 @@ GFile *
 xdg_cache_cache_get_file (const gchar            *uri,
                           TumblerThumbnailFlavor *flavor)
 {
-  const gchar *home;
+  const gchar *cachedir;
   const gchar *dirname;
   GFile       *file;
   gchar       *filename;
@@ -580,12 +580,12 @@ xdg_cache_cache_get_file (const gchar            *uri,
   g_return_val_if_fail (uri != NULL && *uri != '\0', NULL);
   g_return_val_if_fail (TUMBLER_IS_THUMBNAIL_FLAVOR (flavor), NULL);
 
-  home = xdg_cache_cache_get_home ();
+  cachedir = g_get_user_cache_dir ();
   dirname = tumbler_thumbnail_flavor_get_name (flavor);
 
   md5_hash = g_compute_checksum_for_string (G_CHECKSUM_MD5, uri, -1);
   filename = g_strdup_printf ("%s.png", md5_hash);
-  path = g_build_filename (home, ".thumbnails", dirname, filename, NULL);
+  path = g_build_filename (cachedir, "thumbnails", dirname, filename, NULL);
 
   file = g_file_new_for_path (path);
 
@@ -602,7 +602,7 @@ GFile *
 xdg_cache_cache_get_temp_file (const gchar            *uri,
                                TumblerThumbnailFlavor *flavor)
 {
-  const gchar *home;
+  const gchar *cachedir;
   const gchar *dirname;
   GTimeVal     current_time = { 0, 0 };
   GFile       *file;
@@ -613,7 +613,7 @@ xdg_cache_cache_get_temp_file (const gchar            *uri,
   g_return_val_if_fail (uri != NULL && *uri != '\0', NULL);
   g_return_val_if_fail (TUMBLER_IS_THUMBNAIL_FLAVOR (flavor), NULL);
 
-  home = xdg_cache_cache_get_home ();
+  cachedir = g_get_user_cache_dir ();
   dirname = tumbler_thumbnail_flavor_get_name (flavor);
 
   g_get_current_time (&current_time);
@@ -621,7 +621,7 @@ xdg_cache_cache_get_temp_file (const gchar            *uri,
   md5_hash = g_compute_checksum_for_string (G_CHECKSUM_MD5, uri, -1);
   filename = g_strdup_printf ("%s-%ld-%ld.png", md5_hash,
                               current_time.tv_sec, current_time.tv_usec);
-  path = g_build_filename (home, ".thumbnails", dirname, filename, NULL);
+  path = g_build_filename (cachedir, "thumbnails", dirname, filename, NULL);
 
   file = g_file_new_for_path (path);
 
-- 
2.0.4