nautilus r14968 - in trunk: . libnautilus-private
- From: alexl svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus r14968 - in trunk: . libnautilus-private
- Date: Wed, 18 Feb 2009 16:06:40 +0000 (UTC)
Author: alexl
Date: Wed Feb 18 16:06:40 2009
New Revision: 14968
URL: http://svn.gnome.org/viewvc/nautilus?rev=14968&view=rev
Log:
2009-02-18 Alexander Larsson <alexl redhat com>
Bug 565610 â Replacing folder with file from within that folder destroys both
* libnautilus-private/nautilus-file-operations.c:
(copy_move_file):
Give a warning when the source would be overwritten by the
destination on a copy.
Modified:
trunk/ChangeLog
trunk/libnautilus-private/nautilus-file-operations.c
Modified: trunk/libnautilus-private/nautilus-file-operations.c
==============================================================================
--- trunk/libnautilus-private/nautilus-file-operations.c (original)
+++ trunk/libnautilus-private/nautilus-file-operations.c Wed Feb 18 16:06:40 2009
@@ -3784,6 +3784,41 @@
goto out;
}
+
+ /* Don't allow copying over the source or one of the parents of the source.
+ */
+ if (test_dir_is_parent (src, dest)) {
+ 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 file over itself."))
+ : g_strdup (_("You cannot copy a file over itself."));
+ secondary = g_strdup (_("The source file is overwritten by the destination."));
+
+ response = run_warning (job,
+ primary,
+ secondary,
+ NULL,
+ (source_info->num_files - transfer_info->num_files) > 1,
+ 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:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]