mirror of https://github.com/MidnightCommander/mc
Use events for update panels
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
3634716374
commit
c2dfb82f61
|
@ -28,14 +28,14 @@
|
|||
|
||||
#include "lib/global.h"
|
||||
#include "lib/tty/tty.h" /* LINES, COLS */
|
||||
#include "lib/tty/color.h" /* tty_set_normal_attrs() */
|
||||
#include "lib/widget.h"
|
||||
|
||||
/* TODO: these includes should be removed! */
|
||||
#include "src/filemanager/layout.h" /* repaint_screen() */
|
||||
#include "src/filemanager/midnight.h" /* midnight_dlg */
|
||||
#include "lib/event.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
Dlg_head *midnight_dlg = NULL;
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
@ -242,7 +242,7 @@ dialog_switch_process_pending (void)
|
|||
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
||||
{
|
||||
mc_current = g_list_find (mc_dialogs, midnight_dlg);
|
||||
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
|
||||
mc_event_raise (MCEVENT_GROUP_FILEMANAGER, "update_panels", NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -279,3 +279,22 @@ dialog_switch_shutdown (void)
|
|||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
clr_scr (void)
|
||||
{
|
||||
tty_set_normal_attrs ();
|
||||
tty_fill_region (0, 0, LINES, COLS, ' ');
|
||||
tty_refresh ();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
repaint_screen (void)
|
||||
{
|
||||
do_refresh ();
|
||||
tty_refresh ();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
/*** global variables defined in .c file *********************************************************/
|
||||
|
||||
extern Dlg_head *midnight_dlg;
|
||||
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
void dialog_switch_add (struct Dlg_head *h);
|
||||
|
@ -26,5 +28,10 @@ int dialog_switch_process_pending (void);
|
|||
void dialog_switch_got_winch (void);
|
||||
void dialog_switch_shutdown (void);
|
||||
|
||||
/* Clear screen */
|
||||
void clr_scr (void);
|
||||
void repaint_screen (void);
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
|
||||
#endif /* MC__DIALOG_SWITCH_H */
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "lib/tty/key.h" /* add_select_channel(), delete_select_channel() */
|
||||
#include "lib/widget.h" /* message() */
|
||||
|
||||
#include "filemanager/layout.h" /* repaint_screen() */
|
||||
#include "filemanager/fileopctx.h" /* FileOpContext */
|
||||
|
||||
#include "background.h"
|
||||
|
|
|
@ -57,8 +57,6 @@
|
|||
#include "lib/widget.h"
|
||||
#include "lib/charsets.h"
|
||||
|
||||
#include "src/filemanager/layout.h" /* clr_scr() */
|
||||
|
||||
#include "src/history.h"
|
||||
#include "src/setup.h" /* option_tab_spacing */
|
||||
#include "src/help.h" /* interactive_display() */
|
||||
|
@ -66,6 +64,8 @@
|
|||
#include "src/keybind-defaults.h"
|
||||
#include "src/clipboard.h" /* copy_file_to_ext_clip, paste_to_file_from_ext_clip */
|
||||
#include "src/util.h" /* check_for_default() */
|
||||
#include "src/filemanager/layout.h" /* mc_refresh() */
|
||||
|
||||
|
||||
#include "edit-impl.h"
|
||||
#include "edit-widget.h"
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "dir.h"
|
||||
#include "midnight.h" /* current_panel */
|
||||
#include "chmod.h"
|
||||
#include "layout.h" /* repaint_screen() */
|
||||
|
||||
#include "achown.h"
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include "lib/widget.h"
|
||||
|
||||
#include "midnight.h" /* current_panel */
|
||||
#include "layout.h" /* repaint_screen() */
|
||||
#include "chmod.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
/* Needed for the extern declarations of integer parameters */
|
||||
#include "chmod.h"
|
||||
#include "midnight.h" /* current_panel */
|
||||
#include "layout.h" /* repaint_screen() */
|
||||
|
||||
#include "chown.h"
|
||||
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
#include "cmd.h" /* view_file_at_line */
|
||||
#include "midnight.h" /* current_panel */
|
||||
#include "boxes.h"
|
||||
#include "layout.h" /* mc_refresh() */
|
||||
|
||||
#include "find.h"
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
#include "src/history.h"
|
||||
|
||||
#include "midnight.h" /* current_panel */
|
||||
#include "layout.h" /* repaint_screen() */
|
||||
#include "command.h" /* cmdline */
|
||||
|
||||
#include "hotlist.h"
|
||||
|
|
|
@ -688,25 +688,6 @@ layout_box (void)
|
|||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
clr_scr (void)
|
||||
{
|
||||
tty_set_normal_attrs ();
|
||||
tty_fill_region (0, 0, LINES, COLS, ' ');
|
||||
tty_refresh ();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
repaint_screen (void)
|
||||
{
|
||||
do_refresh ();
|
||||
tty_refresh ();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
mc_refresh (void)
|
||||
{
|
||||
|
|
|
@ -62,8 +62,6 @@ void use_dash (gboolean flag); /* Disable/Enable rotate_dash routines */
|
|||
void rotate_dash (void);
|
||||
|
||||
/* Clear screen */
|
||||
void clr_scr (void);
|
||||
void repaint_screen (void);
|
||||
void mc_refresh (void);
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "dir.h"
|
||||
#include "panel.h" /* Needed for the externs */
|
||||
#include "file.h"
|
||||
#include "layout.h" /* repaint_screen() */
|
||||
#include "listmode.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
|
|
@ -113,9 +113,6 @@ WLabel *the_hint;
|
|||
/* The button bar */
|
||||
WButtonBar *the_bar;
|
||||
|
||||
/* The dialog handle for the main program */
|
||||
Dlg_head *midnight_dlg = NULL;
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#ifdef HAVE_CHARSET
|
||||
#include "lib/charsets.h" /* get_codepage_id () */
|
||||
#endif
|
||||
#include "lib/event.h"
|
||||
|
||||
#include "src/setup.h" /* For loading/saving panel options */
|
||||
#include "src/execute.h"
|
||||
|
@ -3409,6 +3410,25 @@ do_try_to_select (WPanel * panel, const char *name)
|
|||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* event callback */
|
||||
static gboolean
|
||||
event_update_panels (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;
|
||||
|
||||
update_panels (UP_RELOAD, UP_KEEPSEL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
try_to_select (WPanel * panel, const char *name)
|
||||
{
|
||||
|
@ -4103,6 +4123,8 @@ panel_init (void)
|
|||
panel_history_next_item_sign = mc_skin_get ("widget-panel", "history-next-item-sign", ">");
|
||||
panel_history_show_list_sign = mc_skin_get ("widget-panel", "history-show-list-sign", "^");
|
||||
|
||||
mc_event_add (MCEVENT_GROUP_FILEMANAGER, "update_panels", event_update_panels, NULL, NULL);
|
||||
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
|
||||
#include "dir.h"
|
||||
#include "midnight.h" /* current_panel */
|
||||
#include "layout.h" /* repaint_screen() */
|
||||
|
||||
#include "panelize.h"
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "lib/util.h" /* convert_controls() */
|
||||
#include "lib/widget.h"
|
||||
|
||||
#include "filemanager/layout.h" /* repaint_screen() */
|
||||
#include "src/filemanager/layout.h" /* mc_refresh() */
|
||||
|
||||
#include "setup.h"
|
||||
#include "learn.h"
|
||||
|
|
Loading…
Reference in New Issue