GNOME Bugzilla – Bug 646644
gimp should use XDG cache dir for thumbnails
Last modified: 2014-08-26 08:29:18 UTC
Hopefully we'll be updating the thumbnails spec to follow the XDG Basedir spec. And when we do it would be good for gimp to follow that. Also see bug 646508.
Great news, we will happily do so. When you update the spec, can you take care of having a utility function added to glib that returns the right folder, also on windows and on osx?
http://library.gnome.org/devel/glib/2.28/glib-Miscellaneous-Utility-Functions.html#g-get-user-cache-dir But yeah we need to state in the spec that we should be using this instead of home.
Yeah my comment was not quite right, we would use the functions if they did the right thing on all platforms.
Also, there should probably be functions like g_get_user_foo_dir_for_application (const gchar *application); because otherwise the application would again need code in order to *not* prepend a dot to the directory name on platforms which don't normally use them.
You shouldn't use the dot in the xdg dirs actually.
Hm, how obvious. So ignore my last comment :)
*** Bug 675172 has been marked as a duplicate of this bug. ***
William, the issue of the subdir name again :) In bug #675172 you say $XDG_CACHE_HOME/thumbnails which would be ~/Library/Caches/thumbnails on a mac When I look in there, I wonder if it wouldn't make more sense to use something like ~/Library/Caches/org.freedesktop.thumbnails on a mac. This is probably too much to be asked from each app, can't we have API in glib that does all that platform magic? g_get_user_thumbnail_dir() for example?
g_get_user_cache_dir (used to) return %USERDIR%/Temporary Internet Files which is likely to be cleaned quite often unconditionally by most of those "windows optimizer" tools. It might make sense to either redefine the cache or not use the cache dir on windows.
I'm not sure we need a public entry point for reading thumbnails; in theory, we just need to modify the path pointed by the G_FILE_ATTRIBUTE_THUMBNAIL, so that GFileInfo will give you a path you can open either for reading or for writing a thumbnail.
(In reply to comment #8) > William, the issue of the subdir name again :) > > In bug #675172 you say $XDG_CACHE_HOME/thumbnails > > which would be ~/Library/Caches/thumbnails on a mac > > When I look in there, I wonder if it wouldn't make more sense > to use something like ~/Library/Caches/org.freedesktop.thumbnails > on a mac. g_get_user_cache_dir()/Freedesktop/Thumbnails would make sense on win32, blending in with what's usually done... (In reply to comment #9) > g_get_user_cache_dir (used to) return %USERDIR%/Temporary Internet Files which > is likely to be cleaned quite often unconditionally by most of those "windows > optimizer" tools. It might make sense to either redefine the cache or not use > the cache dir on windows. ... provided bug #659349 is fixed first (I've mentioned the branch I've been working on over there).
(In reply to comment #10) > I'm not sure we need a public entry point for reading thumbnails; in theory, we > just need to modify the path pointed by the G_FILE_ATTRIBUTE_THUMBNAIL, so that > GFileInfo will give you a path you can open either for reading or for writing a > thumbnail. The problem here is that we'd need a way to pick the right subdir for the thumbnail, so small, normal, large or fail/gimp-x.y. I don't think the file attribute covers this.
For the record, in the absence of a working g_get_user_cache_dir() for all platforms, and the absence of a default location for thumbnails on all platforms, I made the following change for OSX now: commit 46127dc789762b5ac1b614f7399f5f610394be72 Author: Michael Natterer <mitch@gimp.org> Date: Sat May 12 14:39:44 2012 +0200 Move gimpdir and thumbnails to proper places on OSX gimpdir goes to ~/Library/Gimp/x.y thumbnails go to ~/Library/Caches/org.freedesktop.thumbnails The thumbnail location is not standardized yet, but is the only location that makes sense. Also fix user install to search old gimpdirs to migrate in both Library and the classic location. Remove the obsolete CABON_CFLAGS from all makefiles. (cherry picked from commit 9112d68488f44408774f571e7d8fb48e41402674) I'm simply assuming that the thumbnail spec will pick the same folder, because it's the only one that makes sense on OSX.
For reference, I think we should simply fix glib to use ~/Library/Cache/org.freedesktop/ for g_get_user_cache() on OSX.
Um, absolutely not :) *Thumnails* should go into ~/Library/Cache/org.freedesktop.thumbnails, other *application* specific stuff would go into ~/Library/Cache/GIMP for example. I think this needs to be specified properly in the thumbnail spec, g_get_user_cache() should just return ~/Library/Cache.
What is planned about FreeDesktop.org XDG basedir specification for GIMP? http://ploum.net/post/207-modify-your-application-to-use-xdg-folders https://live.gnome.org/GnomeGoals/XDGConfigFolders http://www.freedesktop.org/wiki/Specifications/basedir-spec
We already moved gimpdir to .config/GIMP in git master.
I had a look at our current implementation. Looks like we were already doing most of the standard, with a specific subdirectory structure, and images of the standard size, etc. (cf. http://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html) Only the root directory was wrong. So that's easy to fix by using g_get_user_cache_dir () which will return the correct XDG_CACHE_HOME. Now I did not touch the special code for OSX (~/Library/Cache/org.freedesktop.thumbnails). I don't know about it, if you say there is a good reason to use this folder, that's ok with me. :-) As for Windows, I did not make any kind of special case, and g_get_user_cache_dir () returns CSIDL_INTERNET_CACHE on this platform. I read above that some people think it is not an optimal directory, and such. I personally have no opinion about this platform so I let it as is. I can do a special case code for Windows, as I did for the config directory too, if Mitch maybe really sees it fit? I really don't care much.
Created attachment 242692 [details] [review] Support of freedesktop thumbnails standard.
Yeah this bug was sitting here until some day applications have really moved to use that folder. The patch is of course correct. On my system, not a single app has started to use ~/.cache/thumbnails, but debian unstable is stuck with gnome 3.4. Is it really time to apply this patch?
Well on my system as well, there was not such directory until I tested GIMP. But should we wait until we are the bad student? We can as well be the good student for once and do something first. :-) Unless this standard is still considered unstable and the directory might change or something? It does not look like so to me, but I am not involved in the making of this spec, so I don't know…
Hey Mitch, I took 10 minutes to search what other projects are moving to the XDG thumbnail spec. Well even though KDE has not updated this yet apparently (I have opened a ticket in their tracker for this), it looks like at least the GNOME desktop did the move last year: See commit https://git.gnome.org/browse/gnome-desktop/commit/?id=22582a4ba4de44af8b0ea195f9896715fa8ac75d and associated bug report: https://bugzilla.gnome.org/show_bug.cgi?id=646508 So indeed not many projects are already using this spec in currently released version, but it looks like it may happen as next versions will be released. I guess we should do it in GIMP too. Moreover we are hosted as a GNOME project and the GNOME desktop has already done the change! :-)
Thanks for checking. It seems it's about time :) Go ahead and push the patch. Maybe we should advise people to symlink ~/.thumbnails or ~/.cache/thumbnails manually so they can share them with older software like GIMP 2.8.
commit 483505f2fcc5546f246f62c590bd5b4871b3081e Author: Jehan <jehan@girinstud.io> Date: Sun Apr 28 08:47:41 2013 +0900 Bug 646644: support of freedesktop's Thumbnail Management Standard.