GNOME Bugzilla – Bug 379414
file chooser warnings when changing path in the entry
Last modified: 2011-02-04 16:10:35 UTC
Hi!, if I change the path in the filechooser entry in testfilechooser, I pretty consistently get this warning: (lt-testfilechooser:29400): Gtk-WARNING **: idle activate multiple times without clearing the folder object first. I've been tracing the error, and here are the steps that cause this error 1) run testfilechooser in ~/foo/bar/gtk+/tests/ 2) type another path (say /usr/share/) and press enter 3) gtk_file_chooser_entry_maybe_update_directory is called (twice) as the result of the "changed" signal being emitted in the entry (when clearing its contents, it's worth noting that the directory it's trying to load here is ~/foo/bar/gtk+/tests, not /usr/share/, because the current folder hasn't still changed) 4) load_directory_callback is called once, the idle is only added the first time in step 3. 5) gtk_file_chooser_entry_maybe_update_directory is called again, this time as a result of calling _gtk_file_chooser_entry_set_base_folder when changing the base directory to /usr/share/. 6) load_directory_get_folder_callback is called when the *old* folder is loaded, this handler is a result of step 4. 7) load_directory_callback is called once again (as a result of step 5), but current_folder is already not NULL and fails. 8) despite being in /usr/share/, the entry completion shows matches from ~/foo/bar/gtk+/tests/ I'm attaching a patch to fix it in GtkFileChooserDefault, it clears the entry after setting its base folder if it's told so (avoiding reloading the old directory) , and makes the code use that wherever necessary.
Created attachment 77160 [details] [review] patch
*** Bug 341890 has been marked as a duplicate of this bug. ***
Thanks for the patch! I'll test and review it soon. Can you please provide a ChangeLog?
Doh! didn't realize of your answer :), Here's the ChangeLog: * gtk/gtkfilechooserdefault.c (struct UpdateCurrentFolderData), (update_current_folder_get_info_cb): add a new struct field to clear the file entry after the current folder has been updated. (gtk_file_chooser_default_update_current_folder), (change_folder_and_display_error): Add a new function parameter to trigger file entry clearing. (edited_idle_create_folder_cb), (file_list_drag_data_received_get_info_cb), (gtk_file_chooser_default_map), (gtk_file_chooser_default_set_current_folder), (switch_to_selected_folder), (save_entry_get_info_cb), (shortcuts_activate_volume_mount_cb), (shortcuts_activate_volume), (shortcuts_activate_get_info_cb), (list_row_activated), (path_bar_clicked): use new function parameter appropriately. (gtk_file_chooser_default_should_respond): trigger file entry clearing after the directory is updated instead of clearing it before, this way we avoid reloading the completion model with the soon to be old folder, causing a warning and a glitch in the folder where completion happens. Bug #379414.
Federico, please take a look at this again :-)
are bug 390314, bug 408675 and bug 350988 duplicates?
Federico, any update ?
Comment on attachment 77160 [details] [review] patch Nice work! Please go ahead and commit with that ChangeLog.
2007-05-01 Matthias Clasen <mclasen@redhat.com> Merge from trunk: * gtk/gtkfilechooserdefault.c (struct UpdateCurrentFolderData), (update_current_folder_get_info_cb): add a new struct field to clear the file entry after the current folder has been updated. (gtk_file_chooser_default_update_current_folder), (change_folder_and_display_error): Add a new function parameter to trigger file entry clearing. (edited_idle_create_folder_cb), (file_list_drag_data_received_get_info_cb), (gtk_file_chooser_default_map), (gtk_file_chooser_default_set_current_folder), (switch_to_selected_folder), (save_entry_get_info_cb), (shortcuts_activate_volume_mount_cb), (shortcuts_activate_volume), (shortcuts_activate_get_info_cb), (list_row_activated), (path_bar_clicked): use new function parameter appropriately. (gtk_file_chooser_default_should_respond): trigger file entry clearing after the directory is updated instead of clearing it before, this way we avoid reloading the completion model with the soon to be old folder, causing a warning and a glitch in the folder where completion happens. (#379414, Carlos Garnacho)