After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 528749 - add G_USER_DIRECTORY_THUMBNAILS
add G_USER_DIRECTORY_THUMBNAILS
Status: RESOLVED WONTFIX
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2008-04-18 14:04 UTC by Michael Chudobiak
Modified: 2008-11-28 21:43 UTC
See Also:
GNOME target: ---
GNOME version: 2.23/2.24


Attachments
add g_get_user_thumbnail_dir function (2.21 KB, patch)
2008-04-18 14:05 UTC, Michael Chudobiak
none Details | Review
patch to add G_USER_DIRECTORY_THUMBNAILS (2.61 KB, patch)
2008-04-21 18:19 UTC, Michael Chudobiak
none Details | Review
alternative approach, g_get_user_thumbnail_dir, v2 (2.29 KB, patch)
2008-04-22 11:54 UTC, Michael Chudobiak
none Details | Review

Description Michael Chudobiak 2008-04-18 14:04:50 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
Comment 1 Michael Chudobiak 2008-04-18 14:05:38 UTC
Created attachment 109487 [details] [review]
add g_get_user_thumbnail_dir function
Comment 2 Martin Meyer 2008-04-18 14:58:52 UTC
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.
Comment 3 Vincent Untz 2008-04-18 17:24:10 UTC
Doesn't it make sense to use g_get_user_special_dir() for this? Just define a new GUserDirectory.
Comment 4 Michael Chudobiak 2008-04-18 17:49:39 UTC
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
Comment 5 Michael Chudobiak 2008-04-18 19:08:49 UTC
Where in gnome are the xdg special dirs defined, anyways? (Not the enum, I see that - I mean path strings like "Pictures").

- Mike
Comment 6 Sven Neumann 2008-04-18 20:57:33 UTC
This is defined in .config/user-dirs.dirs and managed by the xdg-user-dirs tool.
Comment 7 Vincent Untz 2008-04-18 21:10:47 UTC
(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.
Comment 8 Michael Chudobiak 2008-04-21 12:52:05 UTC
OK, you are probably right. I'll investigate the special dir approach further.

- Mike
Comment 9 Michael Chudobiak 2008-04-21 15:23:06 UTC
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
Comment 10 Martin Meyer 2008-04-21 17:10:18 UTC
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?
Comment 11 Vincent Untz 2008-04-21 17:17:29 UTC
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)
Comment 12 Michael Chudobiak 2008-04-21 18:18:35 UTC
Renaming, re-opening.
Comment 13 Michael Chudobiak 2008-04-21 18:19:23 UTC
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
Comment 14 Michael Chudobiak 2008-04-21 18:20:30 UTC
Should the "thumbnails" portion of the G_USER_DIRECTORY_THUMBNAILS directory path be translatable?

- Mike
Comment 15 A. Walton 2008-04-22 02:00:34 UTC
(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.
Comment 16 Michael Chudobiak 2008-04-22 11:53:39 UTC
> > 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
Comment 17 Michael Chudobiak 2008-04-22 11:54:23 UTC
Created attachment 109679 [details] [review]
alternative approach, g_get_user_thumbnail_dir, v2
Comment 18 Christian Neumair 2008-05-26 20:23:14 UTC
> 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.
Comment 19 Matthias Clasen 2008-07-18 18:55:59 UTC
I agree with Christian on this one.