GNOME Bugzilla – Bug 596577
should ask confirmation before opening a multiple items selection
Last modified: 2021-06-18 15:16:39 UTC
The bug has been opened on https://bugs.launchpad.net/hundredpapercuts/+bug/429041 "When you select multiple files in Nautilus and accidentally open them (by wrong click, by Intro key...), Nautilus tries to open all of them at once in multiple instances of the default application. This can make your system totally unresponsive and force you to do a hard restart if they are many (try with 2.000, for example) or they are heavy (video, for example). Even if it doesn't come to that, it's annoying to have to close then one by one. In Windows if you try to open many files at once there is a warning ('You are trying to open multiple files', I think), giving you the option to cancel or open them anyway. I think Nautilus should do the same. After all, how often do you need to open 20 files at once? To have an option to close all open instances of an app at once would be very usefull too."
Created attachment 144298 [details] [review] Updated Greek translation. (This attachment is made with git-bz, not sure how things will go...)
Comment on attachment 144298 [details] [review] Updated Greek translation. I screwed up
Created attachment 144300 [details] [review] Adds a warning dialog upon opening more than 25 files at once Doing it old school instead - sorry about the spam. About the patch; this is an initial proof of concept / discussion material. Is the wording / limit good? Is it done in the right place or should it be done "higher" up?
Created attachment 144301 [details] Screenshot of dialog
nautilus_mime_activate_file() already has some code to handle things like this (see e.g. confirm_multiple_windows() and stuff related to that). This only affects the number of nautilus windows/tabs opened, but we should fix it to handle applications too. And we should do so in the same way as the existing code, not overriding it early. Also, i don't think we should warn, or at least not with as few files, when opening lots of files that will open with the same application, and that application supports listing multiple arguments.
Created attachment 144615 [details] [review] Adds a warning when opening multiple files that will spawn more then 5 separate applications
Alex, something like that you had in mind?
Hmm, no thats not quite right. We sort by app yes, but that doesn't necessarily mean that we'll only launch the app once for all the files in that app. The app may not support multiple files (%U or %F in the desktop file) and then we will launch multiple copies of the app. However, I see that there is no easy way to check on a GAppInfo if it supports opening multiple files. So, at least for now I think we'll have to go with counting the number of files opened by applications instead.
Alex, if I understand correctly; you'd like me to check whether the .desktop file includes %U or %F and if so, launch the application with multiple files or uris as argument? OR, is this patch as good as it can be right now as we're missing info in GAppInfo?
I want to vouch for this bug. Don't know if it's because I'm getting older, or using nautilus more but I'd be happy to get such a confirmation. If is there anything I could do/test would be glad to help. Though it looks like a very straightforward issue to be resolved.
(In reply to comment #9) > Alex, if I understand correctly; you'd like me to check whether the .desktop > file includes %U or %F and if so, launch the application with multiple files or > uris as argument? OR, is this patch as good as it can be right now as we're > missing info in GAppInfo? No, Alex is probably saying the silent limit should be checked against the number of files, and not the number of applications as in your patch, as we're missing the API in GAppInfo to find out whether an application supports multiple files. Another nicer way would be adding that API first in GIO and then using it here.
> Another nicer way would be adding that API first in GIO and then using it here. Do you mean something like this? static gboolean g_desktop_app_info_supports_multiple_uris (GAppInfo *appinfo) { GDesktopAppInfo *info = G_DESKTOP_APP_INFO (appinfo); return info->exec && (strstr (info->exec, "%U") != NULL); } static gboolean g_desktop_app_info_supports_multiple_files (GAppInfo *appinfo) { GDesktopAppInfo *info = G_DESKTOP_APP_INFO (appinfo); return info->exec && (strstr (info->exec, "%F") != NULL); } (when implemented of course...)
Created attachment 165437 [details] [review] Ask for confirmation before opening more than 5 files (#596577) Patch updated (against 2.31.1) and now only checks for the number of files selected (files with applications and unhandled). Also pauses the timed activation when asking using for confirmation.
Review of attachment 165437 [details] [review]: Looks almost good, just some nitpicks; ::: libnautilus-private/nautilus-mime-actions.c @@ +1882,3 @@ + + prompt = _("Are you sure you want to open all files?"); + detail = g_strdup_printf (ngettext("This will open %d separate application.", Missing space after ngettext @@ +1890,3 @@ + + response = gtk_dialog_run (dialog); + gtk_object_destroy (GTK_OBJECT (dialog)); Should use gtk_widget_destroy() here. @@ +1894,3 @@ + unpause_activation_timed_cancel (parameters); + + open_files = response == GTK_RESPONSE_YES; I prefer a more readable if (response == ...) open_files = TRUE;
Created attachment 165581 [details] [review] Updated patch
Comment on attachment 165581 [details] [review] Updated patch Error...
Created attachment 165582 [details] [review] Correct patch Sorry for spamming...
Review of attachment 165582 [details] [review]: Looks fine now, thanks for your efforts.
Thanks for reviewing :) Committed now. Marking as FIXED.
*** Bug 582798 has been marked as a duplicate of this bug. ***
the change has some issues, it will display a "do you really want to open those files, that will open 1 application" when selecting a bunch of videos which would normally just being queued in the player playlist for example
(In reply to comment #21) > the change has some issues, it will display a "do you really want to open those > files, that will open 1 application" when selecting a bunch of videos which > would normally just being queued in the player playlist for example I fixed that some days ago in http://git.gnome.org/browse/nautilus/commit/?id=6d91cfb1d053a433cc5e17336c2e22c4e1d71673
I had this commit in my build, it doesn't solve the case of selecting several videos (not a directory of videos)
I have filled a bug to get the api changes needed to fix this bug completed here: https://bugzilla.gnome.org/show_bug.cgi?id=657542
It seems this should have been solved by http://git.gnome.org/browse/nautilus/commit/?id=d1bc9311392e243aa5c9af4b80a373b6dd69d741
Forgive me if I'm wrong but isn't this a regression? If the files are opened with one application and that application only handles one file at a time then you would have the same issue that was reported initially. Opening 100 files would open 100 instances of that application, and there would be no warning.
Please reopen bug as I noted in my last comment the last patch was a regression. Steps to reproduce: Copy 6 .jpg images into a directory (the warning is given when more that 5 files are being opened). Also copy a .txt file or something that will be opened by a different application. Make Shotwell the default image viewer ( shotwell opens multiple instances for each file selected ). Select all 6 jpg files right click and open with shotwell. Six instances of shotwell are opened NO warning. This time select the text file as well and select open. You have a warning now but it says two applications will be opened??? 1. Why am I being warned if it really was only two applications being opened?? Surely 2 is not something to be warned about 2. Its really 7 instances being opened.
&& + num_apps > 1 Added in the last patch refers to the number of different applications that will open not the number of instances of applications.
Mass component change due to BZ cleanup, sorry for the noise.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version of Files (nautilus), then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/nautilus/-/issues/ Thank you for your understanding and your help.