summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergio Costas <rastersoft@gmail.com>2022-02-14 19:01:42 +0100
committerAntónio Fernandes <antoniojpfernandes@gmail.com>2022-03-19 17:24:38 +0000
commita49138e1101fc509f06447658c61b6df79161825 (patch)
tree67a546624a3b87fd8a2d91d4f59de37f23fa6aca
parent3e97c1975b9409ce4178abde9a9bee12ce5fded4 (diff)
downloadnautilus-a49138e1101fc509f06447658c61b6df79161825.tar.gz
Fix move operation in treeview DnD
When doing a DnD operation from outside Nautilus into one of its windows, if the window is in "iconview mode", Nautilus is able to detect when the origin and the destination folders are in the same disk volume and do a move in that case, or do a copy when they are in different volumes. Unfortunately, when the window is in "treeview mode", this operation doesn't work as expected, and always copy the file(s), no matter if the origin and destination folders are or not in the same volume. After tracking the bug, I found that, in "treeview mode", the NautilusFile object with the destination folder doesn't have defined the filesystem_id property. This makes fail the check_same_fs() function, which always returns FALSE. In "iconview mode", instead, the object does have that property defined, and that's why there it works. I did a fix proposal, and although it was a safe workaround, António Fernandes found a better way to fix it, which is this patch. Fix https://gitlab.gnome.org/GNOME/nautilus/-/issues/2170 (cherry picked from commit 222bb41f8081be9ac1a023bdc8f66ab267365a4d)
-rw-r--r--src/nautilus-tree-view-drag-dest.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/nautilus-tree-view-drag-dest.c b/src/nautilus-tree-view-drag-dest.c
index 379693ffd..40f99b70f 100644
--- a/src/nautilus-tree-view-drag-dest.c
+++ b/src/nautilus-tree-view-drag-dest.c
@@ -950,6 +950,20 @@ receive_xds (NautilusTreeViewDragDest *dest,
return TRUE;
}
+static void
+cache_selection_list (NautilusTreeViewDragDest *dest)
+{
+ g_autolist (NautilusFile) files = NULL;
+
+ /* File selection list information (mostly the file system info, in order to
+ * know if we want to copy or move the files) about the files being dragged,
+ * that can come from another process, like desktop icons extension. */
+
+ files = nautilus_drag_file_list_from_selection_list (dest->details->drag_list);
+ nautilus_file_list_call_when_ready (files,
+ NAUTILUS_FILE_ATTRIBUTE_INFO,
+ NULL, NULL, NULL);
+}
static gboolean
drag_data_received_callback (GtkWidget *widget,
@@ -978,6 +992,7 @@ drag_data_received_callback (GtkWidget *widget,
{
dest->details->drag_list =
nautilus_drag_build_selection_list (selection_data);
+ cache_selection_list (dest);
}
}