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 532850 - copying doesn't work after moving the source
copying doesn't work after moving the source
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: Cut Copy Paste Undo
2.22.x
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-05-12 22:06 UTC by Sebastien Bacher
Modified: 2008-05-19 23:21 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22


Attachments
proposed patch (5.30 KB, patch)
2008-05-13 00:00 UTC, Cosimo Cecchi
needs-work Details | Review
proposed patch v2 (15.33 KB, patch)
2008-05-19 19:29 UTC, Cosimo Cecchi
committed Details | Review

Description Sebastien Bacher 2008-05-12 22:06:29 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)"
Comment 1 Cosimo Cecchi 2008-05-12 23:00:10 UTC
Confirming.
I am for forgetting the cut/copy command, as the copy/move operation in this case have already been done with the drop.
Comment 2 Cosimo Cecchi 2008-05-13 00:00:57 UTC
Created attachment 110815 [details] [review]
proposed patch

When handling DnD, clear clipboard if the dragged URIs collide with its contents.
Comment 3 Christian Neumair 2008-05-19 13:07:23 UTC
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()
Comment 4 Cosimo Cecchi 2008-05-19 19:29:20 UTC
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.
Comment 5 Christian Neumair 2008-05-19 22:27:39 UTC
Thanks, good job. Please commit it to trunk.
Comment 6 Cosimo Cecchi 2008-05-19 23:21:30 UTC
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).