[nautilus/wip/corey/dnd-star-fix] dnd: Only allow dropping to starred if source location is supported




commit f144ae331b29422a382c7ea917e19ba3b70a2549
Author: Corey Berla <corey berla me>
Date:   Fri Sep 30 13:32:12 2022 -0700

    dnd: Only allow dropping to starred if source location is supported
    
    This is a follow-up to a88ad1e3e36bd85bc6139cf8c398fdc79819941f in which
    we allowed dropping any file to the starred location.  Since we only
    allow starring files in the Home directory, we need to check first
    if the dropped location can be starred.

 src/nautilus-dnd.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-dnd.c b/src/nautilus-dnd.c
index 6eca6e25d..e4ee71675 100644
--- a/src/nautilus-dnd.c
+++ b/src/nautilus-dnd.c
@@ -10,6 +10,7 @@
 
 #include "nautilus-dnd.h"
 #include "nautilus-file-utilities.h"
+#include "nautilus-tag-manager.h"
 
 static gboolean
 check_same_fs (NautilusFile *file1,
@@ -176,7 +177,14 @@ nautilus_dnd_get_preferred_action (NautilusFile *target_file,
     }
     else if (nautilus_file_is_starred_location (target_file))
     {
-        return GDK_ACTION_COPY;
+        if (nautilus_tag_manager_can_star_contents (nautilus_tag_manager_get (), dropped))
+        {
+            return GDK_ACTION_COPY;
+        }
+        else
+        {
+            return 0;
+        }
     }
     else if (!nautilus_file_is_directory (target_file) ||
              !nautilus_file_can_write (target_file))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]