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 325544 - GtkFileChooserButton to allow custom "special" path
GtkFileChooserButton to allow custom "special" path
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.8.x
Other All
: Normal enhancement
: Small API
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2006-01-02 20:15 UTC by Steve Frécinaux
Modified: 2013-09-23 20:58 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Steve Frécinaux 2006-01-02 20:15:02 UTC
A very useful feature for GtkFileChooserButton would be to allow application
developpers to specify "special path", like "current path" (no matter what the
path really is).

Here is an use case:

I need to set up some shell commands to run on a document in gedit. Those would
be presented as a menu, and I want to set up the working directory for each
command. This directory can be either a predefined directory, or the document
path, no matter where the document is stored (/home/sf/foo/ or /etc/X11/xorg.conf).

What I have to do is to put a GtkCheckButton beside the GtkFileChooserButton to
trigger the "current document directory" special value. This clutter the
interface and what it does is not very obvious.

What I would prefer is to add a special (non browsable) path "Current document
directory" to the GtkFileChooserButton list. (This could be identified by a
special icon to be more discoverable)
Comment 1 Federico Mena Quintero 2007-01-25 16:56:27 UTC
We need a proposed API and implementation.
Comment 2 Michael Terry 2009-06-09 20:27:14 UTC
Just FYI, it's possible to hack this together today.  Emphasis on hack.  I've done this for a program I have.

(A) Create your own file chooser dialog and pass it to the button upon creation.
(B) Create a "/tmp/XXXXXX/Current Document Directory" folder and add it to the button as a shortcut folder.  Delete this folder when you're done.
(C) When the dialog you own is shown (via Other...) and your special folder was last selected, remove the shortcut folder and set the location to something like $HOME.  When the dialog is hidden again, add the shortcut folder back.  This avoids exposing the /tmp directory.
(D) Just check if the value the user selects is your special folder.

Tada!  Gross as hell, and you can't control the icon, but it works.
Comment 3 Federico Mena Quintero 2013-09-23 20:58:28 UTC
No API proposal was presented, so I'll close this as obsolete.