mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-18 09:19:24 +03:00
Reimplement handling of ev_vfs_print_message_t message.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
70fa973f47
commit
97f65abd94
@ -33,8 +33,7 @@ typedef struct
|
|||||||
/* MCEVENT_GROUP_CORE:vfs_print_message */
|
/* MCEVENT_GROUP_CORE:vfs_print_message */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
const char *msg;
|
char *msg;
|
||||||
va_list ap;
|
|
||||||
} ev_vfs_print_message_t;
|
} ev_vfs_print_message_t;
|
||||||
|
|
||||||
/* MCEVENT_GROUP_CORE:clipboard_text_from_file */
|
/* MCEVENT_GROUP_CORE:clipboard_text_from_file */
|
||||||
|
@ -528,12 +528,13 @@ void
|
|||||||
vfs_print_message (const char *msg, ...)
|
vfs_print_message (const char *msg, ...)
|
||||||
{
|
{
|
||||||
ev_vfs_print_message_t event_data;
|
ev_vfs_print_message_t event_data;
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
va_start (event_data.ap, msg);
|
va_start (ap, msg);
|
||||||
event_data.msg = msg;
|
event_data.msg = g_strdup_vprintf (msg, ap);
|
||||||
|
va_end (ap);
|
||||||
|
|
||||||
mc_event_raise (MCEVENT_GROUP_CORE, "vfs_print_message", (gpointer) & event_data);
|
mc_event_raise (MCEVENT_GROUP_CORE, "vfs_print_message", (gpointer) & event_data);
|
||||||
va_end (event_data.ap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
@ -529,41 +529,40 @@ static gboolean
|
|||||||
print_vfs_message (const gchar * event_group_name, const gchar * event_name,
|
print_vfs_message (const gchar * event_group_name, const gchar * event_name,
|
||||||
gpointer init_data, gpointer data)
|
gpointer init_data, gpointer data)
|
||||||
{
|
{
|
||||||
char str[128];
|
|
||||||
ev_vfs_print_message_t *event_data = (ev_vfs_print_message_t *) data;
|
ev_vfs_print_message_t *event_data = (ev_vfs_print_message_t *) data;
|
||||||
|
|
||||||
(void) event_group_name;
|
(void) event_group_name;
|
||||||
(void) event_name;
|
(void) event_name;
|
||||||
(void) init_data;
|
(void) init_data;
|
||||||
|
|
||||||
g_vsnprintf (str, sizeof (str), event_data->msg, event_data->ap);
|
|
||||||
|
|
||||||
if (mc_global.midnight_shutdown)
|
if (mc_global.midnight_shutdown)
|
||||||
return TRUE;
|
goto ret;
|
||||||
|
|
||||||
if (!mc_global.message_visible || the_hint == NULL || WIDGET (the_hint)->owner == NULL)
|
if (!mc_global.message_visible || the_hint == NULL || WIDGET (the_hint)->owner == NULL)
|
||||||
{
|
{
|
||||||
int col, row;
|
int col, row;
|
||||||
|
|
||||||
if (!nice_rotating_dash || (ok_to_refresh <= 0))
|
if (!nice_rotating_dash || (ok_to_refresh <= 0))
|
||||||
return TRUE;
|
goto ret;
|
||||||
|
|
||||||
/* Preserve current cursor position */
|
/* Preserve current cursor position */
|
||||||
tty_getyx (&row, &col);
|
tty_getyx (&row, &col);
|
||||||
|
|
||||||
tty_gotoyx (0, 0);
|
tty_gotoyx (0, 0);
|
||||||
tty_setcolor (NORMAL_COLOR);
|
tty_setcolor (NORMAL_COLOR);
|
||||||
tty_print_string (str_fit_to_term (str, COLS - 1, J_LEFT));
|
tty_print_string (str_fit_to_term (event_data->msg, COLS - 1, J_LEFT));
|
||||||
|
|
||||||
/* Restore cursor position */
|
/* Restore cursor position */
|
||||||
tty_gotoyx (row, col);
|
tty_gotoyx (row, col);
|
||||||
mc_refresh ();
|
mc_refresh ();
|
||||||
return TRUE;
|
goto ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mc_global.message_visible)
|
if (mc_global.message_visible)
|
||||||
set_hintbar (str);
|
set_hintbar (event_data->msg);
|
||||||
|
|
||||||
|
ret:
|
||||||
|
MC_PTR_FREE (event_data->msg);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user