From 405143ba9ff40659a2c54af761162d7f79cfadda Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 23 Jun 2013 18:52:42 +0400 Subject: [PATCH] (mcview_ok_to_quit): move to actions_cmd.c and make static. Signed-off-by: Andrew Borodin --- src/viewer/actions_cmd.c | 38 ++++++++++++++++++++++++++++++++++++++ src/viewer/internal.h | 1 - src/viewer/lib.c | 39 --------------------------------------- 3 files changed, 38 insertions(+), 40 deletions(-) diff --git a/src/viewer/actions_cmd.c b/src/viewer/actions_cmd.c index 037b48565..0788ec952 100644 --- a/src/viewer/actions_cmd.c +++ b/src/viewer/actions_cmd.c @@ -578,6 +578,44 @@ mcview_adjust_size (WDialog * h) mcview_update_bytes_per_line (view); } +/* --------------------------------------------------------------------------------------------- */ + +static gboolean +mcview_ok_to_quit (mcview_t * view) +{ + int r; + + if (view->change_list == NULL) + return TRUE; + + if (!mc_global.midnight_shutdown) + { + query_set_sel (2); + r = query_dialog (_("Quit"), + _("File was modified. Save with exit?"), D_NORMAL, 3, + _("&Yes"), _("&No"), _("&Cancel quit")); + } + else + { + r = query_dialog (_("Quit"), + _("Midnight Commander is being shut down.\nSave modified file?"), + D_NORMAL, 2, _("&Yes"), _("&No")); + /* Esc is No */ + if (r == -1) + r = 1; + } + + switch (r) + { + case 0: /* Yes */ + return mcview_hexedit_save_changes (view) || mc_global.midnight_shutdown; + case 1: /* No */ + mcview_hexedit_free_change_list (view); + return TRUE; + default: + return FALSE; + } +} /* --------------------------------------------------------------------------------------------- */ /*** public functions ****************************************************************************/ diff --git a/src/viewer/internal.h b/src/viewer/internal.h index 1fe330f12..bb536bbbf 100644 --- a/src/viewer/internal.h +++ b/src/viewer/internal.h @@ -283,7 +283,6 @@ void mcview_toggle_magic_mode (mcview_t * view); void mcview_toggle_wrap_mode (mcview_t * view); void mcview_toggle_nroff_mode (mcview_t * view); void mcview_toggle_hex_mode (mcview_t * view); -gboolean mcview_ok_to_quit (mcview_t * view); void mcview_init (mcview_t * view); void mcview_done (mcview_t * view); void mcview_select_encoding (mcview_t * view); diff --git a/src/viewer/lib.c b/src/viewer/lib.c index 8d66d2e46..b0edcc223 100644 --- a/src/viewer/lib.c +++ b/src/viewer/lib.c @@ -152,45 +152,6 @@ mcview_toggle_hex_mode (mcview_t * view) /* --------------------------------------------------------------------------------------------- */ -gboolean -mcview_ok_to_quit (mcview_t * view) -{ - int r; - - if (view->change_list == NULL) - return TRUE; - - if (!mc_global.midnight_shutdown) - { - query_set_sel (2); - r = query_dialog (_("Quit"), - _("File was modified. Save with exit?"), D_NORMAL, 3, - _("&Yes"), _("&No"), _("&Cancel quit")); - } - else - { - r = query_dialog (_("Quit"), - _("Midnight Commander is being shut down.\nSave modified file?"), - D_NORMAL, 2, _("&Yes"), _("&No")); - /* Esc is No */ - if (r == -1) - r = 1; - } - - switch (r) - { - case 0: /* Yes */ - return mcview_hexedit_save_changes (view) || mc_global.midnight_shutdown; - case 1: /* No */ - mcview_hexedit_free_change_list (view); - return TRUE; - default: - return FALSE; - } -} - -/* --------------------------------------------------------------------------------------------- */ - void mcview_init (mcview_t * view) {