Merge lp:~jeremywootten/pantheon-files/fix-1456202-multiple-operations-one-view into lp:~elementary-apps/pantheon-files/trunk

Proposed by Jeremy Wootten
Status: Merged
Approved by: Adam Bieńkowski
Approved revision: 2520
Merged at revision: 2573
Proposed branch: lp:~jeremywootten/pantheon-files/fix-1456202-multiple-operations-one-view
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 78 lines (+3/-19)
1 file modified
src/View/AbstractDirectoryView.vala (+3/-19)
To merge this branch: bzr merge lp:~jeremywootten/pantheon-files/fix-1456202-multiple-operations-one-view
Reviewer Review Type Date Requested Status
Adam Bieńkowski (community) code Approve
Dieter Debast (community) Approve
Review via email: mp+319354@code.launchpad.net

Commit message

remove the blocks on carrying out more than one copy/cut/paste operation or trash/delete operation on the same view at the same time

Description of the change

This branch removes the blocks on carrying out more than one copy/cut/paste operation or trash/delete operation on the same view at the same time.

While these blocks were presumably originally put in place in the interests of stability, removing has not immediately revealed any regressions.

TO TEST (E.G.):

1: Carry out a slow file operation e.g. copying a fairly large folder in place on a remote filesystem or USB stick.

2: Perform another similar copy paste operation on another (or the same) fairly large folder in the same view before the first operation completes. The destination must be the same open view.

In trunk this is not possible. In this branch, both operations run and complete successfully.

Note: With these blocks removed it is possible to do things like deleting the folder which is being copied while the copy is in progress. However, this does not cause a crash - it just causes the copy operation to fail.

This branch needs careful testing with a range of simultaneous operations on the same view to ensure stability is maintained.

To post a comment you must log in.
Revision history for this message
Dieter Debast (ddieter) wrote :

I can't find any problems on this branch, unless I forgot to test something (but hopefully not). I tried a variety of copying, cutting, deleting and renaming and it doesn't crash or behave in a strange way.

review: Approve
Revision history for this message
Adam Bieńkowski (donadigo) wrote :

The code looks good to me.

review: Approve (code)
Revision history for this message
Adam Bieńkowski (donadigo) wrote :

I can confirm that this is working properly, both operations if long enough are showing in the copy dialog and they finish. I'm merging this.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/View/AbstractDirectoryView.vala'
--- src/View/AbstractDirectoryView.vala 2017-02-15 18:54:50 +0000
+++ src/View/AbstractDirectoryView.vala 2017-03-08 17:38:37 +0000
@@ -225,12 +225,8 @@
225 private GLib.AppInfo default_app;225 private GLib.AppInfo default_app;
226 private Gtk.TreePath? hover_path = null;226 private Gtk.TreePath? hover_path = null;
227227
228 private bool can_trash_or_delete = true;
229
230 /* Rapid keyboard paste support */228 /* Rapid keyboard paste support */
231 protected bool pasting_files = false;
232 protected bool select_added_files = false;229 protected bool select_added_files = false;
233 private HashTable? pasted_files = null;
234230
235 public bool renaming {get; protected set; default = false;}231 public bool renaming {get; protected set; default = false;}
236232
@@ -972,7 +968,6 @@
972 return;968 return;
973 }969 }
974970
975 view.can_trash_or_delete = true;
976 view.unblock_directory_monitor ();971 view.unblock_directory_monitor ();
977 }972 }
978973
@@ -990,12 +985,8 @@
990 * when using keybindings. So we remember if the current selection985 * when using keybindings. So we remember if the current selection
991 * was already removed (but the view doesn't know about it yet).986 * was already removed (but the view doesn't know about it yet).
992 */987 */
993 if (!can_trash_or_delete)
994 return;
995
996 unowned GLib.List<GOF.File> selection = get_selected_files_for_transfer ();988 unowned GLib.List<GOF.File> selection = get_selected_files_for_transfer ();
997 if (selection != null) {989 if (selection != null) {
998 can_trash_or_delete = false;
999 trash_or_delete_files (selection, true, delete_immediately);990 trash_or_delete_files (selection, true, delete_immediately);
1000 }991 }
1001 }992 }
@@ -1222,16 +1213,14 @@
1222 return;1213 return;
1223 }1214 }
12241215
1225 view.pasting_files = false;1216 if (uris == null || uris.size () == 0) {
1226 if (uris == null || uris.size () == 0)
1227 return;1217 return;
12281218 }
1229 view.pasted_files = uris;
12301219
1231 Idle.add (() => {1220 Idle.add (() => {
1232 /* Select the most recently pasted files */1221 /* Select the most recently pasted files */
1233 GLib.List<GLib.File> pasted_files_list = null;1222 GLib.List<GLib.File> pasted_files_list = null;
1234 view.pasted_files.foreach ((k, v) => {1223 uris.foreach ((k, v) => {
1235 if (k is GLib.File)1224 if (k is GLib.File)
1236 pasted_files_list.prepend (k as File);1225 pasted_files_list.prepend (k as File);
1237 });1226 });
@@ -1242,9 +1231,6 @@
1242 }1231 }
12431232
1244 private void on_common_action_paste_into (GLib.SimpleAction action, GLib.Variant? param) {1233 private void on_common_action_paste_into (GLib.SimpleAction action, GLib.Variant? param) {
1245 if (pasting_files)
1246 return;
1247
1248 var file = get_files_for_action ().nth_data (0);1234 var file = get_files_for_action ().nth_data (0);
12491235
1250 if (file != null && clipboard.can_paste) {1236 if (file != null && clipboard.can_paste) {
@@ -1258,10 +1244,8 @@
12581244
1259 if (target.has_uri_scheme ("trash")) {1245 if (target.has_uri_scheme ("trash")) {
1260 /* Pasting files into trash is equivalent to trash or delete action */1246 /* Pasting files into trash is equivalent to trash or delete action */
1261 pasting_files = false;
1262 call_back = (GLib.Callback)after_trash_or_delete;1247 call_back = (GLib.Callback)after_trash_or_delete;
1263 } else {1248 } else {
1264 pasting_files = true;
1265 /* callback takes care of selecting pasted files */1249 /* callback takes care of selecting pasted files */
1266 call_back = (GLib.Callback)after_pasting_files;1250 call_back = (GLib.Callback)after_pasting_files;
1267 }1251 }

Subscribers

People subscribed via source and target branches

to all changes: