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 524304 - Use XDG_USER_DATA to store the recent files
Use XDG_USER_DATA to store the recent files
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkRecent
2.20.x
Other All
: Normal enhancement
: 3.0
Assigned To: gtk-bugs
Emmanuele Bassi (:ebassi)
: 568526 (view as bug list)
Depends on:
Blocks: 523057 528035
 
 
Reported: 2008-03-25 13:33 UTC by Emmanuele Bassi (:ebassi)
Modified: 2010-10-22 11:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use XDG_USER_DATA to store the recent files (1.43 KB, patch)
2009-10-18 07:21 UTC, Javier Jardón (IRC: jjardon)
needs-work Details | Review
Use XDG_USER_DATA to store the recent files.v2 (1.30 KB, patch)
2010-05-04 02:18 UTC, Javier Jardón (IRC: jjardon)
none Details | Review

Description Emmanuele Bassi (:ebassi) 2008-03-25 13:33:05 UTC
instead of using a dotfile in $HOME, use $XDG_USER_DATA/recently-used.xbel
Comment 1 Emmanuele Bassi (:ebassi) 2008-04-14 13:45:52 UTC
the patch is part of the changeset attached to bug 528035
Comment 2 Emmanuele Bassi (:ebassi) 2009-01-22 10:45:42 UTC
*** Bug 568526 has been marked as a duplicate of this bug. ***
Comment 3 Javier Jardón (IRC: jjardon) 2009-10-18 07:21:16 UTC
Created attachment 145722 [details] [review]
Use XDG_USER_DATA to store the recent files

For the record, I've attached here the Emmanuele patch

Can this be applied?
Comment 4 Jason 2009-11-11 03:11:38 UTC
+1, hope to see this change
Comment 5 Christian Dywan 2009-11-13 13:13:31 UTC
That patch needs a check whether the "old" location was used before and copy over it the first time. ie. no "new file existant, but "old" file is there --> copy over the file, maybe delete the old file
Comment 6 Javier Jardón (IRC: jjardon) 2010-05-04 02:18:36 UTC
Created attachment 160234 [details] [review]
Use XDG_USER_DATA to store the recent files.v2

Updated patch against current master.

As this will land for GTK+3, maybe the compatibility code is not needed anymore. Thoughts?
Comment 7 Christian Persch 2010-05-04 10:28:12 UTC
Hmm. The code uses g_bookmark_file_to_file to save the file, which just uses g_file_set_contents() and thus will fail if the directory doesn't exist. (This isn't a problem right now since $HOME will very likely exist.) So the directory needs to be created with g_mkdir_with_parents(dir, 0700) before doing g_bookmark_file_to_file().
Comment 8 Emmanuele Bassi (:ebassi) 2010-05-04 11:45:45 UTC
also, it would not follow symbolic links. I think we should be using g_bookmark_file_to_data() and then GIO.
Comment 9 Jason 2010-10-05 07:49:50 UTC
would it better be placed in $XDG_CACHE_HOME?
Comment 10 Jason 2010-10-05 17:20:31 UTC
this patch not works very well... still have ~/.recently-used.xbel
Comment 11 Emmanuele Bassi (:ebassi) 2010-10-22 11:06:25 UTC
(In reply to comment #9)
> would it better be placed in $XDG_CACHE_HOME?

no, it's not a per-application cache file: it's shared among applications.
Comment 12 Emmanuele Bassi (:ebassi) 2010-10-22 11:09:56 UTC
Since we're breaking API, I just moved the default file from $HOME to $XDG_USER_DATA.
Comment 13 Christian Persch 2010-10-22 11:25:43 UTC
Re comment 11:
I don't see how XDG_CACHE_HOME is only for per-app caches? Surely global caches are appropriate for it too. The spec definition [1] of XDG_CACHE_HOME as "non-essential" user data certainly fits the recently-used file perfectly.

[1] http://standards.freedesktop.org/basedir-spec/latest/ar01s02.html:
    * There is a single base directory relative to which user-specific non-essential (cached) data should be written. This directory is defined by the environment variable $XDG_CACHE_HOME.