GtkFileChooser: ACTION_SELECT_FOLDER creates folder while ACTION_OPEN doesn't create file for non-existent folder and file respectively
Hello!
For non-existent file, GTK_FILE_CHOOSER_ACTION_OPEN
doesn't create a file as expected but GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
creates a folder for non-existent folder even though a separate GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
flag exists for that very purpose.
Besides being an inconsistent behavior, this makes apps intended for read-only actions to perform write operation even when they didn't intend to write.
Example:
catfish
is a file-search tool which uses GtkFileChooser
to select folder to search. Search is a read-only operation and so aptly catfish uses GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
and not GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
.
But when I (user) made a typo while typing folder-name in location bar (Ctrl-L) a folder with that mistyped name got created immediately after Enter
.
Catfish is supposed to do a read-only job (search
) so it was completely unacceptable for me to see catfish doing write operation. Feels like application broke the user trust.
That being said, I see this comment at gtkfilechooserwidget.c:
/* In both cases (SELECT_FOLDER and CREATE_FOLDER), if you type
* "/blah/nonexistent" you *will* want a folder created.
*/
So, I feel like this has been considered already and a conscious choice has been made. Though, to be honest, I am unable to see why... (GTK newbie here! :))
Anyways, please feel free to close this issue if this has already been discussed. :) But if we decide to make the change then I would like to work on the fix. (This could be my first contribution to GTK!)