) {
/* append the current url to the input message */
char* input = g_strconcat(arg->s, url, NULL);
- vb_echo_force(VB_MSG_NORMAL, input);
+ vb_echo_force(VB_MSG_NORMAL, FALSE, input);
g_free(input);
} else {
- vb_echo_force(VB_MSG_NORMAL, arg->s);
+ vb_echo_force(VB_MSG_NORMAL, FALSE, arg->s);
}
vb_set_mode(VB_MODE_COMMAND, FALSE);
gboolean command_hints(const Arg* arg)
{
- vb_echo_force(VB_MSG_NORMAL, arg->s);
+ vb_echo_force(VB_MSG_NORMAL, FALSE, arg->s);
/* mode will be set in hints_create - so we don't neet to do it here */
hints_create(NULL, arg->i, (arg->s ? strlen(arg->s) : 0));
text = gtk_clipboard_wait_for_text(SECONDARY_CLIPBOARD());
}
if (text) {
- vb_echo_force(VB_MSG_NORMAL, "Yanked: %s", text);
+ vb_echo_force(VB_MSG_NORMAL, FALSE, "Yanked: %s", text);
g_free(text);
return TRUE;
}
if (a.s) {
vb_set_clipboard(&a);
- vb_echo_force(VB_MSG_NORMAL, "Yanked: %s", a.s);
+ vb_echo_force(VB_MSG_NORMAL, FALSE, "Yanked: %s", a.s);
g_free(a.s);
return TRUE;
return FALSE;
}
- vb_echo_force(VB_MSG_NORMAL, entry);
+ vb_echo_force(VB_MSG_NORMAL, FALSE, entry);
g_free(entry);
return TRUE;
static const char* vb_get_cookies(SoupURI *uri);
static gboolean vb_hide_message();
static void vb_set_status(const StatusType status);
+void vb_inputbox_print(gboolean force, const MessageType type, gboolean hide, const char* message);
static void vb_destroy_client();
-void vb_echo_force(const MessageType type, const char *error, ...)
+void vb_echo_force(const MessageType type,gboolean hide, const char *error, ...)
{
char message[255];
va_list arg_list;
vsnprintf(message, 255, error, arg_list);
va_end(arg_list);
- vb_update_input_style(type);
- gtk_entry_set_text(GTK_ENTRY(vb.gui.inputbox), message);
- gtk_editable_set_position(GTK_EDITABLE(vb.gui.inputbox), strlen(message) > INPUT_LENGTH ? 0 : -1);
+ vb_inputbox_print(TRUE, type, hide, message);
}
void vb_echo(const MessageType type, gboolean hide, const char *error, ...)
vsnprintf(message, 255, error, arg_list);
va_end(arg_list);
- /* don't print message if the input is focussed */
- if (gtk_widget_is_focus(GTK_WIDGET(vb.gui.inputbox))) {
- return;
- }
-
- vb_update_input_style(type);
- gtk_entry_set_text(GTK_ENTRY(vb.gui.inputbox), message);
- if (hide) {
- g_timeout_add_seconds(MESSAGE_TIMEOUT, (GSourceFunc)vb_hide_message, NULL);
- }
+ vb_inputbox_print(FALSE, type, hide, message);
}
gboolean vb_eval_script(WebKitWebFrame* frame, char* script, char* file, char** value)
}
}
+void vb_inputbox_print(gboolean force, const MessageType type, gboolean hide, const char* message)
+{
+ /* don't print message if the input is focussed */
+ if (!force && gtk_widget_is_focus(GTK_WIDGET(vb.gui.inputbox))) {
+ return;
+ }
+
+ vb_update_input_style(type);
+ gtk_entry_set_text(GTK_ENTRY(vb.gui.inputbox), message);
+ gtk_editable_set_position(GTK_EDITABLE(vb.gui.inputbox), strlen(message) > INPUT_LENGTH ? 0 : -1);
+ if (hide) {
+ g_timeout_add_seconds(MESSAGE_TIMEOUT, (GSourceFunc)vb_hide_message, NULL);
+ }
+}
+
static void vb_run_user_script(WebKitWebFrame* frame)
{
char* js = NULL;
extern VbCore core;
/* functions */
-void vb_echo_force(const MessageType type, const char *error, ...);
+void vb_echo_force(const MessageType type,gboolean hide, const char *error, ...);
void vb_echo(const MessageType type, gboolean hide, const char *error, ...);
gboolean vb_eval_script(WebKitWebFrame* frame, char* script, char* file, char** value);
gboolean vb_load_uri(const Arg* arg);