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:13:24 +0000
commit222bb41f8081be9ac1a023bdc8f66ab267365a4d (patch)
tree938af6a93d9954f7979da8da8c1bda9e9e26be0b
parentc37dc7cfdfb9a483989001cf67903ca658a6829c (diff)
downloadnautilus-222bb41f8081be9ac1a023bdc8f66ab267365a4d.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
-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 cd87f187f..fbb43e047 100644
--- a/src/nautilus-tree-view-drag-dest.c
+++ b/src/nautilus-tree-view-drag-dest.c
@@ -883,6 +883,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,
@@ -911,6 +925,7 @@ drag_data_received_callback (GtkWidget *widget,
{
dest->details->drag_list =
nautilus_drag_build_selection_list (selection_data);
+ cache_selection_list (dest);
}
}