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 578482 - Need for more user dirs
Need for more user dirs
Status: RESOLVED WONTFIX
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2009-04-09 13:13 UTC by Christian Dywan
Modified: 2017-11-16 10:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Implement g_get_user_named_dir (6.19 KB, patch)
2009-04-16 15:52 UTC, Christian Dywan
none Details | Review

Description Christian Dywan 2009-04-09 13:13:03 UTC
On Maemo there are a number of special directories, such as Sounds, Documents, Images and Videos. The platform doesn't currently make use of the freedesktop specification for user dirs. A major stumbling block is this: the standardized directory names are not enough to map Maemo's special directories.
For instance "Games" is for the sake of this example a folder containing save games. If an application on Maemo wanted to use g_get_user_special_dir () it would have no way of looking up the "Games" folder. As far as I can see, it's not possible to extend the available directory names. unless Glib is modified.

Would it make sense to add support for more special folders?

Would it make sense to add a way to add additional folders, for example by means of a function that might be called g_get_user_special_dir_from_string and Glib would actually read folder names from a certain file.
Comment 1 Christian Dywan 2009-04-16 15:52:28 UTC
Created attachment 132768 [details] [review]
Implement g_get_user_named_dir

This implements g_get_user_named_dir which takes the string as found in user-dirs.dirs as argument, ie. "XDG_DESKTOP_DIR". Au contraire to g_get_user_special_dir any string found in the user-dirs.dirs is supported.

The strings are stored in a hash table, separate from the already existing dirs.

I wonder, should the signature be non-const, to allow for updating the values at runtime? File monitoring could be added.
Unfortunately this won't work for g_get_user_special_dirs since it's const.
Comment 2 Mathias Hasselmann (IRC: tbf) 2009-04-28 11:03:59 UTC
Maybe it would better to stay with g_get_user_special_dir(),
but make GUserDirectory extensible like GtkIconSize:

GUserDirectory
g_user_special_dir_register (const gchar *name);

This would allow platforms like Maemo or Suggar to safely provide additional GUserDirectory constants.
Comment 3 Philip Withnall 2017-11-16 10:41:09 UTC
Maemo is dead, and with it the motivation for this patch. If other platforms want to try something similar in future, I would only really be open to adding new API for them in GLib if they expand the spec to cover their use case.