Browse Source

* doc/mc.1.in: Update the documentation to reflect the fact that
confirmation may be requested when deleting directory hotlist entries
based on a user configurable setting.
* src/file.h (safe_delete): Move declaration of `safe_delete'
* src/main.h: ... here.
(confirm_directory_hotlist_delete): Declare new global variable.
* src/file.c (safe_delete): Move definition of `safe_delete'
* src/main.c: ... here.
(confirm_directory_hotlist_delete): Define new global variable.
* src/hotlist.c (remove_from_hotlist): Based on a user configurable
setting, request confirmation when removing directory hotlist
entries. The confirmation dialog honours the `Safe delete'
setting.
Reorder the buttons in the hotlist group removal confirmation
dialog so that it becomes consistent with other confirmation
boxes.
* src/setup.c (int_options): Add support for user configurable
confirmation of directory hotlist entries removal.
* src/boxes.c (conf_widgets): Likewise.
(confirm_box): Likewise.
(my_directory_hotlist_delete): New module variable.

Pavel Tsekov 19 years ago
parent
commit
04000dcf84
10 changed files with 71 additions and 13 deletions
  1. 6 0
      ChangeLog
  2. 6 5
      doc/mc.1.in
  3. 21 0
      src/ChangeLog
  4. 6 1
      src/boxes.c
  5. 0 3
      src/file.c
  6. 0 2
      src/file.h
  7. 23 2
      src/hotlist.c
  8. 6 0
      src/main.c
  9. 2 0
      src/main.h
  10. 1 0
      src/setup.c

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+2006-01-29  Pavel Tsekov  <ptsekov@gmx.net>
+
+	* doc/mc.1.in: Update the documentation to reflect the fact
+	that confirmation may be requested when deleting directory
+	hotlist entries based on a user configurable setting.
+
 2006-01-29  Julian Mehnle  <julian@mehnle.net>
 
 	* doc/mc.1.in: Document support for VIEWER environment variable.

+ 6 - 5
doc/mc.1.in

@@ -1731,10 +1731,10 @@ through a link will move you to the current directory's real parent
 and not to the directory where the link was present.
 .PP
 .I Safe delete.
-If this option is enabled, deleting files unintentionally becomes more
-difficult.  The default selection in the confirmation dialogs for
-deletion changes from "Yes" to "No".  This option is disabled by
-default.
+If this option is enabled, deleting files and directory hotlist entries
+unintentionally becomes more difficult.  The default selection in the
+confirmation dialogs for deletion changes from "Yes" to "No".
+This option is disabled by default.
 .\"NODE "    Layout"
 .SH "    Layout"
 The layout dialog gives you a possibility to change the general layout
@@ -1783,7 +1783,8 @@ option.
 .\"NODE "    Confirmation"
 .SH "    Confirmation"
 In this menu you configure the confirmation options for file deletion,
-overwriting, execution by pressing enter and quitting the program.
+directory hotlist entries deletion, overwriting, execution by pressing
+enter and quitting the program.
 .\"NODE "    Display bits"
 .SH "    Display bits"
 This is used to configure the range of visible characters on the

+ 21 - 0
src/ChangeLog

@@ -1,3 +1,24 @@
+2006-01-29  Pavel Tsekov  <ptsekov@gmx.net>
+
+	* file.h (safe_delete): Move declaration of `safe_delete'
+	* main.h: ... here.
+	(confirm_directory_hotlist_delete): Declare new global variable.
+	* file.c (safe_delete): Move definition of `safe_delete'
+	* main.c: ... here.
+	(confirm_directory_hotlist_delete): Define new global variable.
+	* hotlist.c (remove_from_hotlist): Based on a user configurable
+	setting, request confirmation when removing directory hotlist
+	entries. The confirmation dialog honours the `Safe delete'
+	setting.
+	Reorder the buttons in the hotlist group removal confirmation
+	dialog so that it becomes consistent with other confirmation
+	boxes.
+	* setup.c (int_options): Add support for user configurable
+	confirmation of directory hotlist entries removal.
+	* boxes.c (conf_widgets): Likewise.
+	(confirm_box): Likewise.
+	(my_directory_hotlist_delete): New module variable.
+
 2006-01-29  Pavel Tsekov  <ptsekov@gmx.net>
 
 	* dir.c (do_sort): Do not try to reorder the entries so

+ 6 - 1
src/boxes.c

@@ -361,10 +361,11 @@ sort_box (sortfn *sort_fn, int *reverse, int *case_sensitive)
     return result;
 }
 
-#define CONFY 10
+#define CONFY 11
 #define CONFX 46
 
 static int my_delete;
+static int my_directory_hotlist_delete;
 static int my_overwrite;
 static int my_execute;
 static int my_exit;
