[PATCH] Add 'Ignore ...' buttons to error msg window



Hi,

I'm sending a patch which adds the 'Ignore', 'Ignore all', 'Ignore similar'
buttons to error message window.


Description
-----------
The error message window shows some more buttons:
'Ignore all' - ignore all following errors
'Ignore similar' - ignore "this" specific error;
    "this" is based on error message displayed and
    is by now (can be easily enhanced to another)
    - 'cannot remove directory'
    - 'cannot chown file'
    - 'cannot cmmod file'
    - 'cannot stat file'
    This button is not shown for other errors.

'Ignore' - this is just renamed 'Skip' button, which now seems to
    be more logical with conjunction with names of other buttons

If error concerns only one file, the buttons 'Ignore all/similar' are
not shown.


Code changes
------------
In order to make no substantial changes to code handling the return
codes form file_error, all error ignoring was put into file_error,
do_file_error and real_file_error.

So these functions now take the context and a flag indicating specific
error to ignore.

Ignored flags are stored in context.


Things to discuss & possible enhancements
-----------------------------------------
Names of buttons - I hope the meaning and difference between
    'all' and 'similar' is clear. Maybe someone will find better.
Order of buttons - Maybe, 'similar' should go before 'all'.
Position of buttons - The query dialog puts all buttons into
    one line and with all these buttons, the window gets very wide
    (nearly full 80 columns). Breaking button line into more lines
    can be nice, but is not necessary now.

More buttons - More special decisions about places of show/not show errors.
    'Only this directory' - don't show error only in this dir
    'This dir. and subdirs' - --"-- and subdirs too

More specific errors to ignore -
    - file operations: delete, open, create
    - various symlink errors
    - etc
    Adding a new error to ignore is easy:
    1. add a constant FILE_x into fileopctx.h
    2. search through file.c and give this constant as a parameter to
       right file_error calls


