After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 354887 - GtkFileChooserButton displays unnecessary authentication dialogs
GtkFileChooserButton displays unnecessary authentication dialogs
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.10.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
: 319532 328607 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-09-08 02:41 UTC by Dennis Cranston
Modified: 2007-06-17 12:03 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
Proposed patch (2.40 KB, patch)
2006-09-16 07:55 UTC, Dennis Cranston
none Details | Review
Proposed patch (2.41 KB, patch)
2006-09-16 16:32 UTC, Dennis Cranston
none Details | Review
patch (12.80 KB, patch)
2006-09-19 14:39 UTC, Matthias Clasen
committed Details | Review
Proposed patch -- use remote folder icon (3.73 KB, patch)
2006-09-22 20:42 UTC, Dennis Cranston
committed Details | Review

Description Dennis Cranston 2006-09-08 02:41:05 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.
Comment 1 Dennis Cranston 2006-09-08 02:44:16 UTC
A gtkfilechooserbutton in the gnome-panel's "Panel Properties" dialog causes the same annoyance.
Comment 2 Sebastien Bacher 2006-09-11 11:05:55 UTC
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 ***
Comment 3 Dennis Cranston 2006-09-16 07:55:51 UTC
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.
Comment 4 Dennis Cranston 2006-09-16 16:32:18 UTC
Created attachment 72904 [details] [review]
Proposed patch
Comment 5 Dennis Cranston 2006-09-16 16:34:26 UTC
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.
Comment 6 Matthias Clasen 2006-09-16 18:56:55 UTC
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.
Comment 7 Dennis Cranston 2006-09-16 19:56:05 UTC
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".
Comment 8 Matthias Clasen 2006-09-17 03:34:40 UTC
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)
Comment 9 Matthias Clasen 2006-09-17 03:38:36 UTC
We still need to get rid of the auth dialogs in non-local mode
Comment 10 Matthias Clasen 2006-09-19 14:39:10 UTC
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.
Comment 11 Federico Mena Quintero 2006-09-21 18:25:40 UTC
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.
Comment 12 Matthias Clasen 2006-09-22 17:08:40 UTC
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.
Comment 13 Wouter Bolsterlee (uws) 2006-09-22 19:41:58 UTC
Matthias, great work. Do you use a regular folder icon or a "remote folder" icon? I think the latter would be better...
Comment 14 Dennis Cranston 2006-09-22 20:42:17 UTC
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.
Comment 15 Murray Cumming 2006-10-26 17:21:08 UTC
*** Bug 319532 has been marked as a duplicate of this bug. ***
Comment 16 Murray Cumming 2006-10-26 17:31:44 UTC
*** Bug 328607 has been marked as a duplicate of this bug. ***
Comment 17 Luke Hutchison 2007-01-24 19:37:21 UTC
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?
Comment 18 Federico Mena Quintero 2007-01-25 22:12:35 UTC
Same bug.
Comment 19 Matthias Clasen 2007-06-07 22:26:10 UTC
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.
Comment 20 Xan Lopez 2007-06-17 12:03:31 UTC
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