@@ -375,6 +376,8 @@ static QuickWidget conf_widgets [] = {
 { quick_button,   4, 6, 3, CONFY, N_("&OK"),
       0, B_ENTER, 0, 0, "o" },
 
+{ quick_checkbox, 1, 13, 7, CONFY, N_(" confirm di&Rectory hotlist delete "),
+      11, 0, &my_directory_hotlist_delete, NULL, NULL },
 { quick_checkbox, 1, 13, 6, CONFY, N_(" confirm &Exit "),
       9, 0, &my_exit, 0, "e" },
 { quick_checkbox, 1, 13, 5, CONFY, N_(" confirm e&Xecute "),
@@ -440,12 +443,14 @@ confirm_box (void)
     my_overwrite = confirm_overwrite;
     my_execute   = confirm_execute;
     my_exit      = confirm_exit;
+    my_directory_hotlist_delete = confirm_directory_hotlist_delete;
 
     if (quick_dialog (&confirmation) != B_CANCEL){
 	confirm_delete    = my_delete;
 	confirm_overwrite = my_overwrite;
 	confirm_execute   = my_execute;
 	confirm_exit      = my_exit;
+	confirm_directory_hotlist_delete = my_directory_hotlist_delete;
     }
 }
 

+ 0 - 3
src/file.c

@@ -86,9 +86,6 @@ int verbose = 1;
  */
 int file_op_compute_totals = 1;
 
-/* If on, default for "No" in delete operations */
-int safe_delete = 0;
-
 /* This is a hard link cache */
 struct link {
     struct link *next;

+ 0 - 2
src/file.h

@@ -3,8 +3,6 @@
 
 #include "fileopctx.h"
 
-extern int safe_delete;
-
 struct link;
 
 int copy_file_file (FileOpContext *ctx, const char *s, const char *d,

+ 23 - 2
src/hotlist.c

@@ -1054,6 +1054,27 @@ static void remove_group (struct hotlist *grp)
 	
 static void remove_from_hotlist (struct hotlist *entry)
 {
+    if (confirm_directory_hotlist_delete) {
+	char *title;
+	int result;
+
+	title = g_strconcat (N_(" Remove: "),
+				   name_trunc (entry->label, 30),
+				   " ",
+				   NULL);
+
+	if (safe_delete)
+	    query_set_sel (1);
+	result = query_dialog (title,
+			_("\n Are you sure you want to remove this entry?"),
+			D_ERROR, 2, N_("&Yes"), N_("&No"));
+
+	g_free (title);
+
+	if (result == 1)
+	    return;
+    }
+
     if (entry->type == HL_TYPE_GROUP) {
 	if (entry->head) {
 	    char *header;
@@ -1065,10 +1086,10 @@ static void remove_from_hotlist (struct hotlist *entry)
 				   NULL);
 	    result = query_dialog (header, _("\n Group not empty.\n Remove it?"),
 				   D_ERROR, 2,
-				   _("&No"), _("&Yes"));
+				   _("&Yes"), _("&No"));
 	    g_free (header);
 
-	    if (result != 1)
+	    if (result == 1)
 		return;
 	}
 

+ 6 - 0
src/main.c

@@ -195,12 +195,18 @@ Mouse_Type use_mouse_p = MOUSE_NONE;
 /* If true, assume we are running on an xterm terminal */
 static int force_xterm = 0;
 
+/* If on, default for "No" in delete operations */
+int safe_delete = 0;
+
 /* Controls screen clearing before an exec */
 int clear_before_exec = 1;
 
 /* Asks for confirmation before deleting a file */
 int confirm_delete = 1;
 
+/* Asks for confirmation before deleting a hotlist entry */
+int confirm_directory_hotlist_delete = 1;
+
 /* Asks for confirmation before overwriting a file */
 int confirm_overwrite = 1;
 

+ 2 - 0
src/main.h

@@ -55,7 +55,9 @@ extern int cd_symlinks;
 extern int show_all_if_ambiguous;
 extern int slow_terminal;
 extern int update_prompt;	/* To comunicate with subshell */
+extern int safe_delete;
 extern int confirm_delete;
+extern int confirm_directory_hotlist_delete;
 extern int confirm_execute;
 extern int confirm_exit;
 extern int confirm_overwrite;

+ 1 - 0
src/setup.c

@@ -158,6 +158,7 @@ static const struct {
     { "confirm_overwrite", &confirm_overwrite },
     { "confirm_execute", &confirm_execute },
     { "confirm_exit", &confirm_exit },
+    { "confirm_directory_hotlist_delete", &confirm_directory_hotlist_delete },
     { "safe_delete", &safe_delete },
     { "mouse_repeat_rate", &mou_auto_repeat },
     { "double_click_speed", &double_click_speed },