[nautilus/wip/corey/dnd_features: 6/6] dnd: Allow GDK_ACTION_COPY within the same folder
- From: Corey Berla <coreyberla src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/corey/dnd_features: 6/6] dnd: Allow GDK_ACTION_COPY within the same folder
- Date: Thu, 18 Aug 2022 19:15:21 +0000 (UTC)
commit 23484412c661e85c97ec022bbf13b2356a871bed
Author: Corey Berla <corey berla me>
Date: Thu Aug 18 12:11:11 2022 -0700
dnd: Allow GDK_ACTION_COPY within the same folder
We are setting the preferred action to 0 when the source and dest are
in the same folder. This prevents the ability to hold CTRL and perform
a copy operation (which worked in 42). It isn't clear why you can't
override a 0 preferred action with key modifiers.
In order to keep consistency, remove this check in
nautilus_dnd_get_preferred_action() and add it to
nautilus_files_view_drop_proxy_received_uris() (only if the action
is MOVE).
src/nautilus-dnd.c | 3 +--
src/nautilus-files-view-dnd.c | 7 +++++++
2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-dnd.c b/src/nautilus-dnd.c
index 7e537517c..08330da57 100644
--- a/src/nautilus-dnd.c
+++ b/src/nautilus-dnd.c
@@ -204,8 +204,7 @@ nautilus_dnd_get_preferred_action (NautilusFile *target_file,
}
target_location = nautilus_file_get_location (target_file);
- if (g_file_equal (target_location, dropped) ||
- g_file_has_parent (dropped, target_location))
+ if (g_file_equal (target_location, dropped))
{
return 0;
}
diff --git a/src/nautilus-files-view-dnd.c b/src/nautilus-files-view-dnd.c
index 69254be65..150addeb2 100644
--- a/src/nautilus-files-view-dnd.c
+++ b/src/nautilus-files-view-dnd.c
@@ -350,12 +350,19 @@ nautilus_files_view_drop_proxy_received_uris (NautilusFilesView *view,
GdkDragAction action)
{
g_autofree char *container_uri = NULL;
+ g_autoptr (GFile) source_location = g_file_new_for_uri (source_uri_list->data);
+ g_autoptr (GFile) target_location = g_file_new_for_uri (target_uri);
if (target_uri == NULL)
{
container_uri = nautilus_files_view_get_backing_uri (view);
g_assert (container_uri != NULL);
}
+ if (g_file_has_parent (source_location, target_location) &&
+ action & GDK_ACTION_MOVE)
+ {
+ return;
+ }
if (action == GDK_ACTION_ASK)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]