nautilus r14661 - in trunk: . libnautilus-private



Author: nbenitez
Date: Mon Sep 22 15:59:15 2008
New Revision: 14661
URL: http://svn.gnome.org/viewvc/nautilus?rev=14661&view=rev

Log:
2008-09-22  Nelson BenÃtez LeÃn  <nbenitez svn gnome org>

	* libnautilus-private/nautilus-file-operations.c
	(copy_move_file)
	(copy_move_directory)
	(copy_files):
	Pass G_FILE_COPY_TARGET_DEFAULT_PERMS flag to copy
	operations when the source file is in a readonly
	filesystem (eg. CDROM). Fixes #550816.

	* configure.in: Bump required glib version to 2.19.0
	to make use of aforementioned GFileCopyFlag.


Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/libnautilus-private/nautilus-file-operations.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Mon Sep 22 15:59:15 2008
@@ -5,7 +5,7 @@
 m4_define(bonobo_activation_minver,    2.1.0)
 m4_define(bonobo_minver,               2.1.0)
 m4_define(eel_minver,                  2.24.0)
-m4_define(glib_minver,                 2.17.5)
+m4_define(glib_minver,                 2.19.0)
 m4_define(gnome_desktop_minver,        2.9.91)
 m4_define(gnome_minver,                2.14.0)
 m4_define(gnome_ui_minver,             2.6.0)

Modified: trunk/libnautilus-private/nautilus-file-operations.c
==============================================================================
--- trunk/libnautilus-private/nautilus-file-operations.c	(original)
+++ trunk/libnautilus-private/nautilus-file-operations.c	Mon Sep 22 15:59:15 2008
@@ -3113,7 +3113,8 @@
 			    GHashTable *debuting_files,
 			    GdkPoint *point,
 			    gboolean overwrite,
-			    gboolean *skipped_file);
+			    gboolean *skipped_file,
+			    gboolean readonly_source_fs);
 
 typedef enum {
 	CREATE_DEST_DIR_RETRY,
@@ -3222,7 +3223,8 @@
 		     SourceInfo *source_info,
 		     TransferInfo *transfer_info,
 		     GHashTable *debuting_files,
-		     gboolean *skipped_file)
+		     gboolean *skipped_file,
+		     gboolean readonly_source_fs)
 {
 	GFileInfo *info;
 	GError *error;
@@ -3234,6 +3236,7 @@
 	gboolean skip_error;
 	gboolean local_skipped_file;
 	CommonJob *job;
+	GFileCopyFlags flags;
 
 	job = (CommonJob *)copy_job;
 	
@@ -3280,7 +3283,8 @@
 			src_file = g_file_get_child (src,
 						     g_file_info_get_name (info));
 			copy_move_file (copy_job, src_file, *dest, same_fs, FALSE, &dest_fs_type,
-					source_info, transfer_info, NULL, NULL, FALSE, &local_skipped_file);
+					source_info, transfer_info, NULL, NULL, FALSE, &local_skipped_file,
+					readonly_source_fs);
 			g_object_unref (src_file);
 			g_object_unref (info);
 		}
@@ -3373,9 +3377,11 @@
 	}
 
 	if (create_dest) {
+		flags = (readonly_source_fs) ? G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_TARGET_DEFAULT_PERMS 
+					     : G_FILE_COPY_NOFOLLOW_SYMLINKS;
 		/* Ignore errors here. Failure to copy metadata is not a hard error */
 		g_file_copy_attributes (src, *dest,
-					G_FILE_COPY_NOFOLLOW_SYMLINKS,
+					flags,
 					job->cancellable, NULL);
 	}
 
@@ -3639,7 +3645,8 @@
 		GHashTable *debuting_files,
 		GdkPoint *position,
 		gboolean overwrite,
-		gboolean *skipped_file)
+		gboolean *skipped_file,
+		gboolean readonly_source_fs)
 {
 	GFile *dest, *new_dest;
 	GError *error;
@@ -3716,6 +3723,10 @@
 	if (overwrite) {
 		flags |= G_FILE_COPY_OVERWRITE;
 	}
+	if (readonly_source_fs) {
+		flags |= G_FILE_COPY_TARGET_DEFAULT_PERMS;
+	}
+
 	pdata.job = copy_job;
 	pdata.last_size = 0;
 	pdata.source_info = source_info;
@@ -3960,7 +3971,8 @@
 		if (!copy_move_directory (copy_job, src, &dest, same_fs,
 					  would_recurse, dest_fs_type,
 					  source_info, transfer_info,
-					  debuting_files, skipped_file)) {
+					  debuting_files, skipped_file,
+					  readonly_source_fs)) {
 			/* destination changed, since it was an invalid file name */
 			g_assert (*dest_fs_type != NULL);
 			handled_invalid_filename = TRUE;
@@ -4026,13 +4038,21 @@
 	gboolean unique_names;
 	GFile *dest;
 	char *dest_fs_type;
+	GFileInfo *inf;
+	gboolean readonly_source_fs;
 
 	dest_fs_type = NULL;
+	readonly_source_fs = FALSE;
 
 	common = &job->common;
 
 	report_copy_progress (job, source_info, transfer_info);
 
+	inf = g_file_query_filesystem_info ((GFile *) job->files->data, "filesystem::readonly", NULL, NULL);
+	if (inf != NULL) {
+		readonly_source_fs = g_file_info_get_attribute_boolean (inf, "filesystem::readonly");
+	}
+
 	unique_names = (job->destination == NULL);
 	i = 0;
 	for (l = job->files;
@@ -4065,13 +4085,15 @@
 					&dest_fs_type,
 					source_info, transfer_info,
 					job->debuting_files,
-					point, FALSE, &skipped_file);
+					point, FALSE, &skipped_file,
+					readonly_source_fs);
 			g_object_unref (dest);
 		}
 		i++;
 	}
 
 	g_free (dest_fs_type);
+	g_object_unref (inf);
 }
 
 static gboolean
@@ -4593,7 +4615,7 @@
 				same_fs, FALSE, dest_fs_type,
 				source_info, transfer_info,
 				job->debuting_files,
-				point, fallback->overwrite, &skipped_file);
+				point, fallback->overwrite, &skipped_file, FALSE);
 		i++;
 	}
 }



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