rpms/nautilus/devel nautilus-cd-burner-move-workaround.patch, NONE, 1.1 nautilus-copymove_inside_itself.patch, NONE, 1.1 nautilus.spec, 1.202, 1.203

Tomas Bzatek (tbzatek) fedora-extras-commits at redhat.com
Fri May 2 11:50:48 UTC 2008


Author: tbzatek

Update of /cvs/extras/rpms/nautilus/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12320

Modified Files:
	nautilus.spec 
Added Files:
	nautilus-cd-burner-move-workaround.patch 
	nautilus-copymove_inside_itself.patch 
Log Message:
* Fri May  2 2008 Tomas Bzatek <tbzatek at redhat.com> - 2.23.1-3
- Mask file moving to nautilus-cd-burner window as copy operation (#443944)
- Don't allow recursive move/copy into itself (gnomebz #530720)


nautilus-cd-burner-move-workaround.patch:

--- NEW FILE nautilus-cd-burner-move-workaround.patch ---
Index: libnautilus-private/nautilus-file-operations.c
===================================================================
--- libnautilus-private/nautilus-file-operations.c	(revision 14109)
+++ libnautilus-private/nautilus-file-operations.c	(working copy)
@@ -4651,15 +4651,45 @@
 				    gpointer done_callback_data)
 {
 	GList *locations;
+	GList *p;
 	GFile *dest, *src_dir;
 	GtkWindow *parent_window;
-
+	gboolean target_is_mapping;
+	gboolean have_nonmapping_source;
+	gboolean have_nonlocal_source;
+	char *file_scheme;
+	                        	
 	dest = NULL;
+	target_is_mapping = FALSE;
+	have_nonlocal_source = FALSE;
+	have_nonmapping_source = FALSE;
+                
 	if (target_dir) {
 		dest = g_file_new_for_uri (target_dir);
+		if (strncmp (target_dir, "burn", 4) == 0) {
+			target_is_mapping = TRUE;
+                }
 	}
 	locations = location_list_from_uri_list (item_uris);
+	
+	for (p = location_list_from_uri_list (item_uris); p != NULL; p = p->next) {
+		file_scheme = g_file_get_uri_scheme ((GFile *)p->data);
 
+		if (strcmp (file_scheme, "file") != 0) {
+			have_nonlocal_source = TRUE;
+		}
+                
+		if (strcmp (file_scheme, "burn") != 0) {
+			have_nonmapping_source = TRUE;
+		}
+                
+		g_free (file_scheme);
+	}
+	
+	if (target_is_mapping && have_nonmapping_source && !have_nonlocal_source && (copy_action == GDK_ACTION_COPY || copy_action == GDK_ACTION_MOVE)) {
+		copy_action = GDK_ACTION_COPY;
+	}
+	
 	parent_window = NULL;
 	if (parent_view) {
 		parent_window = (GtkWindow *)gtk_widget_get_ancestor (parent_view, GTK_TYPE_WINDOW);

nautilus-copymove_inside_itself.patch:

--- NEW FILE nautilus-copymove_inside_itself.patch ---
Index: libnautilus-private/nautilus-file-operations.c
===================================================================
--- libnautilus-private/nautilus-file-operations.c	(revision 14108)
+++ libnautilus-private/nautilus-file-operations.c	(working copy)
@@ -3224,6 +3224,24 @@
 	}
 }
 
+static gboolean
+g_file_struct_contains (GFile *child, GFile *root)
+{
+    GFile *f;
+    
+    f = g_file_dup (child);
+    while (f) {
+	if (g_file_equal (f, root)) {
+	    g_object_unref (f);
+	    return TRUE;
+	}
+	f = g_file_get_parent (f);
+    }
+    
+    if (f)  g_object_unref (f);
+    return FALSE;
+}
+
 /* Debuting files is non-NULL only for toplevel items */
 static void
 copy_move_file (CopyMoveJob *copy_job,
@@ -3264,6 +3282,41 @@
 		dest = get_target_file (src, dest_dir, same_fs);
 	}
 
