xdg user directory patches for xfce 4.4.2
Brian J. Tarricone
bjt23 at cornell.edu
Sun Aug 10 22:40:27 CEST 2008
On Sun, 10 Aug 2008 17:21:44 +0200 Christian Dywan wrote:
> Am Sun, 10 Aug 2008 15:40:34 +0200
> schrieb Jannis Pohlmann <jannis at xfce.org>:
> > Hey,
> > Am Sun, 10 Aug 2008 15:22:50 +0200
> > schrieb Andrea Santilli <yawara at quipo.it>:
> > > hello all,
> > > I was running xfce 4.4.2 on Fedora 9 when I noticed that it did
> > > not recognize the xdg user directories. I found this quite
> > > annoying so I filed a bug report to bugzilla
> > > (https://bugzilla.redhat.com/show_bug.cgi?id=457740)
> > > The guy there pointed me out that this features is probably going
> > > to be included in version 4.6.x and that there were no planes to
> > > backport it to the 4.4.x branch.
> > > Hence I submitted 3 patches to force xfce recognize such
> > > directories. Please could you developers point me out whether
> > > those patches are correct enough and the eventual details I
> > > forgot? I'm attaching those patches to this email too.
> > > Thank you in advance.
> > > A. Santilli
> > the main problem I see is your use of g_get_user_special_dir() which
> > was introduced with GLib 2.14. Xfce 4.6 is going to be based on GTK+
> > 2.10 and GLib 2.12, thus we cannot use that function unless it is
> > surrounded by an #ifdef GLIB_CHECK_VERSION(2,14,0).
> I suggest it should be very nice if you could implement fallback code
> for older Glib versions and manually read out ~/user-dirs.dirs
> and /etc/xdg/user-dirs.dirs. Just look at Glib for ideas, but I think
> you can make it much simpler, for instance it doesn't have to work on
> non-unix platforms.
Yeah, the unix-specific code in glib for that is under 130 lines, even
smaller if you strip out checking for all the other dirs and just look
for desktop and templates.
Probably best just to copy and paste this where needed in xfdesktop
and/or thunar. Not really worth adding to libxfce4util. Should ifdef
for glib 2.14 and use the glib-provided functions instead.
Andrea, about the patch (xfdesktop at least):
No funnyCamelCasedVariables. All lowercase, separate words by
underscores. Read xfdesktop's HACKING file if you aren't sure.
No spaces between macro/function calls and the opening paren. Again,
No need to check for NULL return on g_get_user_special_dir() when
checking for the desktop dir; glib falls back to returning ~/Desktop if
it fails to load a dir from the file. (Note that this is only true
when checking for G_USER_DIRECTORY_DESKTOP; the others can return NULL).
More information about the Xfce4-dev