GNOME Bugzilla – Bug 528749
add G_USER_DIRECTORY_THUMBNAILS
Last modified: 2008-11-28 21:43:07 UTC
A consensus seems to have emerged on the freedesktop mailing list (http://lists.freedesktop.org/archives/xdg/2008-April/009471.html) that ~/.thumbnails should move to $XDG_CACHE_HOME/thumbnails. To simplify this move, I propose adding a g_get_user_thumbnail_dir function to glib. Patch below. It returns $XDG_CACHE_HOME/thumbnails, unless this directory does not exist but the old-style ~/.thumbnails does, in which case it returns ~/.thumbnails. - Mike
Created attachment 109487 [details] [review] add g_get_user_thumbnail_dir function
I think this is probably a good idea. There now seem to be functions available for most of the other spec-related directories, so why not this one too? Patching this is in most apps should be trivial. Here's that list of files you pasted in bug 523174 comment 10: glib/gio/glocalfileinfo.c gnome-settings-daemon/plugins/housekeeping/gsd-housekeeping-manager.c gnome-user-docs/gnome2-system-admin-guide gnome-user-docs/gnome2-user-guide gnome-user-docs/gnome2-accessibility-guide gthumb/libgthumb/thumb-cache.c gthumb/libgthumb/typedefs.h gthumb/libgthumb/thumb-loader.c gthumb/src/dlg-search.c gvfs/daemon/gvfsbackend.c libgnomeui/libgnomeui/gnome-thumbnail.c nautilus/libnautilus-private/nautilus-thumbnails.c sabayon/lib/config.py.in So we should file bugs against gnome-settings-daemon, user-docs, gthumb, gvfs, nautilus, and sabayon to update their respective files. The libgnomeui one exists already, of course ;-) Should the patch wait until the spec is officially published/updated? The new function makes sense regardless, but it won't point to the correct location until that change is official.
Doesn't it make sense to use g_get_user_special_dir() for this? Just define a new GUserDirectory.
I'm not sure... the other "special dirs" are highly-visible non-hidden folders normally in the home dir. The thumbnail dir is hidden inside homedir/.cache. Is OK to mix the two? - Mike
Where in gnome are the xdg special dirs defined, anyways? (Not the enum, I see that - I mean path strings like "Pictures"). - Mike
This is defined in .config/user-dirs.dirs and managed by the xdg-user-dirs tool.
(In reply to comment #4) > I'm not sure... the other "special dirs" are highly-visible non-hidden folders > normally in the home dir. The thumbnail dir is hidden inside homedir/.cache. Is > OK to mix the two? Why wouldn't it be okay? As long as the directory is special, it could work. I'm not saying it's the way to go -- that's up to the glib maintainers -- but I would consider this.
OK, you are probably right. I'll investigate the special dir approach further. - Mike
xdg-user-dirs-update.c doesn't expand env vars, so we can't put: $XDG_CACHE_HOME/thumbnails in user-dirs.defaults. We would need .cache/thumbnails but then that wouldn't track $XDG_CACHE_HOME if it was changed. Suggestions? - Mike
So are you're looking at adding $XDG_THUMBNAILS_DIR to ~/.config/users-dirs.dirs? If so, should we request that the new modified spec mention that this variable should exist? Also, if you're opening another bug for that work can you leave a reference here to that new bug?
Michael: I wouldn't add the this directory to ~/.config/users-dirs.dirs. Right now, the directories defined by g_get_user_special_dir() are defined there, but it doesn't mean all directories have to be defined there. Just add some code to find the right directory for the thumbnail cache, without looking at ~/.config/users-dirs.dirs. (just my opinion, of course)
Renaming, re-opening.
Created attachment 109642 [details] [review] patch to add G_USER_DIRECTORY_THUMBNAILS OK, new patch to add the G_USER_DIRECTORY_THUMBNAILS special dir. - Mike
Should the "thumbnails" portion of the G_USER_DIRECTORY_THUMBNAILS directory path be translatable? - Mike
(In reply to comment #14) > Should the "thumbnails" portion of the G_USER_DIRECTORY_THUMBNAILS directory > path be translatable? > > - Mike > Not without changing the thumbnail specification further (which could be brought up on the list if it's important enough). It probably should be, since that is the case with the other Base Dir members, and one of the major reasons to change the Thumbnail Spec. in this way, in my opinion of course, is to reach internal consistency. I'm not 100% sold on the UserDirectory approach either. Right now, the User Directories are non-ambiguous, highly visible directories with targets editable in $XDG_CACHE_HOME/user-dirs.dirs. By adding this, we're purposefully invalidating this assumption (which will only lead to confusion, from developers wondering why it's the Black Sheep, to users wondering why they can't configure it when they can configure the rest). I thought about this when I proposed the "g_get_user_thumbnail_dir()" name to the XDG list [by the way, thanks for doing the code-work on this Mike]; it's currently how we handle all of the other XDG defined directories (i.e. the ones outside of the User Directory realm), and it's what the consumer of the API expect. After all, the proposed thumbnail dir is really just a special case of the cache dir. In summary: it's important enough to have it's own function (especially as it must be migration aware, if and/or when the proposed change ends up happening), and it's dissimilar enough from the other GUserDirectory members that is doesn't make sense to add it there. It's a tad bit quirky, bordering close to clutter, but then again so is the whole g_get_* namespace.
> > Should the "thumbnails" portion of the G_USER_DIRECTORY_THUMBNAILS directory > > path be translatable? > > > Not without changing the thumbnail specification further (which could be > brought up on the list if it's important enough). It probably should be, since > that is the case with the other Base Dir members, and one of the major reasons > to change the Thumbnail Spec. in this way, in my opinion of course, is to reach > internal consistency. I did mention it on the list, and no one replied. So I'm inclined to make it translatable, i.e., add _("thumbnails"). Vincent is working on reconstructing the original docbook spec, and we can propose the full spec patch soon (with translation, if desired). > I'm not 100% sold on the UserDirectory approach either. Could a glib guru offer an opinion / ruling here? My original g_get_user_thumbnail_dir patch had a memory leak. I will attach a revised patch below to avoid further embarrassment. So we have two possible patches to work from... - Mike
Created attachment 109679 [details] [review] alternative approach, g_get_user_thumbnail_dir, v2
> I did mention it on the list, and no one replied. So I'm inclined to make it > translatable, i.e., add _("thumbnails"). Vincent is working on reconstructing > the original docbook spec, and we can propose the full spec patch soon (with > translation, if desired). I disagree. I do not see any user benefit, this is internal cached data, and not "obvious" user data. We'd just clutter the API docs.
I agree with Christian on this one.