6883034 OpenSolaris 0906 Nautilus 2.24.2 Drag and Drop issue copy/move opensolaris-2009-06
authorkrish_p
Mon, 16 Nov 2009 05:30:39 +0000
branchopensolaris-2009-06
changeset 14347 513efb5e2b38
parent 14346 bab064f96b5b
child 14348 ffb6a16de96f
6883034 OpenSolaris 0906 Nautilus 2.24.2 Drag and Drop issue copy/move
ChangeLog
base-specs/nautilus.spec
patches/nautilus-15-dnd-remote-location.diff
--- a/ChangeLog	Fri Nov 13 08:51:57 2009 +0000
+++ b/ChangeLog	Mon Nov 16 05:30:39 2009 +0000
@@ -1,3 +1,8 @@
+2009-11-13  Krishnan Parthasarathi <[email protected]> 
+
+	* base-specs/nautilus.spec:
+	* patches/nautilus-15-dnd-remote-location.diff: added to fix CR	6883034
+
 2009-11-13  Abhijit Nath <[email protected]>
 
         * base-specs/glib2.spec: add patch glib-09-gio-check-mountflag.diff
--- a/base-specs/nautilus.spec	Fri Nov 13 08:51:57 2009 +0000
+++ b/base-specs/nautilus.spec	Mon Nov 16 05:30:39 2009 +0000
@@ -61,6 +61,9 @@
 #owner:gman date:2007-10-19 type:branding
 Patch14:      nautilus-14-interface-changes-indiana.diff
 %endif
+Patch15:       nautilus-15-dnd-remote-location.diff
+#owner:krish_p date:2009-11-13 type:bug bugzilla:314139(gnome),456515(redhat) 
+
 BuildRoot:    %{_tmppath}/%{name}-%{version}-build
 Docdir:       %{_defaultdocdir}/nautilus2
 Autoreqprov:  on
@@ -153,6 +156,7 @@
 %if %option_with_indiana_branding
 %patch14 -p1
 %endif
+%patch15 -p1
 
 cp %SOURCE4 icons
 cp %SOURCE5 icons
@@ -252,6 +256,12 @@
 %{_libdir}/pkgconfig/*.pc
 
 %changelog
+* Fri Nov 13 2009 - [email protected]
+  patches/nautilus-15-dnd-remote-location.diff: added
+  drag and drop to a directory symlinked to a remote 
+  location (eg. nfs), results in a move. This behaviour is 
+  changed to a copy operation as decided in the upstream bug. 
+  bugster: 6883034 bugzilla.redhat: 456515 bugzilla.gnome: 314139
 * Tue Nov 25 2008 - [email protected]
 - Bump to 2.24.2
 * Sun Nov 02 2008 - [email protected]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/nautilus-15-dnd-remote-location.diff	Mon Nov 16 05:30:39 2009 +0000
@@ -0,0 +1,64 @@
+--- nautilus-2.24.2/libnautilus-private/nautilus-dnd.c.orig	2009-10-08 19:42:24.520829864 +0530
++++ nautilus-2.24.2/libnautilus-private/nautilus-dnd.c	2009-10-08 19:45:26.199491396 +0530
+@@ -411,6 +411,24 @@
+ 	return result;
+ }
+ 
++static gboolean
++source_is_deletable (GFile *file)
++{
++	NautilusFile *naut_file;
++	gboolean ret;
++
++	/* if there's no a cached NautilusFile, it returns NULL */
++	naut_file = nautilus_file_get_existing (file);
++	if (naut_file == NULL) {
++		return FALSE;
++	}
++	
++	ret = nautilus_file_can_delete (naut_file);
++	nautilus_file_unref (naut_file);
++
++	return ret;
++}
++
+ void
+ nautilus_drag_default_drop_action_for_icons (GdkDragContext *context,
+ 					     const char *target_uri_string, const GList *items,
+@@ -418,8 +436,9 @@
+ {
+ 	gboolean same_fs;
+ 	gboolean target_is_source_parent;
++	gboolean source_deletable;
+ 	const char *dropped_uri;
+-	GFile *target, *dropped;
++	GFile *target, *dropped, *dropped_directory;
+ 	GdkDragAction actions;
+ 	NautilusFile *dropped_file, *target_file;
+ 
+@@ -499,11 +518,22 @@
+ 	nautilus_file_unref (dropped_file);
+ 	nautilus_file_unref (target_file);
+ 	
++
+ 	/* Compare the first dropped uri with the target uri for same fs match. */
+ 	dropped = g_file_new_for_uri (dropped_uri);
+-	target_is_source_parent = g_file_has_prefix (dropped, target);
+-	
+-	if (same_fs || target_is_source_parent ||
++	dropped_directory = g_file_get_parent (dropped);
++	target_is_source_parent = FALSE;
++	if (dropped_directory != NULL) {
++		/* If the dropped file is already in the same directory but
++		   is in another filesystem we still want to move, not copy
++		   as this is then just a move of a mountpoint to another
++		   position in the dir */
++		target_is_source_parent = g_file_equal (dropped_directory, target);
++		g_object_unref (dropped_directory);
++	}
++	source_deletable = source_is_deletable (dropped);
++
++	if ((same_fs && source_deletable) || target_is_source_parent ||
+ 	    g_file_has_uri_scheme (dropped, "trash")) {
+ 		if (actions & GDK_ACTION_MOVE) {
+ 			*action = GDK_ACTION_MOVE;