GNOME Bugzilla – Bug 382479
gtk_file_chooser_set_current_folder() returns TRUE and causes error popup when path doesn't exist
Last modified: 2018-05-02 14:24:19 UTC
According to the docs for gtk_file_chooser_set_current_folder(), it will return FALSE if the folder couldn't be changed successfully. The function currently returns TRUE if the new folder doesn't exist. I'm not sure if this may be by design; it will fall back to the parent directory and eventually the root directory, but I believe that it should still return FALSE because it didn't set the requested directory. If this is the desired behavior, when would the function actually return FALSE? In addition to this (and more importantly), a blocking error dialog which says "The folder contents could not be displayed" is displayed. The detail text is "Error getting information for '/usr/nonexistent': The system cannot find the path specified." Until this dialog is dismissed, the main loop will not be iterated. This can easily be recreated with testfilechooser.exe from gtk+/tests by simply clicking on the 'set_current_folder("/usr/nonexistent")' button.
Probably related to bug 436429
*** Bug 436429 has been marked as a duplicate of this bug. ***
Yes, both _folder() and _folder_uri() return the result of IFACE->get_current_folder() via set_current_folder_file()
which in the common case, ultimately returns the result of gtk_file_chooser_widget_update_current_folder() - and that just unconditionally returns TRUE... with only the following comment to hint at a better way: > [5601] /* Test validity of path here. */ (In reply to Daniel Atallah from comment #0) > [...] but I believe that it should still return > FALSE because it didn't set the requested directory. If this is the desired > behavior, when would the function actually return FALSE? It does return false if :local-only is TRUE and you try to set a non-local path. But obviously that is not sufficient.
*** Bug 432904 has been marked as a duplicate of this bug. ***
-- 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/273.