Hi all,

I'd like to propose an extension to the current xdg-user-dirs mechanism to
make it possible to create application-specific subdirectories in user
dirs, which are subject to the same translation rules applied to their
parents.

Use cases:
* An application (e.g. a sound recorder) wants to save a file in a
subdirectory of $XDG_MUSIC_DIR. Another sound recorder wants to save files
in the same subdirectory, and doesn't want to worry about the translations
for each language to be in sync.

* A photo booth application wants to save pictures to a webcam snaps
subdirectory of $XDG_PICTURES_DIR. An "user properties" settings panel in
the desktop environment allows to pick an avatar picture through a file
chooser, which should default to the webcam snaps place.

There's a bunch of similar cases, which you can find in this bug [1] where
this message originates from.

Implementation:
We need a way for applications to describe and own those subdirectories
inside XDG user dirs. I think this could be as simple as the application
dropping a desktop file on installation, in a well-known directory - for
example $XDG_DATA_DIRS/xdg-user-dirs. Such a desktop file would have a
structure like

[Directory]
Name=Webcam Snapshots
Name[it]=Scatti dalla Webcam
Name[es]=...
Name[fr]=...
Parent=$XDG_PICTURES_DIR
Icon=icon-name-from-theme (optional)

An utility like xdg-user-dirs-update would then take care of renaming such
directories early at login, together with their parents. Toolkit support
would be achieved with a function that returns the full path of a
subdirectory given the basename of its desktop file descriptor.

In the example above, if the file is called "gnome-webcam.desktop", a GNOME
application would call g_get_user_special_dir_for_id
("gnome-webcam.desktop"); which would return "$HOME/Pictures/Webcam
Snapshots" in English and "$HOME/Immagini/Scatti dalla Webcam" in Italian.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=712245

Feedback welcome!
Cosimo
_______________________________________________
xdg mailing list
xdg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xdg

Reply via email to