+
+	/* Don't allow recursive move/copy into itself.  
+         * (We would get a file system error if we proceeded but it is nicer to 
+         * detect and report it at this level) */
+	if (g_file_struct_contains (dest_dir, src)) {
+		if (job->skip_all_error) {
+			g_error_free (error);
+			goto out;
+		}
+		
+		/*  the run_warning() frees all strings passed in automatically  */
+		primary = copy_job->is_move ? g_strdup (_("You cannot move a folder into itself."))
+					    : g_strdup (_("You cannot copy a folder into itself."));
+		secondary = g_strdup (_("The destination folder is inside the source folder."));
+		
+		response = run_warning (job,
+					primary,
+					secondary,
+					NULL,
+					GTK_STOCK_CANCEL, SKIP_ALL, SKIP,
+					NULL);
+
+		if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
+			abort_job (job);
+		} else if (response == 1) { /* skip all */
+			job->skip_all_error = TRUE;
+		} else if (response == 2) { /* skip */
+			/* do nothing */
+		} else {
+			g_assert_not_reached ();
+		}
+
+		goto out;
+	}
+	
  retry:
 	
 	error = NULL;
@@ -3791,6 +3844,41 @@
 	
 	dest = get_target_file (src, dest_dir, same_fs);
 
+
+	/* Don't allow recursive move/copy into itself.  
+         * (We would get a file system error if we proceeded but it is nicer to 
+         * detect and report it at this level) */
+	if (g_file_struct_contains (dest_dir, src)) {
+		if (job->skip_all_error) {
+			g_error_free (error);
+			goto out;
+		}
+		
+		/*  the run_warning() frees all strings passed in automatically  */
+		primary = move_job->is_move ? g_strdup (_("You cannot move a folder into itself."))
+					    : g_strdup (_("You cannot copy a folder into itself."));
+		secondary = g_strdup (_("The destination folder is inside the source folder."));
+		
+		response = run_warning (job,
+					primary,
+					secondary,
+					NULL,
+					GTK_STOCK_CANCEL, SKIP_ALL, SKIP,
+					NULL);
+		
+		if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
+			abort_job (job);
+		} else if (response == 1) { /* skip all */
+			job->skip_all_error = TRUE;
+		} else if (response == 2) { /* skip */
+			/* do nothing */
+		} else {
+			g_assert_not_reached ();
+		}
+
+		goto out;
+	}
+
  retry:
 	
 	flags = G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_NO_FALLBACK_FOR_MOVE;


Index: nautilus.spec
===================================================================
RCS file: /cvs/extras/rpms/nautilus/devel/nautilus.spec,v
retrieving revision 1.202
retrieving revision 1.203
diff -u -r1.202 -r1.203
--- nautilus.spec	24 Apr 2008 12:36:28 -0000	1.202
+++ nautilus.spec	2 May 2008 11:50:12 -0000	1.203
@@ -19,7 +19,7 @@
 Name:		nautilus
 Summary:        Nautilus is a file manager for GNOME
 Version: 	2.23.1
-Release:	2%{?dist}
+Release:	3%{?dist}
 License: 	GPLv2+
 Group:          User Interface/Desktops
 Source: 	http://download.gnome.org/sources/%{name}/2.23/%{name}-%{version}.tar.bz2
@@ -93,6 +93,13 @@
 # http://bugzilla.gnome.org/show_bug.cgi?id=528675
 Patch11:	nautilus-fix-open-folder.patch
 
+# https://bugzilla.redhat.com/show_bug.cgi?id=443944 
+Patch12:        nautilus-cd-burner-move-workaround.patch
+
+# https://bugzilla.gnome.org/show_bug.cgi?id=530720 
+Patch13:        nautilus-copymove_inside_itself.patch
+
+
 %description
 Nautilus integrates access to files, applications, media,
 Internet-based resources and the Web. Nautilus delivers a dynamic and
@@ -131,6 +138,8 @@
 %patch9 -p0 -b .fix-autorun
 %patch10 -p0 -b .gvfs-desktop-key
 %patch11 -p1 -b .fix-open-folder
+%patch12 -p0 -b .cd-burner
+%patch13 -p0 -b .recurse
 
 %build
 
@@ -243,6 +252,10 @@
 
 
 %changelog
+* Fri May  2 2008 Tomas Bzatek <tbzatek at redhat.com> - 2.23.1-3
+- Mask file moving to nautilus-cd-burner window as copy operation (#443944)
+- Don't allow recursive move/copy into itself (gnomebz #530720)
+
 * Thu Apr 24 2008 Tomas Bzatek <tbzatek at redhat.com> - 2.23.1-2
 - Add SELinux patch (gnomebz #529694)
 




More information about the fedora-extras-commits mailing list