From: Daniel Carl Date: Mon, 12 Nov 2012 18:56:04 +0000 (+0100) Subject: Fixed hiding of inputbox if this is already focused. X-Git-Url: https://git.owens.tech/about.html/about.html/git?a=commitdiff_plain;h=f07f50ef725583642a587f6aa111154fd6c9fc13;p=vimb.git Fixed hiding of inputbox if this is already focused. Added also a flag to the vp_echo function to allow to enable disable the message hiding for the given message. --- diff --git a/src/command.c b/src/command.c index c5699b9..c0aabc3 100644 --- a/src/command.c +++ b/src/command.c @@ -89,7 +89,7 @@ gboolean command_run(const gchar* name, const gchar* param) Arg a; c = g_hash_table_lookup(vp.behave.commands, name); if (!c) { - vp_echo(VP_MSG_ERROR, "Command '%s' not found", name); + vp_echo(VP_MSG_ERROR, TRUE, "Command '%s' not found", name); return FALSE; } a.i = c->arg.i; @@ -239,7 +239,7 @@ gboolean command_set(const Arg* arg) if (!token[1]) { /* TODO display current value */ g_strfreev(token); - vp_echo(VP_MSG_ERROR, "No param given"); + vp_echo(VP_MSG_ERROR, TRUE, "No param given"); return FALSE; } success = setting_run(token[0], token[1] ? token[1] : NULL); diff --git a/src/main.c b/src/main.c index 3418ecc..897aa41 100644 --- a/src/main.c +++ b/src/main.c @@ -265,19 +265,7 @@ void vp_clean_up(void) static gboolean vp_hide_message(void) { - /* do not clean in command mode */ - if (CLEAN_MODE(vp.state.mode) == VP_MODE_COMMAND) { - return FALSE; - } - - vp_set_widget_font( - vp.gui.inputbox, - &vp.style.input_fg[VP_MSG_NORMAL], - &vp.style.input_bg[VP_MSG_NORMAL], - vp.style.input_font[VP_MSG_NORMAL] - ); - - gtk_entry_set_text(GTK_ENTRY(vp.gui.inputbox), ""); + vp_echo(VP_MSG_NORMAL, FALSE, ""); return FALSE; } @@ -311,7 +299,7 @@ gboolean vp_set_mode(const Arg* arg) /* echo message if given */ if (arg->s) { - vp_echo(VP_MSG_NORMAL, arg->s); + vp_echo(VP_MSG_NORMAL, FALSE, arg->s); } vp_update_statusbar(); @@ -353,7 +341,7 @@ void vp_update_statusbar(void) g_string_free(status, TRUE); } -void vp_echo(const MessageType type, const char *error, ...) +void vp_echo(const MessageType type, gboolean hide, const char *error, ...) { va_list arg_list; diff --git a/src/main.h b/src/main.h index 48542fc..26eacce 100644 --- a/src/main.h +++ b/src/main.h @@ -214,7 +214,7 @@ extern VpCore vp; /* functions */ void vp_update_statusbar(void); void vp_update_urlbar(const gchar* uri); -void vp_echo(const MessageType type, const char* error, ...); +void vp_echo(const MessageType type, gboolean hide, const char *error, ...); gboolean vp_set_mode(const Arg* arg); void vp_set_widget_font(GtkWidget* widget, const GdkColor* fg, const GdkColor* bg, PangoFontDescription* font); gboolean vp_load_uri(const Arg* arg); diff --git a/src/setting.c b/src/setting.c index 8da2135..a8a3de5 100644 --- a/src/setting.c +++ b/src/setting.c @@ -128,7 +128,7 @@ gboolean setting_run(const gchar* name, const gchar* param) gboolean result = FALSE; Setting* s = g_hash_table_lookup(vp.settings, name); if (!s) { - vp_echo(VP_MSG_ERROR, "Config '%s' not found", name); + vp_echo(VP_MSG_ERROR, TRUE, "Config '%s' not found", name); return FALSE; } @@ -140,7 +140,7 @@ gboolean setting_run(const gchar* name, const gchar* param) * it to the arg of the setting */ a = util_char_to_arg(param, s->type); if (a == NULL) { - vp_echo(VP_MSG_ERROR, "No valid value"); + vp_echo(VP_MSG_ERROR, TRUE, "No valid value"); return FALSE; }