GNOME Bugzilla – Bug 532850
copying doesn't work after moving the source
Last modified: 2008-05-19 23:21:30 UTC
the bug has been opened on https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/215231 "Cut/copying a file, drag-and-dropping it to another location and then pasting it fails with this error (or similar for cut): "Error while copying. There was an error getting information about "<filename>". Error stating file '<file path with filename>': No such file or directory" As the file has been moved in the mean-time by drag-and-dropping, the paste command should not try to move/copy the file from it's old location. Either the file location should be corrected in the clipboard, or the cut/copy command simply forgotten. To reproduce: 1) Right-click on a file/folder and select cut/copy (or CTRL+X / CTRL+C) 2) Drag-drop file/folder to another location 3) Right-click and select paste (or CTRL+V)"
Confirming. I am for forgetting the cut/copy command, as the copy/move operation in this case have already been done with the drop.
Created attachment 110815 [details] [review] proposed patch When handling DnD, clear clipboard if the dragged URIs collide with its contents.
Thanks for your efforts! Maybe you could move fm_directory_view_clear_clipboard_if_colliding() to nautilus_clear_clipboard_if_colliding_uris() and add a similar call to fm-tree-view.c:move_copy_items_callback() ? You should only clear the clipboard if the clipboard action is GDK_ACTION_MOVE. Oh, and fm-tree-view.c:paste_clipboard_data() seems to lack a gtk_clipboard_clear() for moves - cf. fm-directory-view.c:paste_clipboard_data()
Created attachment 111176 [details] [review] proposed patch v2 Thanks for the review. I updated the patch according to your comment and I did a bit of refactoring around, works fine in my testing.
Thanks, good job. Please commit it to trunk.
Committed, closing as FIXED. 2008-05-20 Cosimo Cecchi <cosimoc@gnome.org> * libnautilus-private/nautilus-clipboard.c: (convert_lines_to_str_list), (nautilus_clipboard_get_uri_list_from_selection_data), (nautilus_clipboard_get), (nautilus_clipboard_clear_if_colliding_uris): * libnautilus-private/nautilus-clipboard.h: * src/file-manager/fm-directory-view.c: (fm_directory_view_get_copied_files_atom), (copy_or_cut_files), (paste_clipboard_data), (action_paste_files_callback), (paste_into), (real_update_paste_menu): * src/file-manager/fm-directory-view.h: * src/file-manager/fm-icon-view.c: (icon_view_move_copy_items): * src/file-manager/fm-list-view.c: (move_copy_items_callback): * src/file-manager/fm-tree-view.c: (move_copy_items_callback), (button_pressed_callback), (copy_or_cut_files), (paste_clipboard_data), (fm_tree_view_paste_cb): Empty the clipboard when copying/moving with DnD a file contained in it. Also, refactor some clipboard code from fm-directory-view.c and fm-tree-view.c into nautilus-clipboard.c. (#532850).