Default Location in GTK+ File Chooser

Today I finally got annoyed enough with Ubuntu's GTK+ defaulting my file choosers to $HOME/Documents rather than $HOME. I can see how this would be useful, but Documents contains a few files, whereas I generally want to get into ~/Pictures, or ~/Programming. Luckily sebuild saves the day, by telling me about GTK_DEFAULT_FILECHOOSER_DIR. One quick export later:

export GTK_DEFAULT_FILECHOOSER_DIR=$HOME

And voilà, it works. Now please can the comments section of this post not turn into a new GTK file chooser sucks arse d000dz old one r0xkkz. You try explaining to a non-geek why parent folder is .., and why . is in the folder list at all.

NP: Songs In The Key Of Life, Stevie Wonder

12:30 Monday, 20 Feb 2006 [#] [computers] (11 comments)

Posted by emmanuel at Mon Feb 20 13:07:59 2006:
in which file do you put the export so that it's run before the GUI appears, and that it applies just for one user?
Posted by Ross at Mon Feb 20 13:12:45 2006:
I've got it in ~/.profile, but it depends on your login scripts.
Posted by Arne at Mon Feb 20 14:02:52 2006:
I think GNOME needs a preferences page to set environment variables for a session.

For example PKG_CONFIG_PATH, PATH and even LD_LIBRARY_PATH are variables that often need to be set but it is hard to tell where.

For me only setting them in ~/.xsession seemed to work correctly, otherwise they would not be in effect at all places ( ie. applications started via the Application menu or from the panel ).
Posted by Ross at Mon Feb 20 14:11:36 2006:
Arne, setting PATH, LD_LIBRARY_PATH etc won't work if the intended goal is to run a custom-compiled GNOME.  How can GNOME set them if the GNOME you want to use is in the custom path...

Setting them in .xsession is the correct and canonical place for X-wide environment variables.  My .xsession and .bash_profile both source .profile, which has common variables.
Posted by Sam Morris at Mon Feb 20 14:21:21 2006:
Is the behaviour of the file chooser defaulting to ~/Documents due to an Ubuntu-specific patch?
Posted by Julian Turner at Mon Feb 20 14:49:36 2006:
Doesn't the whole ~/Documents thing bring up new problems with internationalisation? Is this folder automatically created on a fresh install? If it's called "Documents" in all languages, it's interesting that Ubuntu ships "improvements" that go against the Ubuntu Manifesto.
Otherwise, sorry for making wrong assumptions.
Posted by zdzichu at Mon Feb 20 14:49:37 2006:
Lucky you. On my system fileselector used by GIMP defaults to ~/.gconfd (sic!) everytime. Other apps seem to default to ~ or last used folder. Totally random.
Posted by Ross at Mon Feb 20 14:55:56 2006:
Defaulting to ~/Documents is an Ubuntu patch, yes.  On upstream GTK+ Documents isn't a special folder and doesn't appear in the file chooser sidebar either.  I've no idea how the patch handles i18n, which is why there isn't anything like this upstream.
Posted by Arne at Mon Feb 20 15:11:48 2006:
Ross:
I do not meant that GNOME should set them but it should offer a dialog to put them into the correct files. ( Much like the environment variables dialog in Windows ).
Posted by Ross at Mon Feb 20 15:15:27 2006:
Arne, how would it know where to put them?  I use .profile, you are using .xsession.  Someone else may not use gdb and want them in .bash_profile.  zsh won't be parsing .bash_profile of course.

I also don't believe this should be in GNOME as a typical GNOME user will never use it.  That doesn't stop someone writing this app using GTK+ however.
Posted by Decklin Foster at Tue Feb 21 02:24:34 2006:
Ooh, useful. I have been trying to re-train myself to use ~/mess/current for the "everything else" bin instead of $HOME.

Name:


E-mail:


URL:


Add 2 and 6 (required):


Comment: