GNOME Bugzilla – Bug 351063
Overwrite confirmation does not appear if file not selected in list
Last modified: 2006-08-14 16:38:39 UTC
In gtk+ FileChooser, in save mode, I call set_do_overwrite_confirmation(True). Now the file chooser confirms overwrite only when I activate a row in the treeview widget. It doesn't give the least warning if I _type_ a file name equal to an existing file and press enter with the gtk.Entry having focus.
The bug seems to be around function gtk_file_chooser_default_should_respond in gtkfilechooserdefault.c: Around line 7565 there's: check_save_entry (impl, &path, &is_well_formed, &is_empty, &is_file_part_empty, &is_folder); if (is_empty || !is_well_formed) return FALSE; g_assert (path != NULL); error = NULL; if (is_folder) { [...] } else { gboolean file_exists_and_is_not_folder; file_exists_and_is_not_folder = g_error_matches (error, GTK_FILE_SYSTEM_ERROR, GTK_FILE_SYSTEM_ERROR_NOT_FOLDER); Clearly there's something missing here. check_save_entry() appears to do a file test, among other things. Then we have 'error = NULL', followed by an if (is_folder); the file is not a folder, so the else branch is executed, containing: file_exists_and_is_not_folder = g_error_matches (error, GTK_FILE_SYSTEM_ERROR, GTK_FILE_SYSTEM_ERROR_NOT_FOLDER); But error is always NULL, so file_exists_and_is_not_folder is always FALSE. I don't know the original code, but I suspect error should have been set by check_save_entry before some code refactoring that went wrong.
Yeah, that code got broken with the changes to make the file chooser asynchronous. We have a test in autotestfilechooser; I need to finish fixing the bug :) [It's partly an API problem with GtkFileChooserEntry - fortunately we can change it since it's only an internal widget.] *** This bug has been marked as a duplicate of 347883 ***