David
Binary files mc/src/cons.saver and mc-ignore/src/cons.saver differ
diff -X .diffignore -urNp mc/src/file.c mc-ignore/src/file.c
--- mc/src/file.c	Fri Jun  6 20:17:53 2003
+++ mc-ignore/src/file.c	Tue Jun 10 16:13:15 2003
@@ -147,7 +147,7 @@ char *op_names[3] = {
 static int query_replace (FileOpContext * ctx, char *destname,
 			  struct stat *_s_stat, struct stat *_d_stat);
 static int query_recursive (FileOpContext * ctx, char *s);
-static int do_file_error (char *str);
+static int do_file_error (FileOpContext * ctx, FileErrorIgnoreSet ign, char *str);
 
 
 enum CaseConvs { NO_CONV = 0, UP_CHAR = 1, LOW_CHAR = 2, UP_SECT =
@@ -369,7 +369,8 @@ make_symlink (FileOpContext *ctx, char *
     len = mc_readlink (src_path, link_target, MC_MAXPATHLEN);
     if (len < 0) {
 	return_status =
-	    file_error (_(" Cannot read source link \"%s\" \n %s "),
+	    file_error (ctx, IGN_NONE,
+	    		_(" Cannot read source link \"%s\" \n %s "),
 			src_path);
 	if (return_status == FILE_RETRY)
 	    goto retry_src_readlink;
@@ -429,7 +430,8 @@ make_symlink (FileOpContext *ctx, char *
 		return FILE_CONT;
     }
     return_status =
-	file_error (_(" Cannot create target symlink \"%s\" \n %s "),
+	file_error (ctx, IGN_NONE,
+		    _(" Cannot create target symlink \"%s\" \n %s "),
 		    dst_path);
     if (return_status == FILE_RETRY)
 	goto retry_dst_symlink;
@@ -504,7 +506,8 @@ copy_file_file (FileOpContext *ctx, char
     if (mc_stat (dst_path, &sb2) == 0) {
 	if (S_ISDIR (sb2.st_mode)) {
 	    return_status =
-		file_error (_(" Cannot overwrite directory \"%s\" \n %s "),
+		file_error (ctx, IGN_NONE,
+	                    _(" Cannot overwrite directory \"%s\" \n %s "),
 			    dst_path);
 	    if (return_status == FILE_RETRY)
 		goto retry_dst_stat;
@@ -515,7 +518,8 @@ copy_file_file (FileOpContext *ctx, char
 
     while ((*ctx->stat_func) (src_path, &sb)) {
 	return_status =
-	    file_error (_(" Cannot stat source file \"%s\" \n %s "),
+	    file_error (ctx, IGN_STAT,
+	                _(" Cannot stat source file \"%s\" \n %s "),
 			src_path);
 	if (return_status != FILE_RETRY)
 	    return return_status;
@@ -570,8 +574,8 @@ copy_file_file (FileOpContext *ctx, char
 		   (dst_path, sb.st_mode & ctx->umask_kill,
 		    sb.st_rdev) < 0) {
 		return_status =
-		    file_error (_
-				(" Cannot create special file \"%s\" \n %s "),
+		    file_error (ctx, IGN_NONE,
+				_(" Cannot create special file \"%s\" \n %s "),
 				dst_path);
 		if (return_status == FILE_RETRY)
 		    continue;
@@ -583,8 +587,8 @@ copy_file_file (FileOpContext *ctx, char
 	    while (ctx->preserve_uidgid
 		   && mc_chown (dst_path, sb.st_uid, sb.st_gid)) {
 		temp_status =
-		    file_error (_
-				(" Cannot chown target file \"%s\" \n %s "),
+		    file_error (ctx, IGN_CHOWN,
+				_(" Cannot chown target file \"%s\" \n %s "),
 				dst_path);
 		if (temp_status == FILE_RETRY)
 		    continue;
@@ -595,8 +599,8 @@ copy_file_file (FileOpContext *ctx, char
 		   (mc_chmod (dst_path, sb.st_mode & ctx->umask_kill) <
 		    0)) {
 		temp_status =
-		    file_error (_
-				(" Cannot chmod target file \"%s\" \n %s "),
+		    file_error (ctx, IGN_CHMOD,
+				_(" Cannot chmod target file \"%s\" \n %s "),
 				dst_path);
 		if (temp_status == FILE_RETRY)
 		    continue;
@@ -610,7 +614,8 @@ copy_file_file (FileOpContext *ctx, char
 
     while ((src_desc = mc_open (src_path, O_RDONLY | O_LINEAR)) < 0) {
 	return_status =
-	    file_error (_(" Cannot open source file \"%s\" \n %s "),
+	    file_error (ctx, IGN_NONE,
+	                _(" Cannot open source file \"%s\" \n %s "),
 			src_path);
 	if (return_status == FILE_RETRY)
 	    continue;
@@ -628,7 +633,8 @@ copy_file_file (FileOpContext *ctx, char
 
     while (mc_fstat (src_desc, &sb)) {
 	return_status =
-	    file_error (_(" Cannot fstat source file \"%s\" \n %s "),
+	    file_error (ctx, IGN_STAT,
+			_(" Cannot fstat source file \"%s\" \n %s "),
 			src_path);
 	if (return_status == FILE_RETRY)
 	    continue;
@@ -654,7 +660,8 @@ copy_file_file (FileOpContext *ctx, char
 							  O_TRUNC)),
 				 0600)) < 0) {
 	return_status =
-	    file_error (_(" Cannot create target file \"%s\" \n %s "),
+	    file_error (ctx, IGN_NONE,
+	    		_(" Cannot create target file \"%s\" \n %s "),
 			dst_path);
 	if (return_status == FILE_RETRY)
 	    continue;
@@ -669,7 +676,8 @@ copy_file_file (FileOpContext *ctx, char
     /* Find out the optimal buffer size.  */
     while (mc_fstat (dest_desc, &sb)) {
 	return_status =
-	    file_error (_(" Cannot fstat target file \"%s\" \n %s "),
+	    file_error (ctx, IGN_STAT,
+	   		_(" Cannot fstat target file \"%s\" \n %s "),
 			dst_path);
 	if (return_status == FILE_RETRY)
 	    continue;
@@ -702,8 +710,8 @@ copy_file_file (FileOpContext *ctx, char
 	    else
 		while ((n_read = mc_read (src_desc, buf, buf_size)) < 0) {
 		    return_status =
-			file_error (_
-				    (" Cannot read source file \"%s\" \n %s "),
+			file_error (ctx, IGN_NONE,
+				    _(" Cannot read source file \"%s\" \n %s "),
 				    src_path);
 		    if (return_status == FILE_RETRY)
 			continue;
@@ -737,8 +745,8 @@ copy_file_file (FileOpContext *ctx, char
 			continue;
 		    }
 		    return_status =
-			file_error (_
-				    (" Cannot write target file \"%s\" \n %s "),
+			file_error (ctx, IGN_NONE,
+				    _(" Cannot write target file \"%s\" \n %s "),
 				    dst_path);
 		    if (return_status != FILE_RETRY)
 			goto ret;
@@ -803,7 +811,8 @@ copy_file_file (FileOpContext *ctx, char
 
     while (src_desc != -1 && mc_close (src_desc) < 0) {
 	temp_status =
-	    file_error (_(" Cannot close source file \"%s\" \n %s "),
+	    file_error (ctx, IGN_NONE,
+	   		_(" Cannot close source file \"%s\" \n %s "),
 			src_path);
 	if (temp_status == FILE_RETRY)
 	    continue;
@@ -814,7 +823,8 @@ copy_file_file (FileOpContext *ctx, char
 
     while (dest_desc != -1 && mc_close (dest_desc) < 0) {
 	temp_status =
-	    file_error (_(" Cannot close target file \"%s\" \n %s "),
+	    file_error (ctx, IGN_NONE,
+	   		_(" Cannot close target file \"%s\" \n %s "),
 			dst_path);
 	if (temp_status == FILE_RETRY)
 	    continue;
@@ -836,9 +846,10 @@ copy_file_file (FileOpContext *ctx, char
 #ifndef NATIVE_WIN32
 	if (!appending && ctx->preserve_uidgid) {
 	    while (mc_chown (dst_path, src_uid, src_gid)) {
-		temp_status = file_error
-		    (_(" Cannot chown target file \"%s\" \n %s "),
-		     dst_path);
+		temp_status =
+		    file_error (ctx, IGN_CHOWN,
+			_(" Cannot chown target file \"%s\" \n %s "),
+			dst_path);
 		if (temp_status == FILE_RETRY)
 		    continue;
 		return_status = temp_status;
@@ -854,8 +865,8 @@ copy_file_file (FileOpContext *ctx, char
 	if (!appending && ctx->preserve) {
 	    while (mc_chmod (dst_path, src_mode & ctx->umask_kill)) {
 		temp_status =
-		    file_error (_
-				(" Cannot chmod target file \"%s\" \n %s "),
+		    file_error (ctx, IGN_CHMOD,
+				_(" Cannot chmod target file \"%s\" \n %s "),
 				dst_path);
 		if (temp_status != FILE_RETRY) {
 		    return_status = temp_status;
@@ -898,7 +909,8 @@ copy_dir_dir (FileOpContext *ctx, char *
   retry_src_stat:
     if ((*ctx->stat_func) (s, &cbuf)) {
 	return_status =
-	    file_error (_(" Cannot stat source directory \"%s\" \n %s "),
+	    file_error (ctx, IGN_STAT,
+	   		_(" Cannot stat source directory \"%s\" \n %s "),
 			s);
 	if (return_status == FILE_RETRY)
 	    goto retry_src_stat;
@@ -924,8 +936,8 @@ copy_dir_dir (FileOpContext *ctx, char *
 
     if (!S_ISDIR (cbuf.st_mode)) {
 	return_status =
-	    file_error (_
-			(" Source directory \"%s\" is not a directory \n %s "),
+	    file_error (ctx, IGN_NONE,
+			_(" Source directory \"%s\" is not a directory \n %s "),
 			s);
 	if (return_status == FILE_RETRY)
 	    goto retry_src_stat;
@@ -969,8 +981,8 @@ copy_dir_dir (FileOpContext *ctx, char *
 	 */
 	if (!S_ISDIR (buf.st_mode)) {
 	    return_status =
-		file_error (_
-			    (" Destination \"%s\" must be a directory \n %s "),
+		file_error (ctx, IGN_NONE,
+			    _(" Destination \"%s\" must be a directory \n %s "),
 			    d);
 	    if (return_status == FILE_RETRY)
 		goto retry_dst_stat;
@@ -1000,7 +1012,8 @@ copy_dir_dir (FileOpContext *ctx, char *
   retry_dst_mkdir:
     if (my_mkdir (dest_dir, (cbuf.st_mode & ctx->umask_kill) | S_IRWXU)) {
 	return_status =
-	    file_error (_(" Cannot create target directory \"%s\" \n %s "),
+	    file_error (ctx, IGN_NONE,
+	   		_(" Cannot create target directory \"%s\" \n %s "),
 			dest_dir);
 	if (return_status == FILE_RETRY)
 	    goto retry_dst_mkdir;
@@ -1019,8 +1032,8 @@ copy_dir_dir (FileOpContext *ctx, char *
     if (ctx->preserve_uidgid) {
 	while (mc_chown (dest_dir, cbuf.st_uid, cbuf.st_gid)) {
 	    return_status =
-		file_error (_
-			    (" Cannot chown target directory \"%s\" \n %s "),
+		file_error (ctx, IGN_CHOWN,
+			    _(" Cannot chown target directory \"%s\" \n %s "),
 			    dest_dir);
 	    if (return_status != FILE_RETRY)
 		goto ret;
@@ -1123,7 +1136,9 @@ move_file_file (FileOpContext *ctx, char
     while (mc_lstat (s, &src_stats) != 0) {
 	/* Source doesn't exist */
 	return_status =
-	    file_error (_(" Cannot stat file \"%s\" \n %s "), s);
+	    file_error (ctx, IGN_CHOWN,
+	    	_(" Cannot stat file \"%s\" \n %s "),
+		s);
 	if (return_status != FILE_RETRY)
 	    return return_status;
     }
@@ -1211,7 +1226,9 @@ move_file_file (FileOpContext *ctx, char
   retry_src_remove:
     if (mc_unlink (s)) {
 	return_status =
-	    file_error (_(" Cannot remove file \"%s\" \n %s "), s);
+	    file_error (ctx, IGN_NONE,
+	    	_(" Cannot remove file \"%s\" \n %s "),
+		s);
 	if (return_status == FILE_RETRY)
 	    goto retry_src_remove;
 	return return_status;
@@ -1282,12 +1299,13 @@ move_dir_dir (FileOpContext *ctx, char *
 	} else {
 	    if (S_ISDIR (destbuf.st_mode))
 		return_status =
-		    file_error (_
-				(" Cannot overwrite directory \"%s\" %s "),
+		    file_error (ctx, IGN_NONE,
+				_(" Cannot overwrite directory \"%s\" %s "),
 				destdir);
 	    else
 		return_status =
-		    file_error (_(" Cannot overwrite file \"%s\" %s "),
+		    file_error (ctx, IGN_NONE,
+		   		_(" Cannot overwrite file \"%s\" %s "),
 				destdir);
 	    if (return_status == FILE_RETRY)
 		goto retry_dst_stat;
@@ -1312,8 +1330,8 @@ move_dir_dir (FileOpContext *ctx, char *
 
     if (errno != EXDEV) {
 	return_status =
-	    files_error (_
-			 (" Cannot move directory \"%s\" to \"%s\" \n %s "),
+	    files_error (ctx, IGN_NONE,
+			 _(" Cannot move directory \"%s\" to \"%s\" \n %s "),
 			 s, d);
 	if (return_status == FILE_RETRY)
 	    goto retry_rename;
@@ -1383,7 +1401,9 @@ erase_file (FileOpContext *ctx, char *s,
 
     while (mc_unlink (s)) {
 	return_status =
-	    file_error (_(" Cannot delete file \"%s\" \n %s "), s);
+	    file_error (ctx, IGN_NONE,
+	    	_(" Cannot delete file \"%s\" \n %s "),
+		s);
 	if (return_status != FILE_RETRY)
 	    return return_status;
     }
@@ -1443,7 +1463,9 @@ recursive_erase (FileOpContext *ctx, cha
 
     while (my_rmdir (s)) {
 	return_status =
-	    file_error (_(" Cannot remove directory \"%s\" \n %s "), s);
+	    file_error (ctx, IGN_RMDIR,
+	    	_(" Cannot remove directory \"%s\" \n %s "),
+		s);
 	if (return_status != FILE_RETRY)
 	    return return_status;
     }
@@ -1512,7 +1534,9 @@ erase_dir (FileOpContext *ctx, char *s, 
 
     while (my_rmdir (s) == -1) {
 	error =
-	    file_error (_(" Cannot remove directory \"%s\" \n %s "), s);
+	    file_error (ctx, IGN_RMDIR,
+	   	_(" Cannot remove directory \"%s\" \n %s "),
+		s);
 	if (error != FILE_RETRY)
 	    return error;
     }
@@ -1540,7 +1564,9 @@ erase_dir_iff_empty (FileOpContext *ctx,
 
     while (my_rmdir (s)) {
 	error =
-	    file_error (_(" Cannot remove directory \"%s\" \n %s "), s);
+	    file_error (ctx, IGN_NONE,
+	   	_(" Cannot remove directory \"%s\" \n %s "),
+		s);
 	if (error != FILE_RETRY)
 	    return error;
     }
@@ -1834,6 +1860,10 @@ panel_operate (void *source_panel, FileO
 
     ctx = file_op_context_new ();
 
+    /* Don't show 'Ignore all/similar' buttons to one file */
+    if (only_one)
+    	IGNORE_ONE_SET(ctx);
+
     do_bg = 0;
     free_linklist (&linklist);
     free_linklist (&dest_dirs);
@@ -2010,8 +2040,8 @@ panel_operate (void *source_panel, FileO
 	  retry_many_dst_stat:
 	    dst_result = mc_stat (dest, &dst_stat);
 	    if (dst_result == 0 && !S_ISDIR (dst_stat.st_mode)) {
-		if (file_error
-		    (_(" Destination \"%s\" must be a directory \n %s "),
+		if (file_error (ctx, IGN_NONE,
+		     _(" Destination \"%s\" must be a directory \n %s "),
 		     dest) == FILE_RETRY)
 		    goto retry_many_dst_stat;
 		goto clean_up;
@@ -2167,15 +2197,26 @@ panel_operate (void *source_panel, FileO
 /* {{{ Query/status report routines */
 
 static int
-real_do_file_error (enum OperationMode mode, char *error)
+real_do_file_error (FileOpContext * ctx, enum OperationMode mode,
+		    FileErrorIgnoreSet ign, char *error)
 {
     int result;
     char *msg;
 
-    msg = mode == Foreground ? MSG_ERROR : _(" Background process error ");
-    result =
-	query_dialog (msg, error, D_ERROR, 3, _("&Skip"), _("&Retry"),
-		      _("&Abort"));
+    msg = (mode == Foreground) ? MSG_ERROR : _(" Background process error ");
+    if (!ctx || IGNORE_ONE(ctx)) {
+	result =
+	    query_dialog (msg, error, D_ERROR, 3, _("&Ignore"), _("&Retry"),
+			  _("&Abort"));
+    } else if (ign == IGN_NONE) {
+	result =
+	    query_dialog (msg, error, D_ERROR, 4, _("&Ignore"), _("&Retry"),
+			  _("&Abort"), _("Ignore a&ll"));
+    } else {
+	result =
+	    query_dialog (msg, error, D_ERROR, 5, _("&Ignore"), _("&Retry"),
+			  _("&Abort"), _("Ignore a&ll"), _("Ignore &similar"));
+    }
 
     switch (result) {
     case 0:
@@ -2186,6 +2227,16 @@ real_do_file_error (enum OperationMode m
 	do_refresh ();
 	return FILE_RETRY;
 
+    case 3:
+	IGNORE_ALL_SET (ctx);
+    	do_refresh ();
+	return FILE_SKIP;
+
+    case 4:
+	IGNORE_SET (ctx, ign);
+    	do_refresh ();
+	return FILE_SKIP;
+
     case 2:
     default:
 	return FILE_ABORT;
@@ -2194,28 +2245,36 @@ real_do_file_error (enum OperationMode m
 
 /* Report error with one file */
 int
-file_error (char *format, char *file)
+file_error (FileOpContext * ctx, FileErrorIgnoreSet ign,
+	    char *format, char *file)
 {
+    if (IGNORE_ALL(ctx) || IGNORE_TEST(ctx,ign))
+    	return FILE_SKIP;
+
     g_snprintf (cmd_buf, sizeof (cmd_buf), format,
 		name_trunc (file, 30), unix_error_string (errno));
 
-    return do_file_error (cmd_buf);
+    return do_file_error (ctx, ign, cmd_buf);
 }
 
 /* Report error with two files */
 int
-files_error (char *format, char *file1, char *file2)
+files_error (FileOpContext * ctx, FileErrorIgnoreSet ign,
+	     char *format, char *file1, char *file2)
 {
     char nfile1[16];
     char nfile2[16];
 
+    if (IGNORE_ALL(ctx) || IGNORE_TEST(ctx,ign))
+    	return FILE_SKIP;
+
     strcpy (nfile1, name_trunc (file1, 15));
     strcpy (nfile2, name_trunc (file2, 15));
 
     g_snprintf (cmd_buf, sizeof (cmd_buf), format, nfile1, nfile2,
 		unix_error_string (errno));
 
-    return do_file_error (cmd_buf);
+    return do_file_error (ctx, ign, cmd_buf);
 }
 
 static int
@@ -2263,13 +2322,14 @@ real_query_recursive (FileOpContext *ctx
 
 #ifdef WITH_BACKGROUND
 static int
-do_file_error (char *str)
+do_file_error (FileOpContext * ctx, FileErrorIgnoreSet ign, char *str)
 {
     if (we_are_background)
-	return parent_call (real_do_file_error, NULL, 1, strlen (str),
-			    str);
+	return parent_call (real_do_file_error, ctx, 2,
+		sizeof(FileErrorIgnoreSet), &ign,
+		strlen (str), str);
     else
-	return real_do_file_error (Foreground, str);
+	return real_do_file_error (ctx, Foreground, ign, str);
 }
 
 static int
@@ -2299,9 +2359,9 @@ query_replace (FileOpContext *ctx, char 
 
 #else
 static int
-do_file_error (char *str)
+do_file_error (FileOpContext * ctx, FileErrorIgnoreSet ign, char *str);
 {
-    return real_do_file_error (Foreground, str);
+    return real_do_file_error (ctx, Foreground, ign, str);
 }
 
 static int
diff -X .diffignore -urNp mc/src/file.h mc-ignore/src/file.h
--- mc/src/file.h	Sun Dec  8 19:59:50 2002
+++ mc-ignore/src/file.h	Tue Jun 10 12:50:13 2003
@@ -30,10 +30,10 @@ extern int file_op_compute_totals;
 
 /* Error reporting routines */
     /* Report error with one file */
-    int file_error (char *format, char *file);
+    int file_error (FileOpContext *ctx, FileErrorIgnoreSet ign, char *format, char *file);
 
     /* Report error with two files */
-    int files_error (char *format, char *file1, char *file2);
+    int files_error (FileOpContext *ctx, FileErrorIgnoreSet ign, char *format, char *file1, char *file2);
 
 /* Query routines */
 
diff -X .diffignore -urNp mc/src/fileopctx.c mc-ignore/src/fileopctx.c
--- mc/src/fileopctx.c	Thu Dec 26 20:04:10 2002
+++ mc-ignore/src/fileopctx.c	Tue Jun 10 14:32:10 2003
@@ -51,6 +51,7 @@ file_op_context_new (void)
     ctx->preserve_uidgid = (geteuid () == 0) ? TRUE : FALSE;
     ctx->umask_kill = 0777777;
     ctx->erase_at_end = TRUE;
+    ctx->ignore_set = IGN_NONE;
 
     return ctx;
 }
diff -X .diffignore -urNp mc/src/fileopctx.h mc-ignore/src/fileopctx.h
--- mc/src/fileopctx.h	Fri Jun  6 20:17:55 2003
+++ mc-ignore/src/fileopctx.h	Tue Jun 10 15:04:41 2003
@@ -52,6 +52,16 @@ typedef struct {
 	/* Controls appending to files */
 	int do_append;
 
+	/* Ignore errors (all, similar, in current directory) */
+	/* contains flags of ignored errors:
+	 * IGN_RMDIR - ignores error on dir removal
+	 * IGN_CHOWN
+	 * IGN_CHMOD
+	 * IGN_STAT - ignore 'cannot stat' error
+	 * IGN_ALL - all previous
+	 */
+	int ignore_set;
+
 	/* Whether to stat or lstat */
 	int follow_links;
 
@@ -129,6 +139,27 @@ typedef enum {
     RECURSIVE_NEVER,
     RECURSIVE_ABORT
 } FileCopyMode;
+
+typedef enum {
+    IGN_NONE = 0,
+    IGN_RMDIR = 1<<0,
+    IGN_CHOWN = 1<<1,
+    IGN_CHMOD = 1<<2,
+    IGN_STAT = 1<<3,
+
+    IGN_LAST_FLAG = 1<<4,
+    IGN_MASK = (IGN_LAST_FLAG)-1,
+
+    IGN_ONE = 1<<8,	/* should not display 'ignore all/similar' for one file*/
+    IGN_ALL = 1<<9
+} FileErrorIgnoreSet;
+
+#define IGNORE_TEST(ctx,flag)	((ctx)->ignore_set & (flag) & IGN_MASK)
+#define IGNORE_SET(ctx,flag)	((ctx)->ignore_set |= ((flag) & IGN_MASK))
+#define IGNORE_ONE(ctx)	((ctx)->ignore_set & (IGN_ONE))
+#define IGNORE_ONE_SET(ctx)	((ctx)->ignore_set |= IGN_ONE)
+#define IGNORE_ALL_SET(ctx)	((ctx)->ignore_set |= IGN_ALL)
+#define IGNORE_ALL(ctx)		((ctx)->ignore_set & IGN_ALL)
 
 /* First argument passed to real functions */
 enum OperationMode {
Binary files mc/src/man2hlp and mc-ignore/src/man2hlp differ
Binary files mc/src/mc and mc-ignore/src/mc differ
Binary files mc/src/mcmfmt and mc-ignore/src/mcmfmt differ
diff -X .diffignore -urNp mc/src/tree.c mc-ignore/src/tree.c
--- mc/src/tree.c	Mon Mar 10 21:27:55 2003
+++ mc-ignore/src/tree.c	Tue Jun 10 13:22:11 2003
@@ -702,7 +702,7 @@ static void tree_move (WTree *tree, char
 	return;
     }
     if (!S_ISDIR (buf.st_mode)){
-	file_error (_(" Destination \"%s\" must be a directory \n %s "),
+	file_error (NULL, IGN_NONE, _(" Destination \"%s\" must be a directory \n %s "),
 		    dest);
 	g_free (dest);
 	return;
2003-06-10  David Sterba  <dave jikos cz>

	Add 'Ignore ...' buttons to error message dialogs
	* fileopctx.h: New item containing ignore flags into context.
	New macros to test/set flags.
	* fileopctx.c (file_op_context_new): Init the item.

	* file.h: Add params to file_error, files_error.
	* file.c: Add params to do_file_error, real_do_file_error.
	Adjust all callers of file_error, files_error, do_file_error.
	(do_file_error): Update background processing
	(real_do_file_error): Add params and update all callers, namely
	while background processing.
	Add options to query dialog and handle result (set ignored flags).
	(file_error, files_error): Test for ignored flags and don't display
	message.

	* tree.c: Adjust caller of file_error.



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