GNOME Bugzilla – Bug 162358
GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER doesn't allow selection of existing folders
Last modified: 2011-02-04 16:18:28 UTC
In the GTK+ 2.0 API docs the GtkFileChooserAction GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER is described as: "Indicates a mode for creating a new folder. The file chooser will let the user name an existing or new folder." It seems however that the chooser will not allow the user to select an exisitng folder. If a folder is selected in the view and the open button clicked the chooser simply descends into that folder, and if the folder is not selected but instead named in the name field, the same occurs, the chooser descends into the exisitng folder instead of allowing it to be selected.
Created attachment 36412 [details] testcase Opens up a folder chooser which demonstrates the behaviour of this bug
If this bug is fixed the current behaviour of the folder chooser can be emulated by using a custom filter which will only allow the selection of empty folders. This would afford the user more flexibility as she can create the folder by other means, eg in Nautilus, and then select it using this widget.
As it seems, CREATE_FOLDER doesn't work at all in 2.6.2, when I click on existing folder it descends, and when I'm already in a folder, clicking OK doesn't close the dialog. Entering name also doesn't seem to work, it makes FileChooser closable, and return the current folder + name entered appended when asked with _get_filename(), however it doesn't create the folder, so name returned is actually bogus (unless I misunderstood the specification in this mode). Marking as major, as CREATE_FOLDER is basically does not perform its function at all (it requires substantial cooperation from user to get it to even close)
This is related to bug #166836. I'll have a fix shortly.
In response to #3, CREATE_FOLDER is the analogon to SAVE. SAVE doesn't create the file either.
I'm working on this; I'll have a fix shortly.
Federico, whats the status of this ?
Created attachment 47520 [details] [review] Patch which fixes this and some annoyances with autocompletion This is the patch; I've committed it to gtk-2-6 and HEAD.
2005-06-09 Federico Mena Quintero <federico@ximian.com> Fixes #162358: * gtk/gtkfilechooserdefault.c (update_chooser_entry): Don't return immediately if we are in CREATE_FOLDER mode, so that we can fill the entry with the newly-selected folder. (gtk_file_chooser_default_set_property): Warn against turning on multiple selection for CREATE_FOLDER mode, or about setting that action while multiple selection is on. (update_chooser_entry): Change the entry's contents as well if we are in CREATE_FOLDER mode. If nothing is selected, clear the chooser entry. (trap_activate_cb): Don't trap enter/space if modifiers are pressed. This lets one use Ctrl-space to toggle rows in multiple selection mode. (gtk_file_chooser_default_should_respond): Clean up the if-chain mess of special cases by using an array to determine what to do. Also, for the save-entry case in CREATE_FOLDER mode, actually fix the bug where the file chooser would switch to an existing folder rather than confirming with it, and create the folder ourselves. (error_creating_folder_over_existing_file_dialog): New function. * gtk/gtkfilechooserentry.c (check_completion_callback): Only insert the common prefix if we are in an "open" mode. Use a helper function. (append_common_prefix): New helper function; code moved over from check_completion_callback(). (find_common_prefix): New helper function. (gtk_file_chooser_entry_focus): Append the common prefix if the user requests it explicitly.
*** Bug 315424 has been marked as a duplicate of this bug. ***