From: Andrew Borodin Date: Thu, 22 Nov 2012 09:55:38 +0000 (+0400) Subject: Ticket #2111: allow pause in copy/move/delete file operation. X-Git-Tag: 4.8.7~6^2~2 X-Git-Url: https://repo.or.cz/w/midnight-commander.git/commitdiff_plain/161a5af516f0be93d79727f9a5b5b92c931bfefc Ticket #2111: allow pause in copy/move/delete file operation. Initial step: if button callback retuns zero, don't close the dialog after button press. Signed-off-by: Andrew Borodin --- diff --git a/lib/widget/button.c b/lib/widget/button.c index 0c1b5fc90..4740f9373 100644 --- a/lib/widget/button.c +++ b/lib/widget/button.c @@ -59,7 +59,6 @@ button_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void * { WButton *b = BUTTON (w); WDialog *h = w->owner; - int stop = 0; int off = 0; switch (msg) @@ -94,13 +93,10 @@ button_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void * if (parm != ' ' && parm != '\n') return MSG_NOT_HANDLED; - if (b->callback != NULL) - stop = b->callback (b, b->action); - if (b->callback == NULL || stop != 0) - { - h->ret_value = b->action; + h->ret_value = b->action; + if (b->callback == NULL || b->callback (b, b->action) != 0) dlg_stop (h); - } + return MSG_HANDLED; case MSG_CURSOR: diff --git a/lib/widget/button.h b/lib/widget/button.h index dccb2b26b..f85be8b3c 100644 --- a/lib/widget/button.h +++ b/lib/widget/button.h @@ -13,6 +13,7 @@ struct WButton; /* button callback */ +/* return 0 to continue work with dialog, non-zero to close */ typedef int (*bcback_fn) (struct WButton * button, int action); /*** enums ***************************************************************************************/