mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-08 20:41:59 +03:00
Ask user before exit if there are opened screens in MC.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
768f48de29
commit
15a7b10191
@ -129,6 +129,12 @@ dialog_switch_remove (Dlg_head *h)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
dialog_switch_num (void)
|
||||||
|
{
|
||||||
|
return g_list_length (mc_dialogs);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dialog_switch_next (void)
|
dialog_switch_next (void)
|
||||||
{
|
{
|
||||||
|
@ -2,10 +2,13 @@
|
|||||||
#ifndef MC_DIALOG_SWITCH_H
|
#ifndef MC_DIALOG_SWITCH_H
|
||||||
#define MC_DIALOG_SWITCH_H
|
#define MC_DIALOG_SWITCH_H
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
struct Dlg_head;
|
struct Dlg_head;
|
||||||
|
|
||||||
void dialog_switch_add (struct Dlg_head *h);
|
void dialog_switch_add (struct Dlg_head *h);
|
||||||
void dialog_switch_remove (struct Dlg_head *h);
|
void dialog_switch_remove (struct Dlg_head *h);
|
||||||
|
size_t dialog_switch_num (void);
|
||||||
|
|
||||||
void dialog_switch_next (void);
|
void dialog_switch_next (void);
|
||||||
void dialog_switch_prev (void);
|
void dialog_switch_prev (void);
|
||||||
|
34
src/main.c
34
src/main.c
@ -335,20 +335,29 @@ static int
|
|||||||
quit_cmd_internal (int quiet)
|
quit_cmd_internal (int quiet)
|
||||||
{
|
{
|
||||||
int q = quit;
|
int q = quit;
|
||||||
|
size_t n = dialog_switch_num () - 1;
|
||||||
|
|
||||||
if (quiet || !confirm_exit)
|
if (n != 0)
|
||||||
{
|
{
|
||||||
q = 1;
|
char msg[BUF_MEDIUM];
|
||||||
}
|
|
||||||
else
|
g_snprintf (msg, sizeof (msg),
|
||||||
{
|
ngettext ("You have %zd opened screen. Quit anyway?",
|
||||||
if (query_dialog
|
"You have %zd opened screens. Quit anyway?", n),
|
||||||
(_("The Midnight Commander"),
|
n);
|
||||||
_("Do you really want to quit the Midnight Commander?"), D_NORMAL,
|
|
||||||
2, _("&Yes"), _("&No")) == 0)
|
if (query_dialog (_("The Midnight Commander"), msg,
|
||||||
|
D_NORMAL, 2, _("&Yes"), _("&No")) == 0)
|
||||||
q = 1;
|
q = 1;
|
||||||
}
|
|
||||||
if (q)
|
} else if (quiet || !confirm_exit)
|
||||||
|
q = 1;
|
||||||
|
else if (query_dialog (_("The Midnight Commander"),
|
||||||
|
_("Do you really want to quit the Midnight Commander?"),
|
||||||
|
D_NORMAL, 2, _("&Yes"), _("&No")) == 0)
|
||||||
|
q = 1;
|
||||||
|
|
||||||
|
if (q != 0)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||||
if (!use_subshell)
|
if (!use_subshell)
|
||||||
@ -357,7 +366,8 @@ quit_cmd_internal (int quiet)
|
|||||||
#endif
|
#endif
|
||||||
stop_dialogs ();
|
stop_dialogs ();
|
||||||
}
|
}
|
||||||
if (q)
|
|
||||||
|
if (q != 0)
|
||||||
quit |= 1;
|
quit |= 1;
|
||||||
return quit;
|
return quit;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user