summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Carl <danielcarl@gmx.de>2012-11-12 19:56:04 +0100
committerDaniel Carl <danielcarl@gmx.de>2012-11-12 19:56:04 +0100
commitf07f50ef725583642a587f6aa111154fd6c9fc13 (patch)
tree613641ed59be18511a17501b10cd541149bd18a1
parente4972e2c5dbb1512ad19abb4a621b90136d46e2e (diff)
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.
-rw-r--r--src/command.c4
-rw-r--r--src/main.c18
-rw-r--r--src/main.h2
-rw-r--r--src/setting.c4
4 files changed, 8 insertions, 20 deletions
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;
}