static CommandInfo cmd_list[] = {
/* command function arg mode */
- {"open", command_open, {VP_TARGET_CURRENT, ""}},
- {"tabopen", command_open, {VP_TARGET_NEW, ""}},
- {"open-closed", command_open_closed, {VP_TARGET_CURRENT}},
- {"tabopen-closed", command_open_closed, {VP_TARGET_NEW}},
+ {"open", command_open, {VB_TARGET_CURRENT, ""}},
+ {"tabopen", command_open, {VB_TARGET_NEW, ""}},
+ {"open-closed", command_open_closed, {VB_TARGET_CURRENT}},
+ {"tabopen-closed", command_open_closed, {VB_TARGET_NEW}},
{"input", command_input, {0, ":"}},
- {"inputuri", command_input, {VP_INPUT_CURRENT_URI, ":"}},
+ {"inputuri", command_input, {VB_INPUT_CURRENT_URI, ":"}},
{"quit", command_close, {0}},
{"source", command_view_source, {0}},
- {"back", command_navigate, {VP_NAVIG_BACK}},
- {"forward", command_navigate, {VP_NAVIG_FORWARD}},
- {"reload", command_navigate, {VP_NAVIG_RELOAD}},
- {"reload!", command_navigate, {VP_NAVIG_RELOAD_FORCE}},
- {"stop", command_navigate, {VP_NAVIG_STOP_LOADING}},
- {"jumpleft", command_scroll, {VP_SCROLL_TYPE_JUMP | VP_SCROLL_DIRECTION_LEFT}},
- {"jumpright", command_scroll, {VP_SCROLL_TYPE_JUMP | VP_SCROLL_DIRECTION_RIGHT}},
- {"jumptop", command_scroll, {VP_SCROLL_TYPE_JUMP | VP_SCROLL_DIRECTION_TOP}},
- {"jumpbottom", command_scroll, {VP_SCROLL_TYPE_JUMP | VP_SCROLL_DIRECTION_DOWN}},
- {"pageup", command_scroll, {VP_SCROLL_TYPE_SCROLL | VP_SCROLL_DIRECTION_TOP | VP_SCROLL_UNIT_PAGE}},
- {"pagedown", command_scroll, {VP_SCROLL_TYPE_SCROLL | VP_SCROLL_DIRECTION_DOWN | VP_SCROLL_UNIT_PAGE}},
- {"halfpageup", command_scroll, {VP_SCROLL_TYPE_SCROLL | VP_SCROLL_DIRECTION_TOP | VP_SCROLL_UNIT_HALFPAGE}},
- {"halfpagedown", command_scroll, {VP_SCROLL_TYPE_SCROLL | VP_SCROLL_DIRECTION_DOWN | VP_SCROLL_UNIT_HALFPAGE}},
- {"scrollleft", command_scroll, {VP_SCROLL_TYPE_SCROLL | VP_SCROLL_DIRECTION_LEFT | VP_SCROLL_UNIT_LINE}},
- {"scrollright", command_scroll, {VP_SCROLL_TYPE_SCROLL | VP_SCROLL_DIRECTION_RIGHT | VP_SCROLL_UNIT_LINE}},
- {"scrollup", command_scroll, {VP_SCROLL_TYPE_SCROLL | VP_SCROLL_DIRECTION_TOP | VP_SCROLL_UNIT_LINE}},
- {"scrolldown", command_scroll, {VP_SCROLL_TYPE_SCROLL | VP_SCROLL_DIRECTION_DOWN | VP_SCROLL_UNIT_LINE}},
- {"nmap", command_map, {VP_MODE_NORMAL}},
- {"imap", command_map, {VP_MODE_INSERT}},
- {"cmap", command_map, {VP_MODE_COMMAND}},
- {"hmap", command_map, {VP_MODE_HINTING}},
- {"smap", command_map, {VP_MODE_SEARCH}},
- {"nunmap", command_unmap, {VP_MODE_NORMAL}},
- {"iunmap", command_unmap, {VP_MODE_INSERT}},
- {"cunmap", command_unmap, {VP_MODE_COMMAND}},
- {"hunmap", command_unmap, {VP_MODE_HINTING}},
- {"sunmap", command_map, {VP_MODE_SEARCH}},
+ {"back", command_navigate, {VB_NAVIG_BACK}},
+ {"forward", command_navigate, {VB_NAVIG_FORWARD}},
+ {"reload", command_navigate, {VB_NAVIG_RELOAD}},
+ {"reload!", command_navigate, {VB_NAVIG_RELOAD_FORCE}},
+ {"stop", command_navigate, {VB_NAVIG_STOP_LOADING}},
+ {"jumpleft", command_scroll, {VB_SCROLL_TYPE_JUMP | VB_SCROLL_DIRECTION_LEFT}},
+ {"jumpright", command_scroll, {VB_SCROLL_TYPE_JUMP | VB_SCROLL_DIRECTION_RIGHT}},
+ {"jumptop", command_scroll, {VB_SCROLL_TYPE_JUMP | VB_SCROLL_DIRECTION_TOP}},
+ {"jumpbottom", command_scroll, {VB_SCROLL_TYPE_JUMP | VB_SCROLL_DIRECTION_DOWN}},
+ {"pageup", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_TOP | VB_SCROLL_UNIT_PAGE}},
+ {"pagedown", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_DOWN | VB_SCROLL_UNIT_PAGE}},
+ {"halfpageup", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_TOP | VB_SCROLL_UNIT_HALFPAGE}},
+ {"halfpagedown", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_DOWN | VB_SCROLL_UNIT_HALFPAGE}},
+ {"scrollleft", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_LEFT | VB_SCROLL_UNIT_LINE}},
+ {"scrollright", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_RIGHT | VB_SCROLL_UNIT_LINE}},
+ {"scrollup", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_TOP | VB_SCROLL_UNIT_LINE}},
+ {"scrolldown", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_DOWN | VB_SCROLL_UNIT_LINE}},
+ {"nmap", command_map, {VB_MODE_NORMAL}},
+ {"imap", command_map, {VB_MODE_INSERT}},
+ {"cmap", command_map, {VB_MODE_COMMAND}},
+ {"hmap", command_map, {VB_MODE_HINTING}},
+ {"smap", command_map, {VB_MODE_SEARCH}},
+ {"nunmap", command_unmap, {VB_MODE_NORMAL}},
+ {"iunmap", command_unmap, {VB_MODE_INSERT}},
+ {"cunmap", command_unmap, {VB_MODE_COMMAND}},
+ {"hunmap", command_unmap, {VB_MODE_HINTING}},
+ {"sunmap", command_map, {VB_MODE_SEARCH}},
{"set", command_set, {0}},
{"complete", command_complete, {0}},
{"complete-back", command_complete, {1}},
{"hint-focus-prev", command_hints_focus, {1}},
{"yank-uri", command_yank, {COMMAND_YANK_PRIMARY | COMMAND_YANK_SECONDARY | COMMAND_YANK_URI}},
{"yank-selection", command_yank, {COMMAND_YANK_PRIMARY | COMMAND_YANK_SECONDARY | COMMAND_YANK_SELECTION}},
- {"open-clipboard", command_paste, {VP_CLIPBOARD_PRIMARY | VP_CLIPBOARD_SECONDARY | VP_TARGET_CURRENT}},
- {"tabopen-clipboard", command_paste, {VP_CLIPBOARD_PRIMARY | VP_CLIPBOARD_SECONDARY | VP_TARGET_NEW}},
- {"search-forward", command_search, {VP_SEARCH_FORWARD}},
- {"search-backward", command_search, {VP_SEARCH_BACKWARD}},
+ {"open-clipboard", command_paste, {VB_CLIPBOARD_PRIMARY | VB_CLIPBOARD_SECONDARY | VB_TARGET_CURRENT}},
+ {"tabopen-clipboard", command_paste, {VB_CLIPBOARD_PRIMARY | VB_CLIPBOARD_SECONDARY | VB_TARGET_NEW}},
+ {"search-forward", command_search, {VB_SEARCH_FORWARD}},
+ {"search-backward", command_search, {VB_SEARCH_BACKWARD}},
{"searchengine-add", command_searchengine,{1}},
{"searchengine-remove", command_searchengine,{0}},
{"zoomin", command_zoom, {COMMAND_ZOOM_IN}},
{"zoominfull", command_zoom, {COMMAND_ZOOM_IN | COMMAND_ZOOM_FULL}},
{"zoomoutfull", command_zoom, {COMMAND_ZOOM_OUT | COMMAND_ZOOM_FULL}},
{"zoomreset", command_zoom, {COMMAND_ZOOM_RESET}},
- {"command-hist-next", command_history, {VP_SEARCH_FORWARD}},
- {"command-hist-prev", command_history, {VP_SEARCH_BACKWARD}},
+ {"command-hist-next", command_history, {VB_SEARCH_FORWARD}},
+ {"command-hist-prev", command_history, {VB_SEARCH_BACKWARD}},
};
static void command_write_input(Client* c, const char* str);
command = g_hash_table_lookup(core.behave.commands, name);
if (!command) {
if (c) {
- vp_echo(c, VP_MSG_ERROR, TRUE, "Command '%s' not found", name);
- vp_set_mode(c, VP_MODE_NORMAL, FALSE);
+ vb_echo(c, VB_MSG_ERROR, TRUE, "Command '%s' not found", name);
+ vb_set_mode(c, VB_MODE_NORMAL, FALSE);
}
return FALSE;
if (!arg->s || arg->s[0] == '\0') {
Arg a = {arg->i, core.config.home_page};
- return vp_load_uri(c, &a);
+ return vb_load_uri(c, &a);
}
/* check for searchengine handles */
/* split into handle and searchterms */
) {
char* term = soup_uri_encode(string[1], "&");
Arg a = {arg->i, g_strdup_printf(uri, term)};
- result = vp_load_uri(c, &a);
+ result = vb_load_uri(c, &a);
g_free(term);
g_free(a.s);
} else {
- result = vp_load_uri(c, arg);
+ result = vb_load_uri(c, arg);
}
g_strfreev(string);
Arg a = {arg->i};
a.s = util_get_file_contents(core.files[FILES_CLOSED], NULL);
- result = vp_load_uri(c, &a);
+ result = vb_load_uri(c, &a);
g_free(a.s);
return result;
const char* url;
/* add current url if requested */
- if (VP_INPUT_CURRENT_URI == arg->i
+ if (VB_INPUT_CURRENT_URI == arg->i
&& (url = webkit_web_view_get_uri(c->gui.webview))
) {
/* append the current url to the input message */
command_write_input(c, arg->s);
}
- vp_set_mode(c, VP_MODE_COMMAND, FALSE);
+ vb_set_mode(c, VB_MODE_COMMAND, FALSE);
return TRUE;
}
webkit_web_view_set_view_source_mode(c->gui.webview, !mode);
webkit_web_view_reload(c->gui.webview);
- vp_set_mode(c, VP_MODE_NORMAL, FALSE);
+ vb_set_mode(c, VB_MODE_NORMAL, FALSE);
return TRUE;
}
gboolean command_navigate(Client* c, const Arg* arg)
{
- if (arg->i <= VP_NAVIG_FORWARD) {
+ if (arg->i <= VB_NAVIG_FORWARD) {
int count = c->state.count ? c->state.count : 1;
webkit_web_view_go_back_or_forward(
- c->gui.webview, (arg->i == VP_NAVIG_BACK ? -count : count)
+ c->gui.webview, (arg->i == VB_NAVIG_BACK ? -count : count)
);
- } else if (arg->i == VP_NAVIG_RELOAD) {
+ } else if (arg->i == VB_NAVIG_RELOAD) {
webkit_web_view_reload(c->gui.webview);
- } else if (arg->i == VP_NAVIG_RELOAD_FORCE) {
+ } else if (arg->i == VB_NAVIG_RELOAD_FORCE) {
webkit_web_view_reload_bypass_cache(c->gui.webview);
} else {
webkit_web_view_stop_loading(c->gui.webview);
}
- vp_set_mode(c, VP_MODE_NORMAL, FALSE);
+ vb_set_mode(c, VB_MODE_NORMAL, FALSE);
return TRUE;
}
gboolean command_scroll(Client* c, const Arg* arg)
{
- GtkAdjustment *adjust = (arg->i & VP_SCROLL_AXIS_H) ? c->gui.adjust_h : c->gui.adjust_v;
+ GtkAdjustment *adjust = (arg->i & VB_SCROLL_AXIS_H) ? c->gui.adjust_h : c->gui.adjust_v;
int direction = (arg->i & (1 << 2)) ? 1 : -1;
/* type scroll */
- if (arg->i & VP_SCROLL_TYPE_SCROLL) {
+ if (arg->i & VB_SCROLL_TYPE_SCROLL) {
gdouble value;
int count = c->state.count ? c->state.count : 1;
- if (arg->i & VP_SCROLL_UNIT_LINE) {
+ if (arg->i & VB_SCROLL_UNIT_LINE) {
value = core.config.scrollstep;
- } else if (arg->i & VP_SCROLL_UNIT_HALFPAGE) {
+ } else if (arg->i & VB_SCROLL_UNIT_HALFPAGE) {
value = gtk_adjustment_get_page_size(adjust) / 2;
} else {
value = gtk_adjustment_get_page_size(adjust);
gtk_adjustment_set_value(adjust, gtk_adjustment_get_lower(adjust));
}
- vp_set_mode(c, VP_MODE_NORMAL, FALSE);
+ vb_set_mode(c, VB_MODE_NORMAL, FALSE);
return TRUE;
}
gboolean command_map(Client* c, const Arg* arg)
{
gboolean result;
- vp_set_mode(c, VP_MODE_NORMAL, FALSE);
+ vb_set_mode(c, VB_MODE_NORMAL, FALSE);
char **string = g_strsplit(arg->s, "=", 2);
if (g_strv_length(string) != 2) {
gboolean command_unmap(Client* c, const Arg* arg)
{
- vp_set_mode(c, VP_MODE_NORMAL, FALSE);
+ vb_set_mode(c, VB_MODE_NORMAL, FALSE);
return keybind_remove_from_string(arg->s, arg->i);
}
success = setting_run(c, token[0], token[1] ? token[1] : NULL);
g_strfreev(token);
- vp_set_mode(c, VP_MODE_NORMAL, FALSE);
+ vb_set_mode(c, VB_MODE_NORMAL, FALSE);
return success;
}
{
completion_complete(c, arg->i ? TRUE : FALSE);
- vp_set_mode(c, VP_MODE_COMMAND | VP_MODE_COMPLETE, FALSE);
+ vb_set_mode(c, VB_MODE_COMMAND | VB_MODE_COMPLETE, FALSE);
return TRUE;
}
gboolean enabled;
WebKitWebSettings* settings = NULL;
- vp_set_mode(c, VP_MODE_NORMAL, FALSE);
+ vb_set_mode(c, VB_MODE_NORMAL, FALSE);
settings = webkit_web_view_get_settings(c->gui.webview);
g_object_get(G_OBJECT(settings), "enable-developer-extras", &enabled, NULL);
return TRUE;
}
- vp_echo(c, VP_MSG_ERROR, TRUE, "webinspector is not enabled");
+ vb_echo(c, VB_MSG_ERROR, TRUE, "webinspector is not enabled");
return FALSE;
}
command_write_input(c, arg->s);
hints_create(c, NULL, arg->i, (arg->s ? strlen(arg->s) : 0));
- vp_set_mode(c, VP_MODE_HINTING, FALSE);
+ vb_set_mode(c, VB_MODE_HINTING, FALSE);
return TRUE;
}
{
hints_focus_next(c, arg->i ? TRUE : FALSE);
- vp_set_mode(c, VP_MODE_HINTING, FALSE);
+ vb_set_mode(c, VB_MODE_HINTING, FALSE);
return TRUE;
}
gboolean command_yank(Client* c, const Arg* arg)
{
- vp_set_mode(c, VP_MODE_NORMAL, TRUE);
+ vb_set_mode(c, VB_MODE_NORMAL, TRUE);
if (arg->i & COMMAND_YANK_SELECTION) {
char* text = NULL;
if (text) {
/* TODO is this the rigth place to switch the focus */
gtk_widget_grab_focus(GTK_WIDGET(c->gui.webview));
- vp_echo(c, VP_MSG_NORMAL, FALSE, "Yanked: %s", text);
+ vb_echo(c, VB_MSG_NORMAL, FALSE, "Yanked: %s", text);
g_free(text);
return TRUE;
a.s = arg->s ? g_strdup(arg->s) : NULL;
}
if (a.s) {
- vp_set_clipboard(&a);
+ vb_set_clipboard(&a);
/* TODO is this the rigth place to switch the focus */
gtk_widget_grab_focus(GTK_WIDGET(c->gui.webview));
- vp_echo(c, VP_MSG_NORMAL, FALSE, "Yanked: %s", a.s);
+ vb_echo(c, VB_MSG_NORMAL, FALSE, "Yanked: %s", a.s);
g_free(a.s);
return TRUE;
gboolean command_paste(Client* c, const Arg* arg)
{
- Arg a = {.i = arg->i & VP_TARGET_NEW};
- if (arg->i & VP_CLIPBOARD_PRIMARY) {
+ Arg a = {.i = arg->i & VB_TARGET_NEW};
+ if (arg->i & VB_CLIPBOARD_PRIMARY) {
a.s = gtk_clipboard_wait_for_text(PRIMARY_CLIPBOARD());
}
- if (!a.s && arg->i & VP_CLIPBOARD_SECONDARY) {
+ if (!a.s && arg->i & VB_CLIPBOARD_SECONDARY) {
a.s = gtk_clipboard_wait_for_text(SECONDARY_CLIPBOARD());
}
if (a.s) {
- vp_load_uri(c, &a);
+ vb_load_uri(c, &a);
g_free(a.s);
return TRUE;
{
gboolean forward = !(arg->i ^ c->state.search_dir);
- if (arg->i == VP_SEARCH_OFF && c->state.search_query) {
+ if (arg->i == VB_SEARCH_OFF && c->state.search_query) {
OVERWRITE_STRING(c->state.search_query, NULL);
#ifdef FEATURE_SEARCH_HIGHLIGHT
webkit_web_view_unmark_text_matches(c->gui.webview);
} while (--c->state.count);
}
- vp_set_mode(c, VP_MODE_SEARCH, FALSE);
+ vb_set_mode(c, VB_MODE_SEARCH, FALSE);
return TRUE;
}
result = searchengine_remove(arg->s);
}
- vp_set_mode(c, VP_MODE_NORMAL, FALSE);
+ vb_set_mode(c, VB_MODE_NORMAL, FALSE);
return result;
}
if (arg->i & COMMAND_ZOOM_RESET) {
webkit_web_view_set_zoom_level(c->gui.webview, 1.0);
- vp_set_mode(c, VP_MODE_NORMAL, FALSE);
+ vb_set_mode(c, VB_MODE_NORMAL, FALSE);
return TRUE;
}
level + (float)(count *step) * (arg->i & COMMAND_ZOOM_IN ? 1.0 : -1.0)
);
- vp_set_mode(c, VP_MODE_NORMAL, FALSE);
+ vb_set_mode(c, VB_MODE_NORMAL, FALSE);
return TRUE;
gboolean command_history(Client* c, const Arg* arg)
{
const int count = c->state.count ? c->state.count : 1;
- const gint step = count * (arg->i == VP_SEARCH_BACKWARD ? -1 : 1);
+ const gint step = count * (arg->i == VB_SEARCH_BACKWARD ? -1 : 1);
const char* entry = history_get(c, step);
if (!entry) {
int pos = 0;
GtkEditable* box = GTK_EDITABLE(c->gui.inputbox);
/* reset the colors and fonts to defalts */
- vp_set_widget_font(
+ vb_set_widget_font(
c->gui.inputbox,
- &core.style.input_fg[VP_MSG_NORMAL],
- &core.style.input_bg[VP_MSG_NORMAL],
- core.style.input_font[VP_MSG_NORMAL]
+ &core.style.input_fg[VB_MSG_NORMAL],
+ &core.style.input_bg[VB_MSG_NORMAL],
+ core.style.input_font[VB_MSG_NORMAL]
);
/* remove content from input box */
#define _COMMAND_H
enum {
- COMMAND_YANK_PRIMARY = VP_CLIPBOARD_PRIMARY,
- COMMAND_YANK_SECONDARY = VP_CLIPBOARD_SECONDARY,
+ COMMAND_YANK_PRIMARY = VB_CLIPBOARD_PRIMARY,
+ COMMAND_YANK_SECONDARY = VB_CLIPBOARD_SECONDARY,
COMMAND_YANK_URI = (COMMAND_YANK_SECONDARY<<1),
COMMAND_YANK_SELECTION = (COMMAND_YANK_SECONDARY<<2)
};
if (c->comps.completions
&& c->comps.active
- && (c->state.mode & VP_MODE_COMPLETE)
+ && (c->state.mode & VB_MODE_COMPLETE)
) {
char* text = completion_get_text(c, (Completion*)c->comps.active->data);
if (!strcmp(input, text)) {
c->comps.count = 0;
/* remove completion flag from mode */
- c->state.mode &= ~VP_MODE_COMPLETE;
+ c->state.mode &= ~VB_MODE_COMPLETE;
}
static GList* completion_init_completion(Client* c, GList* target, GList* source,
}
}
- VP_WIDGET_SET_STATE(((Completion*)old->data)->label, VP_GTK_STATE_NORMAL);
- VP_WIDGET_SET_STATE(((Completion*)old->data)->event, VP_GTK_STATE_NORMAL);
- VP_WIDGET_SET_STATE(((Completion*)new->data)->label, VP_GTK_STATE_ACTIVE);
- VP_WIDGET_SET_STATE(((Completion*)new->data)->event, VP_GTK_STATE_ACTIVE);
+ VB_WIDGET_SET_STATE(((Completion*)old->data)->label, VB_GTK_STATE_NORMAL);
+ VB_WIDGET_SET_STATE(((Completion*)old->data)->event, VB_GTK_STATE_NORMAL);
+ VB_WIDGET_SET_STATE(((Completion*)new->data)->label, VB_GTK_STATE_ACTIVE);
+ VB_WIDGET_SET_STATE(((Completion*)new->data)->event, VB_GTK_STATE_ACTIVE);
active = new;
completion_set_entry_text(c, active->data);
}
if (c->comps.active != NULL) {
Completion* active = (Completion*)c->comps.active->data;
- VP_WIDGET_SET_STATE(active->label, VP_GTK_STATE_ACTIVE);
- VP_WIDGET_SET_STATE(active->event, VP_GTK_STATE_ACTIVE);
+ VB_WIDGET_SET_STATE(active->label, VB_GTK_STATE_ACTIVE);
+ VB_WIDGET_SET_STATE(active->event, VB_GTK_STATE_ACTIVE);
completion_set_entry_text(c, active);
gtk_widget_show(c->gui.compbox);
gtk_label_set_ellipsize(GTK_LABEL(c->label), PANGO_ELLIPSIZE_MIDDLE);
gtk_misc_set_alignment(GTK_MISC(c->label), 0.0, 0.5);
- VP_WIDGET_SET_STATE(c->label, VP_GTK_STATE_NORMAL);
- VP_WIDGET_SET_STATE(c->event, VP_GTK_STATE_NORMAL);
+ VB_WIDGET_SET_STATE(c->label, VB_GTK_STATE_NORMAL);
+ VB_WIDGET_SET_STATE(c->event, VB_GTK_STATE_NORMAL);
- VP_WIDGET_OVERRIDE_COLOR(c->label, GTK_STATE_NORMAL, &core.style.comp_fg[VP_COMP_NORMAL]);
- VP_WIDGET_OVERRIDE_COLOR(c->label, GTK_STATE_ACTIVE, &core.style.comp_fg[VP_COMP_ACTIVE]);
- VP_WIDGET_OVERRIDE_BACKGROUND(c->event, GTK_STATE_NORMAL, &core.style.comp_bg[VP_COMP_NORMAL]);
- VP_WIDGET_OVERRIDE_BACKGROUND(c->event, GTK_STATE_ACTIVE, &core.style.comp_bg[VP_COMP_ACTIVE]);
- VP_WIDGET_OVERRIDE_FONT(c->label, core.style.comp_font);
+ VB_WIDGET_OVERRIDE_COLOR(c->label, GTK_STATE_NORMAL, &core.style.comp_fg[VB_COMP_NORMAL]);
+ VB_WIDGET_OVERRIDE_COLOR(c->label, GTK_STATE_ACTIVE, &core.style.comp_fg[VB_COMP_ACTIVE]);
+ VB_WIDGET_OVERRIDE_BACKGROUND(c->event, GTK_STATE_NORMAL, &core.style.comp_bg[VB_COMP_NORMAL]);
+ VB_WIDGET_OVERRIDE_BACKGROUND(c->event, GTK_STATE_ACTIVE, &core.style.comp_bg[VB_COMP_ACTIVE]);
+ VB_WIDGET_OVERRIDE_FONT(c->label, core.style.comp_font);
GtkWidget *alignment = gtk_alignment_new(0.5, 0.5, 1, 1);
gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), padding, padding, padding, padding);
static gboolean dom_auto_insert(Client* c, Element* element)
{
if (dom_is_editable(element)) {
- vp_set_mode(c, VP_MODE_INSERT, FALSE);
+ vb_set_mode(c, VB_MODE_INSERT, FALSE);
return TRUE;
}
return FALSE;
webkit_dom_event_target_remove_event_listener(
WEBKIT_DOM_EVENT_TARGET(element), "focus", G_CALLBACK(dom_editable_focus_cb), true
);
- if (CLEAN_MODE(c->state.mode) != VP_MODE_INSERT) {
+ if (CLEAN_MODE(c->state.mode) != VB_MODE_INSERT) {
EventTarget* target = webkit_dom_event_get_target(event);
dom_auto_insert(c, (void*)target);
}
void hints_init(WebKitWebFrame* frame)
{
char* value = NULL;
- vp_eval_script(frame, HINTS_JS, HINT_FILE, &value);
+ vb_eval_script(frame, HINTS_JS, HINT_FILE, &value);
g_free(value);
}
void hints_clear(Client* c)
{
hints_observe_input(c, FALSE);
- if (CLEAN_MODE(c->state.mode) == VP_MODE_HINTING) {
+ if (CLEAN_MODE(c->state.mode) == VB_MODE_HINTING) {
char* js = g_strdup_printf("%s.clear();", HINT_VAR);
char* value = NULL;
- vp_eval_script(webkit_web_view_get_main_frame(c->gui.webview), js, HINT_FILE, &value);
+ vb_eval_script(webkit_web_view_get_main_frame(c->gui.webview), js, HINT_FILE, &value);
g_free(value);
g_free(js);
void hints_create(Client* c, const char* input, guint mode, const guint prefixLength)
{
char* js = NULL;
- if (CLEAN_MODE(c->state.mode) != VP_MODE_HINTING) {
+ if (CLEAN_MODE(c->state.mode) != VB_MODE_HINTING) {
Style* style = &core.style;
c->hints.prefixLength = prefixLength;
c->hints.mode = mode;
char* value = NULL;
int mode = c->hints.mode;
- gboolean success = vp_eval_script(
+ gboolean success = vb_eval_script(
webkit_web_view_get_main_frame(c->gui.webview), js, HINT_FILE, &value
);
if (!success) {
fprintf(stderr, "%s\n", value);
g_free(value);
- vp_set_mode(c, VP_MODE_NORMAL, FALSE);
+ vb_set_mode(c, VB_MODE_NORMAL, FALSE);
return;
}
);
} else if (!strncmp(value, "DONE:", 5)) {
hints_observe_input(c, FALSE);
- vp_set_mode(c, VP_MODE_NORMAL, TRUE);
+ vb_set_mode(c, VB_MODE_NORMAL, TRUE);
} else if (!strncmp(value, "INSERT:", 7)) {
hints_observe_input(c, FALSE);
- vp_set_mode(c, VP_MODE_INSERT, FALSE);
+ vb_set_mode(c, VB_MODE_INSERT, FALSE);
} else if (!strncmp(value, "DATA:", 5)) {
hints_observe_input(c, FALSE);
Arg a = {0};
/* check for escape or modkeys or counts */
if (IS_ESCAPE_KEY(keyval, state)) {
/* switch to normal mode and clear the input box */
- vp_set_mode(c, VP_MODE_NORMAL, TRUE);
+ vb_set_mode(c, VB_MODE_NORMAL, TRUE);
return TRUE;
}
/* allow mode keys and counts only in normal mode */
- if ((VP_MODE_SEARCH | VP_MODE_NORMAL) & c->state.mode) {
+ if ((VB_MODE_SEARCH | VB_MODE_NORMAL) & c->state.mode) {
if (c->state.modkey == 0 && ((keyval >= GDK_1 && keyval <= GDK_9)
|| (keyval == GDK_0 && c->state.count))) {
/* append the new entered count to previous one */
c->state.count = (c->state.count ? c->state.count * 10 : 0) + (keyval - GDK_0);
- vp_update_statusbar(c);
+ vb_update_statusbar(c);
return TRUE;
}
if (strchr(core.behave.modkeys->str, keyval) && c->state.modkey != keyval) {
c->state.modkey = (char)keyval;
- vp_update_statusbar(c);
+ vb_update_statusbar(c);
return TRUE;
}
/* variables */
static char **args;
-VpCore core;
+VbCore core;
Client* clients = NULL;
/* callbacks */
-static void vp_webview_progress_cb(WebKitWebView* view, GParamSpec* pspec, Client* c);
-static void vp_webview_download_progress_cb(WebKitWebView* view, GParamSpec* pspec, Client* c);
-static void vp_webview_load_status_cb(WebKitWebView* view, GParamSpec* pspec, Client* c);
-static void vp_destroy_window_cb(GtkWidget* widget, Client* c);
-static void vp_inputbox_activate_cb(GtkEntry* entry, Client* c);
-static gboolean vp_inputbox_keyrelease_cb(GtkEntry* entry, GdkEventKey* event, Client* c);
-static void vp_scroll_cb(GtkAdjustment* adjustment, Client* c);
-static void vp_new_request_cb(SoupSession* session, SoupMessage *message, Client* c);
-static void vp_gotheaders_cb(SoupMessage* message, Client* c);
-static WebKitWebView* vp_inspector_new(WebKitWebInspector* inspector, WebKitWebView* webview, Client* c);
-static gboolean vp_inspector_show(WebKitWebInspector* inspector, Client* c);
-static gboolean vp_inspector_close(WebKitWebInspector* inspector, Client* c);
-static void vp_inspector_finished(WebKitWebInspector* inspector, Client* c);
-static gboolean vp_button_relase_cb(WebKitWebView *webview, GdkEventButton* event, Client* c);
-static gboolean vp_new_window_policy_cb(
+static void vb_webview_progress_cb(WebKitWebView* view, GParamSpec* pspec, Client* c);
+static void vb_webview_download_progress_cb(WebKitWebView* view, GParamSpec* pspec, Client* c);
+static void vb_webview_load_status_cb(WebKitWebView* view, GParamSpec* pspec, Client* c);
+static void vb_destroy_window_cb(GtkWidget* widget, Client* c);
+static void vb_inputbox_activate_cb(GtkEntry* entry, Client* c);
+static gboolean vb_inputbox_keyrelease_cb(GtkEntry* entry, GdkEventKey* event, Client* c);
+static void vb_scroll_cb(GtkAdjustment* adjustment, Client* c);
+static void vb_new_request_cb(SoupSession* session, SoupMessage *message, Client* c);
+static void vb_gotheaders_cb(SoupMessage* message, Client* c);
+static WebKitWebView* vb_inspector_new(WebKitWebInspector* inspector, WebKitWebView* webview, Client* c);
+static gboolean vb_inspector_show(WebKitWebInspector* inspector, Client* c);
+static gboolean vb_inspector_close(WebKitWebInspector* inspector, Client* c);
+static void vb_inspector_finished(WebKitWebInspector* inspector, Client* c);
+static gboolean vb_button_relase_cb(WebKitWebView *webview, GdkEventButton* event, Client* c);
+static gboolean vb_new_window_policy_cb(
WebKitWebView* view, WebKitWebFrame* frame, WebKitNetworkRequest* request,
WebKitWebNavigationAction* navig, WebKitWebPolicyDecision* policy, Client* c);
-static WebKitWebView* vp_create_new_webview_cb(WebKitWebView* webview, WebKitWebFrame* frame, Client* c);
-static void vp_hover_link_cb(WebKitWebView* webview, const char* title, const char* link, Client* c);
-static void vp_title_changed_cb(WebKitWebView* webview, WebKitWebFrame* frame, const char* title, Client* c);
-static gboolean vp_mimetype_decision_cb(WebKitWebView* webview,
+static WebKitWebView* vb_create_new_webview_cb(WebKitWebView* webview, WebKitWebFrame* frame, Client* c);
+static void vb_hover_link_cb(WebKitWebView* webview, const char* title, const char* link, Client* c);
+static void vb_title_changed_cb(WebKitWebView* webview, WebKitWebFrame* frame, const char* title, Client* c);
+static gboolean vb_mimetype_decision_cb(WebKitWebView* webview,
WebKitWebFrame* frame, WebKitNetworkRequest* request, char*
mime_type, WebKitWebPolicyDecision* decision, Client* c);
-static gboolean vp_download_requested_cb(WebKitWebView* view, WebKitDownload* download, Client* c);
-static void vp_download_progress_cp(WebKitDownload* download, GParamSpec* pspec, Client* c);
-static void vp_request_start_cb(WebKitWebView* webview, WebKitWebFrame* frame,
+static gboolean vb_download_requested_cb(WebKitWebView* view, WebKitDownload* download, Client* c);
+static void vb_download_progress_cp(WebKitDownload* download, GParamSpec* pspec, Client* c);
+static void vb_request_start_cb(WebKitWebView* webview, WebKitWebFrame* frame,
WebKitWebResource* resource, WebKitNetworkRequest* request,
WebKitNetworkResponse* response, Client* c);
/* functions */
-static gboolean vp_process_input(Client* c, const char* input);
-static void vp_run_user_script(WebKitWebFrame* frame);
-static char* vp_jsref_to_string(JSContextRef context, JSValueRef ref);
-static void vp_init_core(void);
-static void vp_read_global_config(void);
-static void vp_process_config_file(Client* c, VpFile file);
-static Client* vp_client_new(void);
-static void vp_setup_signals(Client* c);
-static void vp_init_files(void);
-static void vp_set_cookie(SoupCookie* cookie);
-static const char* vp_get_cookies(SoupURI *uri);
-static gboolean vp_hide_message(Client* c);
-static void vp_set_status(Client* c, const StatusType status);
-static void vp_destroy_client(Client* c);
-static void vp_clean_up(void);
-
-void vp_clean_input(Client* c)
+static gboolean vb_process_input(Client* c, const char* input);
+static void vb_run_user_script(WebKitWebFrame* frame);
+static char* vb_jsref_to_string(JSContextRef context, JSValueRef ref);
+static void vb_init_core(void);
+static void vb_read_global_config(void);
+static void vb_process_config_file(Client* c, VpFile file);
+static Client* vb_client_new(void);
+static void vb_setup_signals(Client* c);
+static void vb_init_files(void);
+static void vb_set_cookie(SoupCookie* cookie);
+static const char* vb_get_cookies(SoupURI *uri);
+static gboolean vb_hide_message(Client* c);
+static void vb_set_status(Client* c, const StatusType status);
+static void vb_destroy_client(Client* c);
+static void vb_clean_up(void);
+
+void vb_clean_input(Client* c)
{
/* move focus from input box to clean it */
gtk_widget_grab_focus(GTK_WIDGET(c->gui.webview));
- vp_echo(c, VP_MSG_NORMAL, FALSE, "");
+ vb_echo(c, VB_MSG_NORMAL, FALSE, "");
}
-void vp_echo(Client* c, const MessageType type, gboolean hide, const char *error, ...)
+void vb_echo(Client* c, const MessageType type, gboolean hide, const char *error, ...)
{
va_list arg_list;
return;
}
- vp_update_input_style(c, type);
+ vb_update_input_style(c, type);
gtk_entry_set_text(GTK_ENTRY(c->gui.inputbox), message);
if (hide) {
- g_timeout_add_seconds(MESSAGE_TIMEOUT, (GSourceFunc)vp_hide_message, c);
+ g_timeout_add_seconds(MESSAGE_TIMEOUT, (GSourceFunc)vb_hide_message, c);
}
}
-gboolean vp_eval_script(WebKitWebFrame* frame, char* script, char* file, char** value)
+gboolean vb_eval_script(WebKitWebFrame* frame, char* script, char* file, char** value)
{
JSStringRef str, file_name;
JSValueRef exception = NULL, result = NULL;
JSStringRelease(str);
if (result) {
- *value = vp_jsref_to_string(js, result);
+ *value = vb_jsref_to_string(js, result);
return TRUE;
}
- *value = vp_jsref_to_string(js, exception);
+ *value = vb_jsref_to_string(js, exception);
return FALSE;
}
-gboolean vp_load_uri(Client* c, const Arg* arg)
+gboolean vb_load_uri(Client* c, const Arg* arg)
{
char* uri;
char* path = arg->s;
}
/* change state to normal mode */
- vp_set_mode(c, VP_MODE_NORMAL, FALSE);
+ vb_set_mode(c, VB_MODE_NORMAL, FALSE);
- if (arg->i == VP_TARGET_NEW) {
- Client* new = vp_client_new();
+ if (arg->i == VB_TARGET_NEW) {
+ Client* new = vb_client_new();
webkit_web_view_load_uri(new->gui.webview, uri);
} else {
/* Load a web page into the browser instance */
return TRUE;
}
-gboolean vp_set_clipboard(const Arg* arg)
+gboolean vb_set_clipboard(const Arg* arg)
{
gboolean result = FALSE;
if (!arg->s) {
return result;
}
- if (arg->i & VP_CLIPBOARD_PRIMARY) {
+ if (arg->i & VB_CLIPBOARD_PRIMARY) {
gtk_clipboard_set_text(PRIMARY_CLIPBOARD(), arg->s, -1);
result = TRUE;
}
- if (arg->i & VP_CLIPBOARD_SECONDARY) {
+ if (arg->i & VB_CLIPBOARD_SECONDARY) {
gtk_clipboard_set_text(SECONDARY_CLIPBOARD(), arg->s, -1);
result = TRUE;
}
* Set the base modes. All other mode flags like completion can be set directly
* to c->state.mode.
*/
-gboolean vp_set_mode(Client* c, Mode mode, gboolean clean)
+gboolean vb_set_mode(Client* c, Mode mode, gboolean clean)
{
if (!c) {
return FALSE;
}
- if ((c->state.mode & VP_MODE_COMPLETE)
- && !(mode & VP_MODE_COMPLETE)
+ if ((c->state.mode & VB_MODE_COMPLETE)
+ && !(mode & VB_MODE_COMPLETE)
) {
completion_clean(c);
}
int clean_mode = CLEAN_MODE(c->state.mode);
switch (CLEAN_MODE(mode)) {
- case VP_MODE_NORMAL:
+ case VB_MODE_NORMAL:
/* do this only if the mode is really switched */
- if (clean_mode != VP_MODE_NORMAL) {
+ if (clean_mode != VB_MODE_NORMAL) {
history_rewind(c);
}
- if (clean_mode == VP_MODE_HINTING) {
+ if (clean_mode == VB_MODE_HINTING) {
/* if previous mode was hinting clear the hints */
hints_clear(c);
- } else if (clean_mode == VP_MODE_INSERT) {
+ } else if (clean_mode == VB_MODE_INSERT) {
/* clean the input if current mode is insert to remove -- INPUT -- */
clean = TRUE;
- } else if (clean_mode == VP_MODE_SEARCH) {
+ } else if (clean_mode == VB_MODE_SEARCH) {
/* cleaup previous search */
- command_search(c, &((Arg){VP_SEARCH_OFF}));
+ command_search(c, &((Arg){VB_SEARCH_OFF}));
}
gtk_widget_grab_focus(GTK_WIDGET(c->gui.webview));
break;
- case VP_MODE_COMMAND:
- case VP_MODE_HINTING:
+ case VB_MODE_COMMAND:
+ case VB_MODE_HINTING:
gtk_widget_grab_focus(GTK_WIDGET(c->gui.inputbox));
break;
- case VP_MODE_INSERT:
+ case VB_MODE_INSERT:
gtk_widget_grab_focus(GTK_WIDGET(c->gui.webview));
- vp_echo(c, VP_MSG_NORMAL, FALSE, "-- INPUT --");
+ vb_echo(c, VB_MSG_NORMAL, FALSE, "-- INPUT --");
break;
- case VP_MODE_PATH_THROUGH:
+ case VB_MODE_PATH_THROUGH:
gtk_widget_grab_focus(GTK_WIDGET(c->gui.webview));
break;
}
/* echo message if given */
if (clean) {
- vp_echo(c, VP_MSG_NORMAL, FALSE, "");
+ vb_echo(c, VB_MSG_NORMAL, FALSE, "");
}
- vp_update_statusbar(c);
+ vb_update_statusbar(c);
return TRUE;
}
-void vp_set_widget_font(GtkWidget* widget, const VpColor* fg, const VpColor* bg, PangoFontDescription* font)
+void vb_set_widget_font(GtkWidget* widget, const VpColor* fg, const VpColor* bg, PangoFontDescription* font)
{
- VP_WIDGET_OVERRIDE_FONT(widget, font);
- VP_WIDGET_OVERRIDE_TEXT(widget, GTK_STATE_NORMAL, fg);
- VP_WIDGET_OVERRIDE_COLOR(widget, GTK_STATE_NORMAL, fg);
- VP_WIDGET_OVERRIDE_BASE(widget, GTK_STATE_NORMAL, bg);
- VP_WIDGET_OVERRIDE_BACKGROUND(widget, GTK_STATE_NORMAL, bg);
+ VB_WIDGET_OVERRIDE_FONT(widget, font);
+ VB_WIDGET_OVERRIDE_TEXT(widget, GTK_STATE_NORMAL, fg);
+ VB_WIDGET_OVERRIDE_COLOR(widget, GTK_STATE_NORMAL, fg);
+ VB_WIDGET_OVERRIDE_BASE(widget, GTK_STATE_NORMAL, bg);
+ VB_WIDGET_OVERRIDE_BACKGROUND(widget, GTK_STATE_NORMAL, bg);
}
-void vp_update_statusbar(Client* c)
+void vb_update_statusbar(Client* c)
{
GString* status = g_string_new("");
g_string_free(status, TRUE);
}
-void vp_update_status_style(Client* c)
+void vb_update_status_style(Client* c)
{
StatusType type = c->state.status;
- vp_set_widget_font(
+ vb_set_widget_font(
c->gui.eventbox, &core.style.status_fg[type], &core.style.status_bg[type], core.style.status_font[type]
);
- vp_set_widget_font(
+ vb_set_widget_font(
c->gui.statusbar.left, &core.style.status_fg[type], &core.style.status_bg[type], core.style.status_font[type]
);
- vp_set_widget_font(
+ vb_set_widget_font(
c->gui.statusbar.right, &core.style.status_fg[type], &core.style.status_bg[type], core.style.status_font[type]
);
}
-void vp_update_input_style(Client* c, MessageType type)
+void vb_update_input_style(Client* c, MessageType type)
{
- vp_set_widget_font(
+ vb_set_widget_font(
c->gui.inputbox, &core.style.input_fg[type], &core.style.input_bg[type], core.style.input_font[type]
);
}
-void vp_update_urlbar(Client* c, const char* uri)
+void vb_update_urlbar(Client* c, const char* uri)
{
gtk_label_set_text(GTK_LABEL(c->gui.statusbar.left), uri);
}
-static gboolean vp_hide_message(Client* c)
+static gboolean vb_hide_message(Client* c)
{
- vp_echo(c, VP_MSG_NORMAL, FALSE, "");
+ vb_echo(c, VB_MSG_NORMAL, FALSE, "");
return FALSE;
}
-static void vp_webview_progress_cb(WebKitWebView* view, GParamSpec* pspec, Client* c)
+static void vb_webview_progress_cb(WebKitWebView* view, GParamSpec* pspec, Client* c)
{
c->state.progress = webkit_web_view_get_progress(view) * 100;
- vp_update_statusbar(c);
+ vb_update_statusbar(c);
}
-static void vp_webview_download_progress_cb(WebKitWebView* view, GParamSpec* pspec, Client* c)
+static void vb_webview_download_progress_cb(WebKitWebView* view, GParamSpec* pspec, Client* c)
{
if (c->state.downloads) {
c->state.progress = 0;
}
c->state.progress /= g_list_length(c->state.downloads);
}
- vp_update_statusbar(c);
+ vb_update_statusbar(c);
}
-static void vp_webview_load_status_cb(WebKitWebView* view, GParamSpec* pspec, Client* c)
+static void vb_webview_load_status_cb(WebKitWebView* view, GParamSpec* pspec, Client* c)
{
const char* uri = webkit_web_view_get_uri(c->gui.webview);
case WEBKIT_LOAD_PROVISIONAL:
/* update load progress in statusbar */
c->state.progress = 0;
- vp_update_statusbar(c);
+ vb_update_statusbar(c);
break;
case WEBKIT_LOAD_COMMITTED:
WebKitNetworkRequest* request = webkit_web_data_source_get_request(src);
SoupMessage* msg = webkit_network_request_get_message(request);
SoupMessageFlags flags = soup_message_get_flags(msg);
- vp_set_status(
+ vb_set_status(
c,
- (flags & SOUP_MESSAGE_CERTIFICATE_TRUSTED) ? VP_STATUS_SSL_VALID : VP_STATUS_SSL_INVALID
+ (flags & SOUP_MESSAGE_CERTIFICATE_TRUSTED) ? VB_STATUS_SSL_VALID : VB_STATUS_SSL_INVALID
);
} else {
- vp_set_status(c, VP_STATUS_NORMAL);
+ vb_set_status(c, VB_STATUS_NORMAL);
}
/* inject the hinting javascript */
hints_init(frame);
/* run user script file */
- vp_run_user_script(frame);
+ vb_run_user_script(frame);
}
- /* status bar is updated by vp_set_mode */
- vp_set_mode(c, VP_MODE_NORMAL , FALSE);
- vp_update_urlbar(c, uri);
+ /* status bar is updated by vb_set_mode */
+ vb_set_mode(c, VB_MODE_NORMAL , FALSE);
+ vb_update_urlbar(c, uri);
break;
case WEBKIT_LOAD_FINISHED:
/* update load progress in statusbar */
c->state.progress = 100;
- vp_update_statusbar(c);
+ vb_update_statusbar(c);
dom_check_auto_insert(c);
}
}
-static void vp_destroy_window_cb(GtkWidget* widget, Client* c)
+static void vb_destroy_window_cb(GtkWidget* widget, Client* c)
{
- vp_destroy_client(c);
+ vb_destroy_client(c);
}
-static void vp_inputbox_activate_cb(GtkEntry *entry, Client* c)
+static void vb_inputbox_activate_cb(GtkEntry *entry, Client* c)
{
const char* text;
gboolean hist_save = FALSE;
switch (*text) {
case '/':
case '?':
- a.i = *text == '/' ? VP_SEARCH_FORWARD : VP_SEARCH_BACKWARD;
+ a.i = *text == '/' ? VB_SEARCH_FORWARD : VB_SEARCH_BACKWARD;
a.s = (command + 1);
command_search(c, &a);
hist_save = TRUE;
case ':':
completion_clean(c);
- vp_process_input(c, (command + 1));
+ vb_process_input(c, (command + 1));
hist_save = TRUE;
break;
}
g_free(command);
}
-static gboolean vp_inputbox_keyrelease_cb(GtkEntry* entry, GdkEventKey* event, Client* c)
+static gboolean vb_inputbox_keyrelease_cb(GtkEntry* entry, GdkEventKey* event, Client* c)
{
return FALSE;
}
-static void vp_scroll_cb(GtkAdjustment* adjustment, Client* c)
+static void vb_scroll_cb(GtkAdjustment* adjustment, Client* c)
{
- vp_update_statusbar(c);
+ vb_update_statusbar(c);
}
-static void vp_new_request_cb(SoupSession* session, SoupMessage *message, Client* c)
+static void vb_new_request_cb(SoupSession* session, SoupMessage *message, Client* c)
{
SoupMessageHeaders* header = message->request_headers;
SoupURI* uri;
soup_message_headers_remove(header, "Cookie");
uri = soup_message_get_uri(message);
- if ((cookie = vp_get_cookies(uri))) {
+ if ((cookie = vb_get_cookies(uri))) {
soup_message_headers_append(header, "Cookie", cookie);
}
- g_signal_connect_after(G_OBJECT(message), "got-headers", G_CALLBACK(vp_gotheaders_cb), c);
+ g_signal_connect_after(G_OBJECT(message), "got-headers", G_CALLBACK(vb_gotheaders_cb), c);
}
-static void vp_gotheaders_cb(SoupMessage* message, Client* c)
+static void vb_gotheaders_cb(SoupMessage* message, Client* c)
{
GSList* list = NULL;
GSList* p = NULL;
for(p = list = soup_cookies_from_response(message); p; p = g_slist_next(p)) {
- vp_set_cookie((SoupCookie *)p->data);
+ vb_set_cookie((SoupCookie *)p->data);
}
soup_cookies_free(list);
}
-static WebKitWebView* vp_inspector_new(WebKitWebInspector* inspector, WebKitWebView* webview, Client* c)
+static WebKitWebView* vb_inspector_new(WebKitWebInspector* inspector, WebKitWebView* webview, Client* c)
{
return WEBKIT_WEB_VIEW(webkit_web_view_new());
}
-static gboolean vp_inspector_show(WebKitWebInspector* inspector, Client* c)
+static gboolean vb_inspector_show(WebKitWebInspector* inspector, Client* c)
{
WebKitWebView* webview;
int height;
return TRUE;
}
-static gboolean vp_inspector_close(WebKitWebInspector* inspector, Client* c)
+static gboolean vb_inspector_close(WebKitWebInspector* inspector, Client* c)
{
WebKitWebView* webview;
return TRUE;
}
-static void vp_inspector_finished(WebKitWebInspector* inspector, Client* c)
+static void vb_inspector_finished(WebKitWebInspector* inspector, Client* c)
{
g_free(c->gui.inspector);
}
* Processed input from input box without trailing : or ? /, input from config
* file and default config.
*/
-static gboolean vp_process_input(Client* c, const char* input)
+static gboolean vb_process_input(Client* c, const char* input)
{
gboolean success;
char* command = NULL;
}
#ifdef FEATURE_COOKIE
-static void vp_set_cookie(SoupCookie* cookie)
+static void vb_set_cookie(SoupCookie* cookie)
{
SoupDate* date;
g_object_unref(jar);
}
-static const char* vp_get_cookies(SoupURI *uri)
+static const char* vb_get_cookies(SoupURI *uri)
{
const char* cookie;
}
#endif
-static void vp_set_status(Client* c, const StatusType status)
+static void vb_set_status(Client* c, const StatusType status)
{
if (c->state.status != status) {
c->state.status = status;
/* update the statusbar style only if the status changed */
- vp_update_status_style(c);
+ vb_update_status_style(c);
}
}
-static void vp_run_user_script(WebKitWebFrame* frame)
+static void vb_run_user_script(WebKitWebFrame* frame)
{
char* js = NULL;
GError* error = NULL;
&& g_file_get_contents(core.files[FILES_SCRIPT], &js, NULL, &error)
) {
char* value = NULL;
- gboolean success = vp_eval_script(frame, js, core.files[FILES_SCRIPT], &value);
+ gboolean success = vb_eval_script(frame, js, core.files[FILES_SCRIPT], &value);
if (!success) {
fprintf(stderr, "%s", value);
}
}
}
-static char* vp_jsref_to_string(JSContextRef context, JSValueRef ref)
+static char* vb_jsref_to_string(JSContextRef context, JSValueRef ref)
{
char* string;
JSStringRef str_ref = JSValueToStringCopy(context, ref, NULL);
return string;
}
-static void vp_init_core(void)
+static void vb_init_core(void)
{
/* TODO */
/* initialize the commands hash map */
command_init();
/* initialize the config files */
- vp_init_files();
+ vb_init_files();
/* initialize the keybindings */
keybind_init();
setting_init();
/* read additional configuration from config files */
- vp_read_global_config();
+ vb_read_global_config();
url_history_init();
}
-static void vp_read_global_config(void)
+static void vb_read_global_config(void)
{
/* load default config */
for (guint i = 0; default_config[i].command != NULL; i++) {
- if (!vp_process_input(NULL, default_config[i].command)) {
+ if (!vb_process_input(NULL, default_config[i].command)) {
fprintf(stderr, "Invalid default config: %s\n", default_config[i].command);
}
}
- vp_process_config_file(NULL, FILES_GLOBAL_CONFIG);
+ vb_process_config_file(NULL, FILES_GLOBAL_CONFIG);
}
-static void vp_process_config_file(Client* c, VpFile file)
+static void vb_process_config_file(Client* c, VpFile file)
{
/* read config from config files */
char **lines = util_get_lines(core.files[file]);
if (!g_ascii_isalpha(line[0])) {
continue;
}
- if (!vp_process_input(c, line)) {
+ if (!vb_process_input(c, line)) {
fprintf(stderr, "Invalid config: %s\n", line);
}
}
g_strfreev(lines);
}
-static Client* vp_client_new(void)
+static Client* vb_client_new(void)
{
Client* c = g_new0(Client, 1);
Gui* gui = &c->gui;
gtk_paned_pack1(GTK_PANED(gui->pane), GTK_WIDGET(gui->box), TRUE, TRUE);
- vp_setup_signals(c);
+ vb_setup_signals(c);
/* Put all part together */
gtk_container_add(GTK_CONTAINER(gui->scroll), GTK_WIDGET(gui->webview));
keybind_init_client(c);
setting_init_client(c);
- vp_process_config_file(c, FILES_LOCAL_CONFIG);
+ vb_process_config_file(c, FILES_LOCAL_CONFIG);
/* apply global settings to the status bar and input box */
- vp_update_status_style(c);
- vp_update_input_style(c, VP_MSG_NORMAL);
+ vb_update_status_style(c);
+ vb_update_input_style(c, VB_MSG_NORMAL);
c->next = clients;
clients = c;
return c;
}
-static void vp_setup_signals(Client* c)
+static void vb_setup_signals(Client* c)
{
/* Set up callbacks so that if either the main window or the browser
* instance is closed, the program will exit */
- g_signal_connect(c->gui.window, "destroy", G_CALLBACK(vp_destroy_window_cb), c);
+ g_signal_connect(c->gui.window, "destroy", G_CALLBACK(vb_destroy_window_cb), c);
g_object_connect(
G_OBJECT(c->gui.webview),
- "signal::notify::progress", G_CALLBACK(vp_webview_progress_cb), c,
- "signal::notify::load-status", G_CALLBACK(vp_webview_load_status_cb), c,
- "signal::button-release-event", G_CALLBACK(vp_button_relase_cb), c,
- "signal::new-window-policy-decision-requested", G_CALLBACK(vp_new_window_policy_cb), c,
- "signal::create-web-view", G_CALLBACK(vp_create_new_webview_cb), c,
- "signal::hovering-over-link", G_CALLBACK(vp_hover_link_cb), c,
- "signal::title-changed", G_CALLBACK(vp_title_changed_cb), c,
- "signal::mime-type-policy-decision-requested", G_CALLBACK(vp_mimetype_decision_cb), c,
- "signal::download-requested", G_CALLBACK(vp_download_requested_cb), c,
- "signal::resource-request-starting", G_CALLBACK(vp_request_start_cb), c,
+ "signal::notify::progress", G_CALLBACK(vb_webview_progress_cb), c,
+ "signal::notify::load-status", G_CALLBACK(vb_webview_load_status_cb), c,
+ "signal::button-release-event", G_CALLBACK(vb_button_relase_cb), c,
+ "signal::new-window-policy-decision-requested", G_CALLBACK(vb_new_window_policy_cb), c,
+ "signal::create-web-view", G_CALLBACK(vb_create_new_webview_cb), c,
+ "signal::hovering-over-link", G_CALLBACK(vb_hover_link_cb), c,
+ "signal::title-changed", G_CALLBACK(vb_title_changed_cb), c,
+ "signal::mime-type-policy-decision-requested", G_CALLBACK(vb_mimetype_decision_cb), c,
+ "signal::download-requested", G_CALLBACK(vb_download_requested_cb), c,
+ "signal::resource-request-starting", G_CALLBACK(vb_request_start_cb), c,
NULL
);
g_object_connect(
G_OBJECT(c->gui.inputbox),
- "signal::activate", G_CALLBACK(vp_inputbox_activate_cb), c,
- "signal::key-release-event", G_CALLBACK(vp_inputbox_keyrelease_cb), c,
+ "signal::activate", G_CALLBACK(vb_inputbox_activate_cb), c,
+ "signal::key-release-event", G_CALLBACK(vb_inputbox_keyrelease_cb), c,
NULL
);
/* webview adjustment */
g_object_connect(G_OBJECT(c->gui.adjust_v),
- "signal::value-changed", G_CALLBACK(vp_scroll_cb), c,
+ "signal::value-changed", G_CALLBACK(vb_scroll_cb), c,
NULL
);
- g_signal_connect_after(G_OBJECT(core.soup_session), "request-started", G_CALLBACK(vp_new_request_cb), c);
+ g_signal_connect_after(G_OBJECT(core.soup_session), "request-started", G_CALLBACK(vb_new_request_cb), c);
/* inspector */
/* TODO use g_object_connect instead */
- g_signal_connect(G_OBJECT(c->gui.inspector), "inspect-web-view", G_CALLBACK(vp_inspector_new), c);
- g_signal_connect(G_OBJECT(c->gui.inspector), "show-window", G_CALLBACK(vp_inspector_show), c);
- g_signal_connect(G_OBJECT(c->gui.inspector), "close-window", G_CALLBACK(vp_inspector_close), c);
- g_signal_connect(G_OBJECT(c->gui.inspector), "finished", G_CALLBACK(vp_inspector_finished), c);
+ g_signal_connect(G_OBJECT(c->gui.inspector), "inspect-web-view", G_CALLBACK(vb_inspector_new), c);
+ g_signal_connect(G_OBJECT(c->gui.inspector), "show-window", G_CALLBACK(vb_inspector_show), c);
+ g_signal_connect(G_OBJECT(c->gui.inspector), "close-window", G_CALLBACK(vb_inspector_close), c);
+ g_signal_connect(G_OBJECT(c->gui.inspector), "finished", G_CALLBACK(vb_inspector_finished), c);
}
-static void vp_init_files(void)
+static void vb_init_files(void)
{
char* path = util_get_config_dir();
g_free(path);
}
-static gboolean vp_button_relase_cb(WebKitWebView* webview, GdkEventButton* event, Client* c)
+static gboolean vb_button_relase_cb(WebKitWebView* webview, GdkEventButton* event, Client* c)
{
gboolean propagate = FALSE;
WebKitHitTestResultContext context;
WebKitHitTestResult *result = webkit_web_view_get_hit_test_result(webview, event);
g_object_get(result, "context", &context, NULL);
- if (mode == VP_MODE_NORMAL && context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE) {
- vp_set_mode(c, VP_MODE_INSERT, FALSE);
+ if (mode == VB_MODE_NORMAL && context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE) {
+ vb_set_mode(c, VB_MODE_INSERT, FALSE);
propagate = TRUE;
}
/* middle mouse click onto link */
if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK && event->button == 2) {
- Arg a = {VP_TARGET_NEW};
+ Arg a = {VB_TARGET_NEW};
g_object_get(result, "link-uri", &a.s, NULL);
- vp_load_uri(c, &a);
+ vb_load_uri(c, &a);
propagate = TRUE;
}
return propagate;
}
-static gboolean vp_new_window_policy_cb(
+static gboolean vb_new_window_policy_cb(
WebKitWebView* view, WebKitWebFrame* frame, WebKitNetworkRequest* request,
WebKitWebNavigationAction* navig, WebKitWebPolicyDecision* policy, Client* c)
{
if (webkit_web_navigation_action_get_reason(navig) == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) {
/* open in a new window */
- Arg a = {VP_TARGET_NEW, (char*)webkit_network_request_get_uri(request)};
- vp_load_uri(c, &a);
+ Arg a = {VB_TARGET_NEW, (char*)webkit_network_request_get_uri(request)};
+ vb_load_uri(c, &a);
webkit_web_policy_decision_ignore(policy);
return TRUE;
}
return FALSE;
}
-static WebKitWebView* vp_create_new_webview_cb(WebKitWebView* webview, WebKitWebFrame* frame, Client* c)
+static WebKitWebView* vb_create_new_webview_cb(WebKitWebView* webview, WebKitWebFrame* frame, Client* c)
{
- Client* new = vp_client_new();
+ Client* new = vb_client_new();
return new->gui.webview;
}
-static void vp_hover_link_cb(WebKitWebView* webview, const char* title, const char* link, Client* c)
+static void vb_hover_link_cb(WebKitWebView* webview, const char* title, const char* link, Client* c)
{
if (link) {
char* message = g_strdup_printf("Link: %s", link);
gtk_label_set_text(GTK_LABEL(c->gui.statusbar.left), message);
g_free(message);
} else {
- vp_update_urlbar(c, webkit_web_view_get_uri(webview));
+ vb_update_urlbar(c, webkit_web_view_get_uri(webview));
}
}
-static void vp_title_changed_cb(WebKitWebView* webview, WebKitWebFrame* frame, const char* title, Client* c)
+static void vb_title_changed_cb(WebKitWebView* webview, WebKitWebFrame* frame, const char* title, Client* c)
{
gtk_window_set_title(GTK_WINDOW(c->gui.window), title);
}
-static gboolean vp_mimetype_decision_cb(WebKitWebView* webview,
+static gboolean vb_mimetype_decision_cb(WebKitWebView* webview,
WebKitWebFrame* frame, WebKitNetworkRequest* request, char*
mime_type, WebKitWebPolicyDecision* decision, Client* c)
{
return FALSE;
}
-static gboolean vp_download_requested_cb(WebKitWebView* view, WebKitDownload* download, Client* c)
+static gboolean vb_download_requested_cb(WebKitWebView* view, WebKitDownload* download, Client* c)
{
WebKitDownloadStatus status;
char* uri = NULL;
guint64 size = webkit_download_get_total_size(download);
if (size > 0) {
- vp_echo(c, VP_MSG_NORMAL, FALSE, "Download %s [~%uB] started ...", filename, size);
+ vb_echo(c, VB_MSG_NORMAL, FALSE, "Download %s [~%uB] started ...", filename, size);
} else {
- vp_echo(c, VP_MSG_NORMAL, FALSE, "Download %s started ...", filename);
+ vb_echo(c, VB_MSG_NORMAL, FALSE, "Download %s started ...", filename);
}
status = webkit_download_get_status(download);
c->state.downloads = g_list_prepend(c->state.downloads, download);
/* connect signal handler to check if the download is done */
- g_signal_connect(download, "notify::status", G_CALLBACK(vp_download_progress_cp), c);
- g_signal_connect(download, "notify::progress", G_CALLBACK(vp_webview_download_progress_cb), c);
+ g_signal_connect(download, "notify::status", G_CALLBACK(vb_download_progress_cp), c);
+ g_signal_connect(download, "notify::progress", G_CALLBACK(vb_webview_download_progress_cb), c);
- vp_update_statusbar(c);
+ vb_update_statusbar(c);
return TRUE;
}
/**
* Callback to filter started resource request.
*/
-static void vp_request_start_cb(WebKitWebView* webview, WebKitWebFrame* frame,
+static void vb_request_start_cb(WebKitWebView* webview, WebKitWebFrame* frame,
WebKitWebResource* resource, WebKitNetworkRequest* request,
WebKitNetworkResponse* response, Client* c)
{
}
}
-static void vp_download_progress_cp(WebKitDownload* download, GParamSpec* pspec, Client* c)
+static void vb_download_progress_cp(WebKitDownload* download, GParamSpec* pspec, Client* c)
{
WebKitDownloadStatus status = webkit_download_get_status(download);
char* file = g_path_get_basename(webkit_download_get_destination_uri(download));
if (status != WEBKIT_DOWNLOAD_STATUS_FINISHED) {
- vp_echo(c, VP_MSG_ERROR, FALSE, "Error downloading %s", file);
+ vb_echo(c, VB_MSG_ERROR, FALSE, "Error downloading %s", file);
} else {
- vp_echo(c, VP_MSG_NORMAL, FALSE, "Download %s finished", file);
+ vb_echo(c, VB_MSG_NORMAL, FALSE, "Download %s finished", file);
}
g_free(file);
/* remove the donwload from the list */
c->state.downloads = g_list_remove(c->state.downloads, download);
- vp_update_statusbar(c);
+ vb_update_statusbar(c);
}
-static void vp_destroy_client(Client* c)
+static void vb_destroy_client(Client* c)
{
const char* uri = webkit_web_view_get_uri(c->gui.webview);
/* write last URL into file for recreation */
}
}
-static void vp_clean_up(void)
+static void vb_clean_up(void)
{
while (clients) {
- vp_destroy_client(clients);
+ vb_destroy_client(clients);
}
command_cleanup();
core.embed = strtol(winid, NULL, 0);
}
- vp_init_core();
+ vb_init_core();
- vp_client_new();
+ vb_client_new();
/* command line argument: URL */
- Arg arg = {VP_TARGET_CURRENT};
+ Arg arg = {VB_TARGET_CURRENT};
if (argc > 1) {
arg.s = g_strdup(argv[argc - 1]);
} else {
arg.s = g_strdup(core.config.home_page);
}
- vp_load_uri(clients, &arg);
+ vb_load_uri(clients, &arg);
g_free(arg.s);
/* Run the main GTK+ event loop */
gtk_main();
- vp_clean_up();
+ vb_clean_up();
return EXIT_SUCCESS;
}
#endif
#define GET_TEXT() (gtk_entry_get_text(GTK_ENTRY(vp.gui.inputbox)))
-#define CLEAN_MODE(mode) ((mode) & ~(VP_MODE_COMPLETE))
-#define CLEAR_INPUT() (vp_echo(VP_MSG_NORMAL, ""))
+#define CLEAN_MODE(mode) ((mode) & ~(VB_MODE_COMPLETE))
+#define CLEAR_INPUT() (vb_echo(VB_MSG_NORMAL, ""))
#define PRIMARY_CLIPBOARD() gtk_clipboard_get(GDK_SELECTION_PRIMARY)
#define SECONDARY_CLIPBOARD() gtk_clipboard_get(GDK_NONE)
#ifdef HAS_GTK3
#define VpColor GdkRGBA
-#define VP_COLOR_PARSE(color, string) (gdk_rgba_parse(color, string))
-#define VP_COLOR_TO_STRING(color) (gdk_rgba_to_string(color))
-#define VP_WIDGET_OVERRIDE_BACKGROUND gtk_widget_override_background_color
-#define VP_WIDGET_OVERRIDE_BASE gtk_widget_override_background_color
-#define VP_WIDGET_OVERRIDE_COLOR gtk_widget_override_color
-#define VP_WIDGET_OVERRIDE_TEXT gtk_widget_override_color
-#define VP_WIDGET_OVERRIDE_FONT gtk_widget_override_font
-
-#define VP_GTK_STATE_NORMAL GTK_STATE_FLAG_NORMAL
-#define VP_GTK_STATE_ACTIVE GTK_STATE_FLAG_ACTIVE
-#define VP_WIDGET_SET_STATE(w, s) gtk_widget_set_state_flags(w, s, true)
+#define VB_COLOR_PARSE(color, string) (gdk_rgba_parse(color, string))
+#define VB_COLOR_TO_STRING(color) (gdk_rgba_to_string(color))
+#define VB_WIDGET_OVERRIDE_BACKGROUND gtk_widget_override_background_color
+#define VB_WIDGET_OVERRIDE_BASE gtk_widget_override_background_color
+#define VB_WIDGET_OVERRIDE_COLOR gtk_widget_override_color
+#define VB_WIDGET_OVERRIDE_TEXT gtk_widget_override_color
+#define VB_WIDGET_OVERRIDE_FONT gtk_widget_override_font
+
+#define VB_GTK_STATE_NORMAL GTK_STATE_FLAG_NORMAL
+#define VB_GTK_STATE_ACTIVE GTK_STATE_FLAG_ACTIVE
+#define VB_WIDGET_SET_STATE(w, s) gtk_widget_set_state_flags(w, s, true)
#else
#define VpColor GdkColor
-#define VP_COLOR_PARSE(color, string) (gdk_color_parse(string, color))
-#define VP_COLOR_TO_STRING(color) (gdk_color_to_string(color))
-#define VP_WIDGET_OVERRIDE_BACKGROUND gtk_widget_modify_bg
-#define VP_WIDGET_OVERRIDE_BASE gtk_widget_modify_base
-#define VP_WIDGET_OVERRIDE_COLOR gtk_widget_modify_fg
-#define VP_WIDGET_OVERRIDE_TEXT gtk_widget_modify_text
-#define VP_WIDGET_OVERRIDE_FONT gtk_widget_modify_font
-
-#define VP_GTK_STATE_NORMAL GTK_STATE_NORMAL
-#define VP_GTK_STATE_ACTIVE GTK_STATE_ACTIVE
-#define VP_WIDGET_SET_STATE(w, s) gtk_widget_set_state(w, s)
+#define VB_COLOR_PARSE(color, string) (gdk_color_parse(string, color))
+#define VB_COLOR_TO_STRING(color) (gdk_color_to_string(color))
+#define VB_WIDGET_OVERRIDE_BACKGROUND gtk_widget_modify_bg
+#define VB_WIDGET_OVERRIDE_BASE gtk_widget_modify_base
+#define VB_WIDGET_OVERRIDE_COLOR gtk_widget_modify_fg
+#define VB_WIDGET_OVERRIDE_TEXT gtk_widget_modify_text
+#define VB_WIDGET_OVERRIDE_FONT gtk_widget_modify_font
+
+#define VB_GTK_STATE_NORMAL GTK_STATE_NORMAL
+#define VB_GTK_STATE_ACTIVE GTK_STATE_ACTIVE
+#define VB_WIDGET_SET_STATE(w, s) gtk_widget_set_state(w, s)
#endif
/* enums */
-typedef enum _vp_mode {
- VP_MODE_NORMAL = 1<<0,
- VP_MODE_COMMAND = 1<<1,
- VP_MODE_PATH_THROUGH = 1<<2,
- VP_MODE_INSERT = 1<<3,
- VP_MODE_SEARCH = 1<<4,
- VP_MODE_COMPLETE = 1<<5,
- VP_MODE_HINTING = 1<<6,
+typedef enum _vb_mode {
+ VB_MODE_NORMAL = 1<<0,
+ VB_MODE_COMMAND = 1<<1,
+ VB_MODE_PATH_THROUGH = 1<<2,
+ VB_MODE_INSERT = 1<<3,
+ VB_MODE_SEARCH = 1<<4,
+ VB_MODE_COMPLETE = 1<<5,
+ VB_MODE_HINTING = 1<<6,
} Mode;
enum {
- VP_NAVIG_BACK,
- VP_NAVIG_FORWARD,
- VP_NAVIG_RELOAD,
- VP_NAVIG_RELOAD_FORCE,
- VP_NAVIG_STOP_LOADING
+ VB_NAVIG_BACK,
+ VB_NAVIG_FORWARD,
+ VB_NAVIG_RELOAD,
+ VB_NAVIG_RELOAD_FORCE,
+ VB_NAVIG_STOP_LOADING
};
enum {
- VP_TARGET_CURRENT,
- VP_TARGET_NEW
+ VB_TARGET_CURRENT,
+ VB_TARGET_NEW
};
enum {
- VP_INPUT_CURRENT_URI = 1
+ VB_INPUT_CURRENT_URI = 1
};
/*
1 << 3: 0 = paging/halfpage, 1 = line
1 << 4: 0 = paging, 1 = halfpage
*/
-enum {VP_SCROLL_TYPE_JUMP, VP_SCROLL_TYPE_SCROLL};
+enum {VB_SCROLL_TYPE_JUMP, VB_SCROLL_TYPE_SCROLL};
enum {
- VP_SCROLL_AXIS_V,
- VP_SCROLL_AXIS_H = (1 << 1)
+ VB_SCROLL_AXIS_V,
+ VB_SCROLL_AXIS_H = (1 << 1)
};
enum {
- VP_SCROLL_DIRECTION_TOP,
- VP_SCROLL_DIRECTION_DOWN = (1 << 2),
- VP_SCROLL_DIRECTION_LEFT = VP_SCROLL_AXIS_H,
- VP_SCROLL_DIRECTION_RIGHT = VP_SCROLL_AXIS_H | (1 << 2)
+ VB_SCROLL_DIRECTION_TOP,
+ VB_SCROLL_DIRECTION_DOWN = (1 << 2),
+ VB_SCROLL_DIRECTION_LEFT = VB_SCROLL_AXIS_H,
+ VB_SCROLL_DIRECTION_RIGHT = VB_SCROLL_AXIS_H | (1 << 2)
};
enum {
- VP_SCROLL_UNIT_PAGE,
- VP_SCROLL_UNIT_LINE = (1 << 3),
- VP_SCROLL_UNIT_HALFPAGE = (1 << 4)
+ VB_SCROLL_UNIT_PAGE,
+ VB_SCROLL_UNIT_LINE = (1 << 3),
+ VB_SCROLL_UNIT_HALFPAGE = (1 << 4)
};
typedef enum {
- VP_SEARCH_FORWARD,
- VP_SEARCH_BACKWARD,
- VP_SEARCH_OFF,
+ VB_SEARCH_FORWARD,
+ VB_SEARCH_BACKWARD,
+ VB_SEARCH_OFF,
} SearchDirection;
typedef enum {
- VP_MSG_NORMAL,
- VP_MSG_ERROR,
- VP_MSG_LAST
+ VB_MSG_NORMAL,
+ VB_MSG_ERROR,
+ VB_MSG_LAST
} MessageType;
typedef enum {
- VP_STATUS_NORMAL,
- VP_STATUS_SSL_VALID,
- VP_STATUS_SSL_INVALID,
- VP_STATUS_LAST
+ VB_STATUS_NORMAL,
+ VB_STATUS_SSL_VALID,
+ VB_STATUS_SSL_INVALID,
+ VB_STATUS_LAST
} StatusType;
typedef enum {
- VP_COMP_NORMAL,
- VP_COMP_ACTIVE,
- VP_COMP_LAST
+ VB_COMP_NORMAL,
+ VB_COMP_ACTIVE,
+ VB_COMP_LAST
} CompletionStyle;
typedef enum {
} Type;
enum {
- VP_CLIPBOARD_PRIMARY = (1<<1),
- VP_CLIPBOARD_SECONDARY = (1<<2)
+ VB_CLIPBOARD_PRIMARY = (1<<1),
+ VB_CLIPBOARD_SECONDARY = (1<<2)
};
/* structs */
} Completions;
typedef struct {
- VpColor input_fg[VP_MSG_LAST];
- VpColor input_bg[VP_MSG_LAST];
- PangoFontDescription* input_font[VP_MSG_LAST];
+ VpColor input_fg[VB_MSG_LAST];
+ VpColor input_bg[VB_MSG_LAST];
+ PangoFontDescription* input_font[VB_MSG_LAST];
/* completion */
- VpColor comp_fg[VP_COMP_LAST];
- VpColor comp_bg[VP_COMP_LAST];
+ VpColor comp_fg[VB_COMP_LAST];
+ VpColor comp_bg[VB_COMP_LAST];
PangoFontDescription* comp_font;
/* hint style */
char* hint_bg;
char* hint_fg;
char* hint_style;
/* status bar */
- VpColor status_bg[VP_STATUS_LAST];
- VpColor status_fg[VP_STATUS_LAST];
- PangoFontDescription* status_font[VP_STATUS_LAST];
+ VpColor status_bg[VB_STATUS_LAST];
+ VpColor status_fg[VB_STATUS_LAST];
+ PangoFontDescription* status_font[VB_STATUS_LAST];
} Style;
typedef struct {
#else
GdkNativeWindow embed;
#endif
-} VpCore;
+} VbCore;
/* main object */
-extern VpCore core;
+extern VbCore core;
/* functions */
-void vp_clean_input(Client* c);
-void vp_echo(Client* c, const MessageType type, gboolean hide, const char *error, ...);
-gboolean vp_eval_script(WebKitWebFrame* frame, char* script, char* file, char** value);
-gboolean vp_load_uri(Client* c, const Arg* arg);
-gboolean vp_set_clipboard(const Arg* arg);
-gboolean vp_set_mode(Client* c, Mode mode, gboolean clean);
-void vp_set_widget_font(GtkWidget* widget, const VpColor* fg, const VpColor* bg, PangoFontDescription* font);
-void vp_update_statusbar(Client* c);
-void vp_update_status_style(Client* c);
-void vp_update_input_style(Client* c, MessageType type);
-void vp_update_urlbar(Client* c, const char* uri);
+void vb_clean_input(Client* c);
+void vb_echo(Client* c, const MessageType type, gboolean hide, const char *error, ...);
+gboolean vb_eval_script(WebKitWebFrame* frame, char* script, char* file, char** value);
+gboolean vb_load_uri(Client* c, const Arg* arg);
+gboolean vb_set_clipboard(const Arg* arg);
+gboolean vb_set_mode(Client* c, Mode mode, gboolean clean);
+void vb_set_widget_font(GtkWidget* widget, const VpColor* fg, const VpColor* bg, PangoFontDescription* font);
+void vb_update_statusbar(Client* c);
+void vb_update_status_style(Client* c);
+void vb_update_input_style(Client* c, MessageType type);
+void vb_update_urlbar(Client* c, const char* uri);
#endif /* end of include guard: _MAIN_H */
Setting* s = g_hash_table_lookup(core.settings, name);
if (!s) {
- vp_echo(c, VP_MSG_ERROR, TRUE, "Config '%s' not found", name);
+ vb_echo(c, VB_MSG_ERROR, TRUE, "Config '%s' not found", name);
return FALSE;
}
* it to the arg of the setting */
a = setting_char_to_arg(param, s->type);
if (a == NULL) {
- vp_echo(c, VP_MSG_ERROR, TRUE, "No valid value");
+ vb_echo(c, VB_MSG_ERROR, TRUE, "No valid value");
return FALSE;
}
g_free(a);
if (!result) {
- vp_echo(c, VP_MSG_ERROR, TRUE, "Could not set %s", s->alias ? s->alias : s->name);
+ vb_echo(c, VB_MSG_ERROR, TRUE, "Could not set %s", s->alias ? s->alias : s->name);
}
return result;
if (type == SETTING_GET) {
result = s->func(c, s, type);
if (!result) {
- vp_echo(c, VP_MSG_ERROR, TRUE, "Could not get %s", s->alias ? s->alias : s->name);
+ vb_echo(c, VB_MSG_ERROR, TRUE, "Could not get %s", s->alias ? s->alias : s->name);
}
return result;
/* toggle bolean vars */
if (s->type != TYPE_BOOLEAN) {
- vp_echo(c, VP_MSG_ERROR, TRUE, "Could not toggle none boolean %s", s->alias ? s->alias : s->name);
+ vb_echo(c, VB_MSG_ERROR, TRUE, "Could not toggle none boolean %s", s->alias ? s->alias : s->name);
return FALSE;
}
result = s->func(c, s, type);
if (!result) {
- vp_echo(c, VP_MSG_ERROR, TRUE, "Could not toggle %s", s->alias ? s->alias : s->name);
+ vb_echo(c, VB_MSG_ERROR, TRUE, "Could not toggle %s", s->alias ? s->alias : s->name);
}
return result;
switch (s->type) {
case TYPE_BOOLEAN:
- vp_echo(c, VP_MSG_NORMAL, FALSE, " %s=%s", name, *(gboolean*)value ? "true" : "false");
+ vb_echo(c, VB_MSG_NORMAL, FALSE, " %s=%s", name, *(gboolean*)value ? "true" : "false");
break;
case TYPE_INTEGER:
- vp_echo(c, VP_MSG_NORMAL, FALSE, " %s=%d", name, *(int*)value);
+ vb_echo(c, VB_MSG_NORMAL, FALSE, " %s=%d", name, *(int*)value);
break;
case TYPE_FLOAT:
- vp_echo(c, VP_MSG_NORMAL, FALSE, " %s=%g", name, *(gfloat*)value);
+ vb_echo(c, VB_MSG_NORMAL, FALSE, " %s=%g", name, *(gfloat*)value);
break;
case TYPE_CHAR:
- vp_echo(c, VP_MSG_NORMAL, FALSE, " %s=%s", name, (char*)value);
+ vb_echo(c, VB_MSG_NORMAL, FALSE, " %s=%s", name, (char*)value);
break;
case TYPE_COLOR:
- string = VP_COLOR_TO_STRING((VpColor*)value);
- vp_echo(c, VP_MSG_NORMAL, FALSE, " %s=%s", name, string);
+ string = VB_COLOR_TO_STRING((VpColor*)value);
+ vb_echo(c, VB_MSG_NORMAL, FALSE, " %s=%s", name, string);
g_free(string);
break;
case TYPE_FONT:
string = pango_font_description_to_string((PangoFontDescription*)value);
- vp_echo(c, VP_MSG_NORMAL, FALSE, " %s=%s", name, string);
+ vb_echo(c, VB_MSG_NORMAL, FALSE, " %s=%s", name, string);
g_free(string);
break;
}
{
StatusType stype;
if (g_str_has_prefix(s->name, "status-sslinvalid")) {
- stype = VP_STATUS_SSL_INVALID;
+ stype = VB_STATUS_SSL_INVALID;
} else if (g_str_has_prefix(s->name, "status-ssl")) {
- stype = VP_STATUS_SSL_VALID;
+ stype = VB_STATUS_SSL_VALID;
} else {
- stype = VP_STATUS_NORMAL;
+ stype = VB_STATUS_NORMAL;
}
if (type == SETTING_GET) {
setting_print_value(c, s, &core.style.status_bg[stype]);
} else {
- VP_COLOR_PARSE(&core.style.status_bg[stype], s->arg.s);
+ VB_COLOR_PARSE(&core.style.status_bg[stype], s->arg.s);
/* update the status style for all clients */
for(Client* p = clients; p; p = p->next) {
- vp_update_status_style(p);
+ vb_update_status_style(p);
}
}
{
StatusType stype;
if (g_str_has_prefix(s->name, "status-sslinvalid")) {
- stype = VP_STATUS_SSL_INVALID;
+ stype = VB_STATUS_SSL_INVALID;
} else if (g_str_has_prefix(s->name, "status-ssl")) {
- stype = VP_STATUS_SSL_VALID;
+ stype = VB_STATUS_SSL_VALID;
} else {
- stype = VP_STATUS_NORMAL;
+ stype = VB_STATUS_NORMAL;
}
if (type == SETTING_GET) {
setting_print_value(c, s, &core.style.status_fg[stype]);
} else {
- VP_COLOR_PARSE(&core.style.status_fg[stype], s->arg.s);
+ VB_COLOR_PARSE(&core.style.status_fg[stype], s->arg.s);
/* update the status style for all clients */
for(Client* p = clients; p; p = p->next) {
- vp_update_status_style(p);
+ vb_update_status_style(p);
}
}
{
StatusType stype;
if (g_str_has_prefix(s->name, "status-sslinvalid")) {
- stype = VP_STATUS_SSL_INVALID;
+ stype = VB_STATUS_SSL_INVALID;
} else if (g_str_has_prefix(s->name, "status-ssl")) {
- stype = VP_STATUS_SSL_VALID;
+ stype = VB_STATUS_SSL_VALID;
} else {
- stype = VP_STATUS_NORMAL;
+ stype = VB_STATUS_NORMAL;
}
if (type == SETTING_GET) {
core.style.status_font[stype] = pango_font_description_from_string(s->arg.s);
/* update the status style for all clients */
for(Client* p = clients; p; p = p->next) {
- vp_update_status_style(p);
+ vb_update_status_style(p);
}
}
static gboolean setting_input_style(Client* c, const Setting* s, const SettingType type)
{
Style* style = &core.style;
- MessageType itype = g_str_has_suffix(s->name, "normal") ? VP_MSG_NORMAL : VP_MSG_ERROR;
+ MessageType itype = g_str_has_suffix(s->name, "normal") ? VB_MSG_NORMAL : VB_MSG_ERROR;
if (s->type == TYPE_FONT) {
/* input font */
if (type == SETTING_GET) {
setting_print_value(c, s, color);
} else {
- VP_COLOR_PARSE(color, s->arg.s);
+ VB_COLOR_PARSE(color, s->arg.s);
}
}
if (type != SETTING_GET) {
/* update the inputbox style for all clients */
for(Client* p = clients; p; p = p->next) {
- /* vp_update_input_style seems to take no immediatly effect */
- vp_echo(p, VP_MSG_NORMAL, FALSE, gtk_entry_get_text(GTK_ENTRY(p->gui.inputbox)));
+ /* vb_update_input_style seems to take no immediatly effect */
+ vb_echo(p, VB_MSG_NORMAL, FALSE, gtk_entry_get_text(GTK_ENTRY(p->gui.inputbox)));
}
}
static gboolean setting_completion_style(Client* c, const Setting* s, const SettingType type)
{
Style* style = &core.style;
- CompletionStyle ctype = g_str_has_suffix(s->name, "normal") ? VP_COMP_NORMAL : VP_COMP_ACTIVE;
+ CompletionStyle ctype = g_str_has_suffix(s->name, "normal") ? VB_COMP_NORMAL : VB_COMP_ACTIVE;
if (s->type == TYPE_INTEGER) {
/* max completion items */
if (type == SETTING_GET) {
setting_print_value(c, s, color);
} else {
- VP_COLOR_PARSE(color, s->arg.s);
+ VB_COLOR_PARSE(color, s->arg.s);
}
}