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 319532 - GtkFileChooserButton requests keyring access unnecessarily
GtkFileChooserButton requests keyring access unnecessarily
Status: RESOLVED DUPLICATE of bug 354887
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.8.x
Other All
: Normal major
: ---
Assigned To: Lorenzo Colitti
Federico Mena Quintero
: 168020 309907 315420 321242 327466 332641 334210 339962 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-10-23 14:04 UTC by steven
Modified: 2006-10-26 17:30 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
patch v1 (1.18 KB, patch)
2006-05-02 16:04 UTC, Lorenzo Colitti
needs-work Details | Review
patch v2 (1.67 KB, patch)
2006-05-02 16:31 UTC, Lorenzo Colitti
none Details | Review
patch v2 with fixed end profile message (1.68 KB, patch)
2006-05-02 16:47 UTC, Lorenzo Colitti
needs-work Details | Review
patch addressing Federico's comments (2.24 KB, patch)
2006-05-02 21:25 UTC, Lorenzo Colitti
accepted-commit_now Details | Review
final patch (2.29 KB, patch)
2006-05-03 09:27 UTC, Lorenzo Colitti
none Details | Review
More places where keyring access is required (2.78 KB, patch)
2006-05-13 23:21 UTC, Gary Coady
none Details | Review

Description steven 2005-10-23 14:04:22 UTC
Please describe the problem:
I bookmarked to sftp folders with nautilus for my laptop. now whenever i try to
use file open dialog from any gnome app, it tried to access those bookmarked
folders as well by requesting the access to the keyring. this is annoying
because those sftp folders are not always accessible and most of the time i just
want to open the files in the local disk anyway. especially when i dont have
access to the internet, the mere action of opening a dialog takes ages,
presumably because the app is trying to access the sftp folders and got no
response from it.

Steps to reproduce:
eg. 
1. fire up totem
2. click add file bottom
3. 


Actual results:
dialog popup requesting access to keyring, and when there's no access to the
network folders, the app freezes for 1 or 2 mins before the file selector dialog
pop out.

Expected results:
do not access the network folders when i dont request it.

Does this happen every time?
yes

Other information:
Comment 1 Christian Kirbach 2005-11-01 21:00:34 UTC
Hmm yes I can see similar behaviour when I run gnome-screenshot ...
probably not the app, but maybe the save dialogue or gnome-vfs tries to access 
the volumes that are in the "Places" menu. As it constantly keeps asking for the 
password and/or permission to access the keyring, this *is* annoying.

I have been told there must be a duplicate...
Comment 2 Christian Kirbach 2005-11-01 21:16:21 UTC
I cannot find a duplicate for now.

this certainly is not nautilus as it happens with screenshot as well.
and when trying to open a file with gedit.

