From 161a5af516f0be93d79727f9a5b5b92c931bfefc Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Thu, 22 Nov 2012 13:55:38 +0400 Subject: [PATCH] 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 --- lib/widget/button.c | 10 +++------- lib/widget/button.h | 1 + 2 files changed, 4 insertions(+), 7 deletions(-) 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 ***************************************************************************************/ -- 2.11.4.GIT