Commit 95e4165b authored by Nelson Benítez León's avatar Nelson Benítez León Committed by Nelson Benítez León

Pass G_FILE_COPY_TARGET_DEFAULT_PERMS flag to copy operations when the

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.

svn path=/trunk/; revision=14661
parent 46085d80
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.
2008-09-22 Christian Neumair <cneumair@gnome.org>
* libnautilus-private/nautilus-file.c
......
......@@ -5,7 +5,7 @@ dnl ===========================================================================
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)
......
......@@ -3113,7 +3113,8 @@ static void copy_move_file (CopyMoveJob *job,
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 @@ copy_move_directory (CopyMoveJob *copy_job,
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 @@ copy_move_directory (CopyMoveJob *copy_job,
gboolean skip_error;
gboolean local_skipped_file;
CommonJob *job;
GFileCopyFlags flags;
job = (CommonJob *)copy_job;
......@@ -3280,7 +3283,8 @@ copy_move_directory (CopyMoveJob *copy_job,
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 @@ copy_move_directory (CopyMoveJob *copy_job,
}
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 @@ copy_move_file (CopyMoveJob *copy_job,
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 @@ copy_move_file (CopyMoveJob *copy_job,
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 @@ copy_move_file (CopyMoveJob *copy_job,
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 @@ copy_files (CopyMoveJob *job,
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 @@ copy_files (CopyMoveJob *job,
&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 @@ common = &job->common;
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++;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment