[nautilus] Don't accept drops over non-writable locations in icon view



commit c3f3ecff6746cd984bd2604a739af8e94e4d9ab4
Author: William Jon McCann <jmccann redhat com>
Date:   Fri Aug 24 19:20:06 2012 -0400

    Don't accept drops over non-writable locations in icon view
    
    https://bugzilla.gnome.org/show_bug.cgi?id=329515

 libnautilus-private/nautilus-canvas-dnd.c |   21 ++++++++++++++++-----
 libnautilus-private/nautilus-file-dnd.c   |    6 +++---
 2 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/libnautilus-private/nautilus-canvas-dnd.c b/libnautilus-private/nautilus-canvas-dnd.c
index bbaba73..a6d394b 100644
--- a/libnautilus-private/nautilus-canvas-dnd.c
+++ b/libnautilus-private/nautilus-canvas-dnd.c
@@ -974,11 +974,22 @@ nautilus_canvas_container_find_drop_target (NautilusCanvasContainer *container,
 
 		container_uri = get_container_uri (container);
 
-		if (rewrite_desktop &&
-		    container_uri != NULL &&
-		    eel_uri_is_desktop (container_uri)) {
-			g_free (container_uri);
-			container_uri = nautilus_get_desktop_directory_uri ();
+		if (container_uri != NULL) {
+			if (rewrite_desktop && eel_uri_is_desktop (container_uri)) {
+				g_free (container_uri);
+				container_uri = nautilus_get_desktop_directory_uri ();
+			} else {
+				gboolean can;
+				file = nautilus_file_get_by_uri (container_uri);
+				can = nautilus_drag_can_accept_info (file,
+								     container->details->dnd_info->drag_info.data_type,
+								     container->details->dnd_info->drag_info.selection_list);
+				g_object_unref (file);
+				if (!can) {
+					g_free (container_uri);
+					container_uri = NULL;
+				}
+			}
 		}
 		
 		return container_uri;
diff --git a/libnautilus-private/nautilus-file-dnd.c b/libnautilus-private/nautilus-file-dnd.c
index 310ad9d..5155d63 100644
--- a/libnautilus-private/nautilus-file-dnd.c
+++ b/libnautilus-private/nautilus-file-dnd.c
@@ -35,14 +35,14 @@
 static gboolean
 nautilus_drag_can_accept_files (NautilusFile *drop_target_item)
 {
-	NautilusDirectory *directory;
-
 	if (nautilus_file_is_directory (drop_target_item)) {
+		NautilusDirectory *directory;
 		gboolean res;
 
 		/* target is a directory, accept if editable */
 		directory = nautilus_directory_get_for_file (drop_target_item);
-		res = nautilus_directory_is_editable (directory);
+		res = nautilus_directory_is_editable (directory) &&
+			nautilus_file_can_write (drop_target_item);
 		nautilus_directory_unref (directory);
 		return res;
 	}



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