mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-18 09:19:24 +03:00
Use events for suspend mc (by pressing on CTRL+Z)
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
aad40e52fb
commit
a01b8edd7a
@ -42,7 +42,6 @@
|
|||||||
/* TODO: these includes should be removed! */
|
/* TODO: these includes should be removed! */
|
||||||
#include "src/help.h" /* interactive_display() */
|
#include "src/help.h" /* interactive_display() */
|
||||||
#include "src/filemanager/layout.h"
|
#include "src/filemanager/layout.h"
|
||||||
#include "src/execute.h" /* suspend_cmd() */
|
|
||||||
|
|
||||||
/*** global variables ****************************************************************************/
|
/*** global variables ****************************************************************************/
|
||||||
|
|
||||||
@ -275,7 +274,7 @@ dlg_execute_cmd (Dlg_head * h, unsigned long command)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CK_Suspend:
|
case CK_Suspend:
|
||||||
suspend_cmd ();
|
mc_event_raise (MCEVENT_GROUP_CORE, "suspend", NULL);
|
||||||
refresh_cmd ();
|
refresh_cmd ();
|
||||||
break;
|
break;
|
||||||
case CK_Refresh:
|
case CK_Refresh:
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "clipboard.h" /* clipboard events */
|
#include "clipboard.h" /* clipboard events */
|
||||||
#include "help.h" /* help_interactive_display() */
|
#include "help.h" /* help_interactive_display() */
|
||||||
|
#include "execute.h" /* execute_suspend() */
|
||||||
|
|
||||||
#include "events_init.h"
|
#include "events_init.h"
|
||||||
|
|
||||||
@ -60,6 +61,7 @@ events_init (GError ** error)
|
|||||||
{MCEVENT_GROUP_CORE, "clipboard_text_from_file", clipboard_text_from_file, NULL},
|
{MCEVENT_GROUP_CORE, "clipboard_text_from_file", clipboard_text_from_file, NULL},
|
||||||
|
|
||||||
{MCEVENT_GROUP_CORE, "help", help_interactive_display, NULL},
|
{MCEVENT_GROUP_CORE, "help", help_interactive_display, NULL},
|
||||||
|
{MCEVENT_GROUP_CORE, "suspend", execute_suspend, NULL},
|
||||||
|
|
||||||
{NULL, NULL, NULL, NULL}
|
{NULL, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
@ -399,15 +399,24 @@ toggle_panels (void)
|
|||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void
|
/* event callback */
|
||||||
suspend_cmd (void)
|
gboolean
|
||||||
|
execute_suspend (const gchar * event_group_name, const gchar * event_name,
|
||||||
|
gpointer init_data, gpointer data)
|
||||||
{
|
{
|
||||||
|
(void) event_group_name;
|
||||||
|
(void) event_name;
|
||||||
|
(void) init_data;
|
||||||
|
(void) data;
|
||||||
|
|
||||||
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
||||||
save_cwds_stat ();
|
save_cwds_stat ();
|
||||||
do_suspend_cmd ();
|
do_suspend_cmd ();
|
||||||
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
||||||
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
|
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
|
||||||
do_refresh ();
|
do_refresh ();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
@ -40,7 +40,8 @@ void exec_shell (void);
|
|||||||
void toggle_panels (void);
|
void toggle_panels (void);
|
||||||
|
|
||||||
/* Handle toggling panels by Ctrl-Z */
|
/* Handle toggling panels by Ctrl-Z */
|
||||||
void suspend_cmd (void);
|
gboolean execute_suspend (const gchar * event_group_name, const gchar * event_name,
|
||||||
|
gpointer init_data, gpointer data);
|
||||||
|
|
||||||
/* Execute command on a filename that can be on VFS */
|
/* Execute command on a filename that can be on VFS */
|
||||||
void execute_with_vfs_arg (const char *command, const char *filename);
|
void execute_with_vfs_arg (const char *command, const char *filename);
|
||||||
|
@ -55,7 +55,6 @@
|
|||||||
#include "src/subshell.h"
|
#include "src/subshell.h"
|
||||||
#include "src/setup.h" /* variables */
|
#include "src/setup.h" /* variables */
|
||||||
#include "src/learn.h" /* learn_keys() */
|
#include "src/learn.h" /* learn_keys() */
|
||||||
#include "src/execute.h" /* suspend_cmd() */
|
|
||||||
#include "src/keybind-defaults.h"
|
#include "src/keybind-defaults.h"
|
||||||
#include "lib/keybind.h"
|
#include "lib/keybind.h"
|
||||||
#include "lib/event.h"
|
#include "lib/event.h"
|
||||||
@ -645,10 +644,8 @@ create_panels (void)
|
|||||||
current_panel = left_panel;
|
current_panel = left_panel;
|
||||||
|
|
||||||
#if ENABLE_VFS
|
#if ENABLE_VFS
|
||||||
mc_event_add (MCEVENT_GROUP_CORE, "vfs_timestamp", check_other_panel_timestamp, NULL,
|
mc_event_add (MCEVENT_GROUP_CORE, "vfs_timestamp", check_other_panel_timestamp, NULL, NULL);
|
||||||
NULL);
|
mc_event_add (MCEVENT_GROUP_CORE, "vfs_timestamp", check_current_panel_timestamp, NULL, NULL);
|
||||||
mc_event_add (MCEVENT_GROUP_CORE, "vfs_timestamp", check_current_panel_timestamp, NULL,
|
|
||||||
NULL);
|
|
||||||
#endif /* ENABLE_VFS */
|
#endif /* ENABLE_VFS */
|
||||||
|
|
||||||
mc_event_add (MCEVENT_GROUP_CORE, "vfs_print_message", print_vfs_message, NULL, NULL);
|
mc_event_add (MCEVENT_GROUP_CORE, "vfs_print_message", print_vfs_message, NULL, NULL);
|
||||||
@ -1356,7 +1353,7 @@ midnight_execute_cmd (Widget * sender, unsigned long command)
|
|||||||
ctl_x_cmd ();
|
ctl_x_cmd ();
|
||||||
break;
|
break;
|
||||||
case CK_Suspend:
|
case CK_Suspend:
|
||||||
suspend_cmd ();
|
mc_event_raise (MCEVENT_GROUP_CORE, "suspend", NULL);
|
||||||
break;
|
break;
|
||||||
case CK_Swap:
|
case CK_Swap:
|
||||||
swap_cmd ();
|
swap_cmd ();
|
||||||
|
Loading…
Reference in New Issue
Block a user