GNOME Bugzilla – Bug 354887
GtkFileChooserButton displays unnecessary authentication dialogs
Last modified: 2007-06-17 12:03:31 UTC
In a filechooser dialog, I setup a bookmark to an ssh share on another computer on my network. I have a gtkfilechooserbutton in gnome-search-tool for selecting the folder to search in. When I launch gnome-search-tool, a dialog opens asking for authentication to the ssh share. The authentication dialog should not be triggered. First, gnome-search-tool can only search from local folders. Second, the remote share isn't even in the drop down list of the gtkfilechooserbutton.
A gtkfilechooserbutton in the gnome-panel's "Panel Properties" dialog causes the same annoyance.
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of 319532 ***
Created attachment 72890 [details] [review] Proposed patch I am not sure if this is the correct approach for fixing the bug, but the patch does prevent the triggering of the authentication dialog. It works by removing non local bookmarks from the bookmarks GSList if the filechooserbutton has local only mode set. 2006-09-16 Dennis Cranston <dennis_cranston@yahoo.com> * gtk/gtkfilechooserbutton.c: (bookmark_filter), (gtk_file_chooser_button_constructor), (fs_bookmarks_changed_cb): When in "local only" mode remove non local bookmarks.
Created attachment 72904 [details] [review] Proposed patch
This bug was incorrectly marked as a duplicate of 319532. This bug pertains to the gtkfilechooserbutton widget, while bug 319532 pertains to the gtkfilechooser widget.
Hmm, ok, I may have been confused here. What I was playing around with was not bookmarks. I used the Connect to server dialog, which makes the ssh connection show up as a volume (I think) and for those, the gnome-vfs backend correctly filters the non-local ones out.
I created my bookmark using nautilus in browser mode. Nautilus then added a line to ~/.gtk-bookmarks similar to "ssh://User@192.168.0.1 Server".
2006-09-16 Matthias Clasen <mclasen@redhat.com> * gtk/gtkfilechooserbutton.c: Don't add remote volumes and bookmarks to the model in local-only mode, to avoid authentication dialogs pop up for invisible bookmarks, and to fix issues with separators not being hidden when they should. (#354887, Dennis Cranston)
We still need to get rid of the auth dialogs in non-local mode
Created attachment 73036 [details] [review] patch Here is a patch which gets rid of most unwarranted auth dialogs, but just using the "folder" icon for remote bookmarks, and constructing a label without calling gtk_file_info_get_display_name(). Some caveats: 1) It adds a new string (which is already translated in the panel) 2) The uri splitting in _gtk_file_system_label_for_uri function should really be in the filesystem implementations 3) One place where I could not avoid an auth dialog is when selecting a remote bookmark in the combobox of a file chooser button. This is because the button delegates all file chooser functions to a file chooser dialog, and the dialog _has_ to call get_info when changing the current folder. Maybe this could be avoided by making the dialog only call get_info when it is visible.
Nice patch! A few comments: * You may want to put a comment for translators near the _("%1$s on %2$s"): /* Translators: this is to display "directory on hostname", such as "Documents on anotherbox.com" */ * There's a g_print() there. Thanks for figuring this out.
2006-09-22 Matthias Clasen <mclasen@redhat.com> Make remote bookmarks work better (#354887) * gtk/gtkfilechooserdefault.c (shortcuts_reload_icons): (shortcuts_insert_path): * gtk/gtkfilechooserbutton.c (change_icon_theme): (model_add_bookmarks): (model_update_current_folder): (update_label_and_image): If the bookmark points to a remote file, don't call get_info(), since that may a) take a long time and b) pop up an auth dialog. Instead, just use a folder icon and create a display name from the uri. * gtk/gtkfilechooserdefault.c (_gtk_file_chooser_label_for_uri): New function to create a suitable display name for a remote uri. This should really be done in GtkFileSystem.
Matthias, great work. Do you use a regular folder icon or a "remote folder" icon? I think the latter would be better...
Created attachment 73244 [details] [review] Proposed patch -- use remote folder icon This patch implements the request in the previous comment to use the "remote folder" icon for remote bookmarks.
*** Bug 319532 has been marked as a duplicate of this bug. ***
*** Bug 328607 has been marked as a duplicate of this bug. ***
Just a quick observation, in case that this is not redundant: gEdit has the same problem -- if you have an authenticated share in the bookmarks and then you double-click on a local text-file, gEdit will ask you to authenticate to the share (or at least give the password to the local keyring) before it will even open the local file. The remote URI is never used. (No GtkFileChooser dialog even opens.) Is this the same bug, or shall I open a new one?
Same bug.
Small stylistic nitpick: + if (!gtk_file_system_path_is_local (button->priv->fs, path)) + { + pixbuf = gtk_icon_theme_load_icon (icon_theme, "gnome-fs-share", + button->priv->icon_size, 0, NULL); + } + else + { + pixbuf = gtk_icon_theme_load_icon (icon_theme, "gnome-fs-directory", + button->priv->icon_size, 0, NULL); + } Please remove the {} here. And I would revert the sense of the condition, to avoid the !. Other than that, it looks good.
Committed to trunk with matthias comments fixed. 2006-09-22 Dennis Cranston <dennis_cranston@yahoo.com> * gtk/gtkfilechooserbutton.c: (change_icon_theme), (model_add_bookmarks), (model_update_current_folder): * gtk/gtkfilechooserdefault.c: (shortcuts_reload_icons), (shortcuts_insert_path): Use the remote folder icon when appropriate. Follow up to #354887