Confiming anyways and setting this to gnome-vfs as I assume this is the most 
suitable product to file agains.
Comment 3 Christian Kellner 2005-12-01 08:11:28 UTC
Nope this is a file chooser thingy.
Comment 4 Christian Neumair 2005-12-09 20:31:24 UTC
gicmo: Maybe you could be a bit more precise? What's the issue here? Will it be
fixed when we have an async GtkFileChooser?
Comment 5 Christian Kirbach 2005-12-09 21:49:19 UTC
Raising severity as this is extremely user visible.
Comment 6 Federico Mena Quintero 2006-01-19 00:57:43 UTC
(In reply to comment #4)
> gicmo: Maybe you could be a bit more precise? What's the issue here? Will it be
> fixed when we have an async GtkFileChooser?

This is not just an issue of asynchronicity, unfortunately.  The file chooser essentially needs to stat() a file in order to get its icon.  We should distinguish remote URIs and just provide a generic icon for them (optionally, loading the "real" icon as a second stage, and being careful not to prompt for auth in that case --- I'm not sure how that would be done).
Comment 7 Lorenzo Colitti 2006-04-18 23:47:09 UTC
*** Bug 332641 has been marked as a duplicate of this bug. ***
Comment 8 Lorenzo Colitti 2006-04-18 23:47:20 UTC
*** Bug 321242 has been marked as a duplicate of this bug. ***
Comment 9 Lorenzo Colitti 2006-04-18 23:51:50 UTC
This is massively annoying. I find myself doing all sorts of strange things just to avoid opening file choosers coming up, because whenever I do the app hangs for 20-30 seconds trying to check all my bookmarks.

A quick hack could be just to provide a generic icon for any bookmark that's not a file:/// url, as suggested in comment #6. Federico, any pointers to code to look at in the hope of hacking up a quick fix? 
Comment 10 Federico Mena Quintero 2006-04-19 00:04:48 UTC
(In reply to comment #9)

> A quick hack could be just to provide a generic icon for any bookmark that's
> not a file:/// url, as suggested in comment #6. Federico, any pointers to code
> to look at in the hope of hacking up a quick fix? 

Look at gtk+/gtk/gtkfilechooserdefault.c:shortcuts_insert_path().  Find out exactly where inside that function we block (it could be in the call to get_file_info() or gtk_file_system_render_icon()).  Put an "if (!gtk_file_system_path_is_local ())" where appropriate.  Don't put it inside gtk_file_system_render_icon() itself; that's a generic function --- the special case needs to be in shortcuts_insert_path().

You'll also want to tweak shortcuts_reload_icons() in that file as well.
Comment 11 Daniel Holbach 2006-04-19 06:10:55 UTC
Mentioned in https://launchpad.net/distros/ubuntu/+source/libgnomeui/+bug/35027 as well.
Comment 12 Lorenzo Colitti 2006-05-01 15:37:36 UTC
Ok, so it seems that we're hitting the network in all of check_is_folder(), get_file_info(), and gtk_file_system_render_icon(). I'm tempted to hack up a patch that doesn't hit the network at all and just displays a stock icon if the path is remote.
Comment 13 Federico Mena Quintero 2006-05-02 15:36:34 UTC
(In reply to comment #12)
> Ok, so it seems that we're hitting the network in all of check_is_folder(),
> get_file_info(), and gtk_file_system_render_icon(). I'm tempted to hack up a
> patch that doesn't hit the network at all and just displays a stock icon if the
> path is remote.

Yes, that would be lovely.  We can put this patch in the 2.8 branch, as the file chooser is fully asynchronous in HEAD now.
Comment 14 Lorenzo Colitti 2006-05-02 16:04:06 UTC
Created attachment 64672 [details] [review]
patch v1

If the file is not a local file, this patch just renders the icon for / . Originally I had done:

GtkWidget *image = gtk_image_new_from_stock(GTK_STOCK_DIRECTORY, impl->icon_size);
pixbuf = gtk_widget_render_icon (GTK_WIDGET (image), GTK_STOCK_DIRECTORY, impl->icon_size,

but this looks very wrong, and moreover the icon size it displayed wasn't correct. I haven't done shortcuts_reload_icons() yet. Patch for that hopefully coming up soon.
Comment 15 Lorenzo Colitti 2006-05-02 16:31:51 UTC
Created attachment 64674 [details] [review]
patch v2

Better patch. It eliminates all delays and theme switching works too.

Federico, could you take a look?

(Note: patch is against the GTK 2.8.17 tarball; I don't have a branch tree here.)
Comment 16 Lorenzo Colitti 2006-05-02 16:47:13 UTC
Created attachment 64675 [details] [review]
patch v2 with fixed end profile message

Cosmetic change: fix end profile message
Comment 17 Federico Mena Quintero 2006-05-02 18:46:36 UTC
+	    if(! gtk_file_system_path_is_local (impl->file_system, path))
+	      path = "/";

You want

  path = gtk_file_system_filename_to_path (fs, "/");

  ...

  gtk_file_path_free (path);

Please use this spacing:

  if (!gtk_blah ())

instead of

  if(! gtk_blah ())

You can't pass "/" to gtk_file_system_render_icon(); it has to be a GtkFilePath.

Can you please use g_filename_display_basename() instead of the g_strrstr() thing?
Comment 18 Lorenzo Colitti 2006-05-02 21:25:32 UTC
Created attachment 64692 [details] [review]
patch addressing Federico's comments
Comment 19 Federico Mena Quintero 2006-05-03 01:18:40 UTC
Sweet, thanks!  Can you please commit this to the gtk-2-8 branch with a suitable ChangeLog?
Comment 20 Lorenzo Colitti 2006-05-03 09:27:09 UTC
Created attachment 64729 [details] [review]
final patch

Same as previous one, plus fix 2 compilation warnings:

+-          const GtkFilePath *path;
++          GtkFilePath *path;

-+        label_copy = g_filename_display_basename(path);
++        label_copy = g_filename_display_basename((char *)path);
Comment 22 Sebastien Bacher 2006-05-12 11:08:59 UTC
note than the GtkFileChooserButton has the same issue which makes you still get lot of authentification dialog when opening many properties dialogs by example (the panel properties is an example)
Comment 23 Gary Coady 2006-05-13 23:21:17 UTC
Created attachment 65408 [details] [review]
More places where keyring access is required

There are more places where network access is required:
change_icon_theme, model_add_bookmarks, test_if_path_is visible, all in filechooserbutton.c

Here's an initial version of a patch to remove the network requests.

Places where this network access can be seen (after a networked location is bookmarked):
gnome-screenshot
gnome-terminal (Edit->Current Profile...)
Comment 24 Sebastien Bacher 2006-05-18 22:49:06 UTC
Reopening and reassigning to GTK since the patch is for it.

Frederico what with GTK 2.10 the fileselector is asynchronous, but you still get the password dialogs when it then? 
Comment 25 Federico Mena Quintero 2006-05-19 03:03:17 UTC
Yeah, it's async, but even those requests may require authentication.

I think we should just not try to get data for remote URIs in the bookmarks list.  Just display a default icon for them.
Comment 26 Christian Kirbach 2006-06-29 14:36:55 UTC
*** Bug 334210 has been marked as a duplicate of this bug. ***
Comment 27 Sebastien Bacher 2006-08-04 12:53:37 UTC
*** Bug 339962 has been marked as a duplicate of this bug. ***
Comment 28 Sebastien Bacher 2006-08-04 12:55:26 UTC
*** Bug 315420 has been marked as a duplicate of this bug. ***
Comment 29 Christian Neumair 2006-08-04 21:23:54 UTC
*** Bug 327466 has been marked as a duplicate of this bug. ***
Comment 30 Christian Neumair 2006-08-05 09:18:50 UTC
Ubuntu uses http://people.ubuntu.com/~seb128/009_other_no_io_for_network_bookmark.patch
Comment 31 Sebastien Bacher 2006-08-05 22:39:38 UTC
Christian, that patch is already attached to bugzilla
Comment 32 Sebastien Bacher 2006-09-11 11:05:55 UTC
*** Bug 354887 has been marked as a duplicate of this bug. ***
Comment 33 Dennis Cranston 2006-09-16 08:01:29 UTC
In bug 354887, I attached the patch that I am using to avoid the authentication dialogs from popping up if "local only" mode has been set.
Comment 34 Matthias Clasen 2006-09-16 14:10:50 UTC
Hmm, I'm confused here. I don't see authentication dialogs pop up when 
I open a filechooser which has ssh bookmarks. The authentication dialog
only pops up when I click on the bookmark.

Has this been fixed on the gnome-vfs side ?
Or does this bug only refer to specific protocols ? 
If so, which ones ?
Comment 35 Dennis Cranston 2006-09-16 15:58:04 UTC
It is the filechooserbutton which is popping up the authentication dialogs not the filechooser.
Comment 36 Matthias Clasen 2006-09-16 16:26:37 UTC
Ok, I do see the auth dialog pop up if I select a remote folder in the
filechooserbutton combo. Is that what this is about ?
Comment 37 Sebastien Bacher 2006-09-16 17:13:36 UTC
The bug is about the authentification dialogs opened when having a non-local GTK bookmark. The FileChooserButton is one case still having that behaviour. Would you prefer a new bug for it?
Comment 38 Dennis Cranston 2006-09-16 17:18:20 UTC
I don't have to select anything from the filechooserbutton combo.  The authentication dialog just pops up.  I can trigger the display of the authentication dialog by either launching gnome-search-tool or right clicking on a panel and selecting the properties menu item.  Both dialogs contain a filechooserbutton and local_only mode has been set.  
Comment 39 Murray Cumming 2006-10-26 17:18:18 UTC
Renaming bug to indicate status.
Comment 40 Murray Cumming 2006-10-26 17:18:31 UTC
*** Bug 309907 has been marked as a duplicate of this bug. ***
Comment 41 Murray Cumming 2006-10-26 17:21:08 UTC
Bug #354887 seems to be closes to fixing this last issue. Marking as duplicate.

*** This bug has been marked as a duplicate of 354887 ***
Comment 42 Murray Cumming 2006-10-26 17:30:25 UTC
*** Bug 168020 has been marked as a duplicate of this bug. ***