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 612235 - User cannot clear chosen file.
User cannot clear chosen file.
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
filechooser-retest-and-triage
: 760699 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-03-08 21:07 UTC by David Woodhouse
Modified: 2018-05-02 14:52 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description David Woodhouse 2010-03-08 21:07:47 UTC
In my VPN client configuration (in NetworkManager-openconnect), I have an _optional_ CA certificate file option.

When you start off, it says (None) and no file is selected.

If you select a file, there seems to be no way to get back to that original, empty, state.

I could put a separate 'clear' button into the UI which will clear the contents of the file chooser, but that sucks.

Please advise.
Comment 1 Federico Mena Quintero 2010-03-08 21:46:21 UTC
A "Clear" button seems to be the existing practice.  It's what (e.g.) Evolution does to let you add/remove icons to categories.  You can use gtk_file_chooser_unselect_all() on the GtkFileChooserButton, and it will go back to saying "None".  See bug #563010 for discussion about this.

The file chooser button *could* have an API to make it show an extra "None" option in a drop-down menu, and/or an "I don't want anything" button in the dialog.  Proposals/patches welcome :)
Comment 2 David Woodhouse 2010-03-09 00:18:14 UTC
It's kind of fuckeder than that.

If you go to edit a VPN connection where a file is already set (i.e. we've called gtk_file_chooser_set_filename()) to set it to something non-empty), then the user _can_ clear it to read '(None)' by clicking to open the file chooser, then hitting cancel. However, the 'selection-changed' callback doesn't get invoked. But if the user then changes something _else_, then the new configuration does actually get saved.

This only works once, though. Once the user selects a file through the UI, the trick of opening the file dialog and then hitting 'cancel' will no longer work. Until we destroy the window and start again.
Comment 3 Federico Mena Quintero 2010-03-09 02:21:38 UTC
Clearing the button by hitting Cancel should not happen.  That's a bug.

As for "only works once", this sounds like a bug we had where the file chooser button had an incorrect idea of what state it was in... sadly I don't remember the exact bug.

I don't have time to work on this right now; do you think you could track it down?
Comment 4 Daniel Boles 2018-04-16 09:30:45 UTC
*** Bug 760699 has been marked as a duplicate of this bug. ***
Comment 5 Daniel Boles 2018-04-16 09:32:21 UTC
There IS a way to do this: Simply hold the Ctrl key and click on the folder again. (This does not depend on multiple-selection mode.)

That is easy and intuitive enough to me, though I appreciate that may not be the same for other users who don't use keynav so preferentially.
Comment 6 GNOME Infrastructure Team 2018-05-02 14:52:48 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/332.