Re: mc: Could you add a "Skip all" if the source file can't be read?
- From: Miven Dooligan <dooligan intergate ca>
- To: mc-devel <mc-devel gnome org>
- Subject: Re: mc: Could you add a "Skip all" if the source file can't be read?
- Date: Tue, 12 Nov 2002 16:49:11 -0800
Howdy.
Pavel wrote:
>>It's already in TODO for version 4.6.1:
>>
>>Add "Ignore" and "Ignore all" buttons when reporting permission
problems.
>>
>
Some thoughts on this one, because I've trying to figure out the
best way to do exactly this thing for a little while (Thanks Adrian
for bringing it up again.) Spare time programming, eh?
It is no problem changing the real_do_file_error() to show "Ignore All"
as an option but there is the legitimate issue that it shouldn't say
that if you're only operating on one file. How do we communicate that
to file_error?
My solution was to ignore the above problem, and just do something that
works. I changed real_do_file_error() to show
"[Ignore] [Ignore All] [Retry] [Abort]"
every time, just to get the utility in there.
Next I added a global var to fileopcx.h "file_op_ignore_errors" that
gets set to 0 at the beginning of any panel_operate() call, and gets set
to 1 inside real_do_file_error if you press [Ignore All]. do_file_error
(both of them) then checks file_op_ignore_errors and skips the dialog
(returning FILE_SKIP) if it is 1.
I'm no guru, but its a quick&dirty solution that seems to work.
Attached is the patch, for those interested. If anyone wants to beat on
it, I'm sure it needs some refining.
--- mc-cvs-4.6.0-pre1b-021104/src/file.c Thu Oct 24 13:25:07 2002
+++ mc-draft-4.6.0-pre1b-021104/src/file.c Tue Nov 12 16:33:10 2002
@@ -1974,6 +1974,8 @@
source_with_path = concat_dir_and_file (panel->cwd, source);
#endif /* WITH_FULL_PATHS */
+ file_op_ignore_errors = 0;
+
if (operation == OP_DELETE) {
if (S_ISDIR (src_stat.st_mode))
value = erase_dir (ctx, source_with_path, &count, &bytes);
@@ -2204,7 +2206,7 @@
msg = mode == Foreground ? MSG_ERROR : _(" Background process error ");
result =
- query_dialog (msg, error, D_ERROR, 3, _("&Skip"), _("&Retry"),
+ query_dialog (msg, error, D_ERROR, 4, _("&Ignore"), _("Ignore All"), _("&Retry"),
_("&Abort"));
switch (result) {
@@ -2214,9 +2216,14 @@
case 1:
do_refresh ();
- return FILE_RETRY;
+ file_op_ignore_errors = 1;
+ return FILE_SKIP;
case 2:
+ do_refresh ();
+ return FILE_RETRY;
+
+ case 3:
default:
return FILE_ABORT;
}
@@ -2295,11 +2302,13 @@
static int
do_file_error (char *str)
{
- if (we_are_background)
- return parent_call (real_do_file_error, NULL, 1, strlen (str),
+ if ( ! file_op_ignore_errors ) {
+ if (we_are_background)
+ return parent_call (real_do_file_error, NULL, 1, strlen (str),
str);
- else
- return real_do_file_error (Foreground, str);
+ else
+ return real_do_file_error (Foreground, str);
+ } else return FILE_SKIP;
}
static int
@@ -2331,7 +2340,9 @@
static int
do_file_error (char *str)
{
- return real_do_file_error (Foreground, str);
+ if ( ! file_op_ignore_errors ) {
+ return real_do_file_error (Foreground, str);
+ } else return FILE_SKIP;
}
static int
--- mc-cvs-4.6.0-pre1b-021104/src/fileopctx.h Wed Oct 23 01:26:16 2002
+++ mc-draft-4.6.0-pre1b-021104/src/fileopctx.h Tue Nov 12 16:29:31 2002
@@ -121,6 +121,7 @@
FILE_SKIP,
FILE_ABORT
} FileProgressStatus;
+int file_op_ignore_errors;
typedef enum {
RECURSIVE_YES,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]