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 596577 - should ask confirmation before opening a multiple items selection
should ask confirmation before opening a multiple items selection
Status: RESOLVED OBSOLETE
Product: nautilus
Classification: Core
Component: general
2.28.x
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 582798 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-09-28 09:47 UTC by Sebastien Bacher
Modified: 2021-06-18 15:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Updated Greek translation. (4.08 KB, patch)
2009-09-29 21:05 UTC, Marcus Carlson
none Details | Review
Adds a warning dialog upon opening more than 25 files at once (4.07 KB, patch)
2009-09-29 21:14 UTC, Marcus Carlson
needs-work Details | Review
Screenshot of dialog (26.54 KB, image/png)
2009-09-29 21:15 UTC, Marcus Carlson
  Details
Adds a warning when opening multiple files that will spawn more then 5 separate applications (3.15 KB, patch)
2009-10-02 19:14 UTC, Marcus Carlson
needs-work Details | Review
Ask for confirmation before opening more than 5 files (#596577) (3.18 KB, patch)
2010-07-07 20:49 UTC, Marcus Carlson
needs-work Details | Review
Updated patch (2.83 KB, patch)
2010-07-09 22:04 UTC, Marcus Carlson
needs-work Details | Review
Correct patch (2.83 KB, patch)
2010-07-09 22:10 UTC, Marcus Carlson
committed Details | Review

Description Sebastien Bacher 2009-09-28 09:47:55 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."
Comment 1 Marcus Carlson 2009-09-29 21:05:16 UTC
Created attachment 144298 [details] [review]
Updated Greek translation.

(This attachment is made with git-bz, not sure how things will go...)
Comment 2 Marcus Carlson 2009-09-29 21:06:19 UTC
Comment on attachment 144298 [details] [review]
Updated Greek translation.

I screwed up
Comment 3 Marcus Carlson 2009-09-29 21:14:20 UTC
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?
Comment 4 Marcus Carlson 2009-09-29 21:15:58 UTC
Created attachment 144301 [details]
Screenshot of dialog
Comment 5 Alexander Larsson 2009-09-30 10:24:32 UTC
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.
Comment 6 Marcus Carlson 2009-10-02 19:14:56 UTC
Created attachment 144615 [details] [review]
Adds a warning when opening multiple files that will spawn more then 5 separate applications
Comment 7 Marcus Carlson 2009-10-02 19:15:30 UTC
Alex, something like that you had in mind?
Comment 8 Alexander Larsson 2009-10-07 08:34:27 UTC
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.
Comment 9 Marcus Carlson 2010-04-05 22:04:51 UTC
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?
Comment 10 Baris Cicek 2010-04-21 08:02:55 UTC
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.
Comment 11 Cosimo Cecchi 2010-07-04 10:42:16 UTC
(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.
Comment 12 Marcus Carlson 2010-07-07 20:13:57 UTC
> 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...)
Comment 13 Marcus Carlson 2010-07-07 20:49:13 UTC
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.
Comment 14 Cosimo Cecchi 2010-07-07 22:34:06 UTC
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;
Comment 15 Marcus Carlson 2010-07-09 22:04:54 UTC
Created attachment 165581 [details] [review]
Updated patch
Comment 16 Marcus Carlson 2010-07-09 22:05:45 UTC
Comment on attachment 165581 [details] [review]
Updated patch

Error...
Comment 17 Marcus Carlson 2010-07-09 22:10:11 UTC
Created attachment 165582 [details] [review]
Correct patch

Sorry for spamming...
Comment 18 Cosimo Cecchi 2010-07-11 11:07:31 UTC
Review of attachment 165582 [details] [review]:

Looks fine now, thanks for your efforts.
Comment 19 Marcus Carlson 2010-07-11 19:58:26 UTC
Thanks for reviewing :)

Committed now. Marking as FIXED.
Comment 20 Marcus Carlson 2010-07-21 22:29:04 UTC
*** Bug 582798 has been marked as a duplicate of this bug. ***
Comment 21 Sebastien Bacher 2010-08-04 16:03:25 UTC
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
Comment 22 Cosimo Cecchi 2010-08-04 16:51:16 UTC
(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
Comment 23 Sebastien Bacher 2010-08-04 16:58:38 UTC
I had this commit in my build, it doesn't solve the case of selecting several videos (not a directory of videos)
Comment 24 Timothy Arceri 2011-08-28 06:27:37 UTC
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
Comment 25 Cosimo Cecchi 2011-09-08 02:05:27 UTC
It seems this should have been solved by http://git.gnome.org/browse/nautilus/commit/?id=d1bc9311392e243aa5c9af4b80a373b6dd69d741
Comment 26 Timothy Arceri 2011-09-08 09:51:58 UTC
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.
Comment 27 Timothy Arceri 2011-11-10 23:15:50 UTC
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.
Comment 28 Timothy Arceri 2011-11-10 23:20:15 UTC
&&
+ 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.
Comment 29 Cosimo Cecchi 2012-07-20 16:07:23 UTC
Mass component change due to BZ cleanup, sorry for the noise.
Comment 30 André Klapper 2021-06-18 15:16:39 UTC
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.