Ticket #3514: skip-is-same-file-option.patch

File skip-is-same-file-option.patch, 2.8 KB (added by nkedel, 9 years ago)

Patch to add a "skip same file errors" option to the confirmation dialog.

Line 
1From:   nate@sfchat.org
2Sent:   Wednesday, August 12, 2015 1:59 PM
3To:     Nate Edel
4
5Importance:     High
6
7From e7253945f906344c08ca6cedce0667e112661589 Mon Sep 17 00:00:00 2001
8From: Nate Edel <nate.edel@gmail.com>
9Date: Wed, 12 Aug 2015 13:52:44 -0700
10Subject: [PATCH] Skip confirmation on same files, as I have a lot of symlinks
11
12---
13 src/filemanager/boxes.c | 2 ++
14 src/filemanager/file.c  | 1 +
15 src/setup.c             | 3 +++
16 src/setup.h             | 1 +
17 4 files changed, 7 insertions(+)
18
19diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c
20index e153e5f..56f6dad 100644
21--- a/src/filemanager/boxes.c
22+++ b/src/filemanager/boxes.c
23@@ -930,6 +930,8 @@ confirm_box (void)
24                         &confirm_directory_hotlist_delete, NULL),
25         QUICK_CHECKBOX (Q_("Confirmation|&History cleanup"),
26                         &mc_global.widget.confirm_history_cleanup, NULL),
27+        QUICK_CHECKBOX (Q_("Confirmation|Skip &same file"),
28+                        &confirm_skip_same_file, NULL),
29         QUICK_BUTTONS_OK_CANCEL,
30         QUICK_END
31         /* *INDENT-ON* */
32diff --git a/src/filemanager/file.c b/src/filemanager/file.c
33index 0bacc54..58bc1f2 100644
34--- a/src/filemanager/file.c
35+++ b/src/filemanager/file.c
36@@ -645,6 +645,7 @@ real_warn_same_file (enum OperationMode mode, const char *fmt, const char
37*a, co
38 static FileProgressStatus
39 warn_same_file (const char *fmt, const char *a, const char *b)
40 {
41+    if (!confirm_skip_same_file) return FILE_SKIP;
42 #ifdef ENABLE_BACKGROUND
43 /* *INDENT-OFF* */
44     union
45diff --git a/src/setup.c b/src/setup.c
46index 5cd32ab..65c195d 100644
47--- a/src/setup.c
48+++ b/src/setup.c
49@@ -101,6 +101,8 @@ int confirm_overwrite = 1;
50 int confirm_execute = 0;
51 /* Asks for confirmation before leaving the program */
52 int confirm_exit = 0;
53+/* Shows skip/abort message when copying over the same file/inode */
54+int confirm_skip_same_file = 1;
55 
56 /* If true, at startup the user-menu is invoked */
57 int auto_menu = 0;
58@@ -289,6 +291,7 @@ static const struct
59     { "confirm_history_cleanup", &mc_global.widget.confirm_history_cleanup },
60     { "confirm_exit", &confirm_exit },
61     { "confirm_directory_hotlist_delete", &confirm_directory_hotlist_delete },
62+    { "confirm_skip_same_file", &confirm_skip_same_file },
63     { "safe_delete", &safe_delete },
64     { "mouse_repeat_rate", &mou_auto_repeat },
65     { "double_click_speed", &double_click_speed },
66diff --git a/src/setup.h b/src/setup.h
67index 203ca30..d41ba5f 100644
68--- a/src/setup.h
69+++ b/src/setup.h
70@@ -80,6 +80,7 @@ extern int confirm_execute;
71 extern int confirm_exit;
72 extern int confirm_overwrite;
73 extern int confirm_view_dir;
74+extern int confirm_skip_same_file;
75 extern int safe_delete;
76 extern int clear_before_exec;
77 extern int auto_menu;
78--
792.5.0
80