Arg a;
command = g_hash_table_lookup(vb.behave.commands, name);
if (!command) {
- vb_echo(VB_MSG_ERROR, TRUE, "Command '%s' not found", name);
+ vb_echo(VB_MSG_ERROR, true, "Command '%s' not found", name);
vb_set_mode(VB_MODE_NORMAL, false);
return false;
*/
gboolean command_run_multi(const Arg *arg)
{
- gboolean result = TRUE;
+ gboolean result = true;
char **commands;
unsigned int len, i;
vb_set_mode(VB_MODE_COMMAND, false);
- return TRUE;
+ return true;
}
gboolean command_close(const Arg *arg)
{
gtk_widget_destroy(GTK_WIDGET(vb.gui.window));
- return TRUE;
+ return true;
}
gboolean command_view_source(const Arg *arg)
vb_set_mode(VB_MODE_NORMAL, false);
- return TRUE;
+ return true;
}
gboolean command_navigate(const Arg *arg)
vb_set_mode(VB_MODE_NORMAL, false);
- return TRUE;
+ return true;
}
gboolean command_scroll(const Arg *arg)
vb_set_mode(VB_MODE_NORMAL, false);
- return TRUE;
+ return true;
}
gboolean command_map(const Arg *arg)
gboolean command_complete(const Arg *arg)
{
- completion_complete(arg->i ? TRUE : false);
+ completion_complete(arg->i ? true : false);
vb_set_mode(VB_MODE_COMMAND | VB_MODE_COMPLETE, false);
- return TRUE;
+ return true;
}
gboolean command_inspect(const Arg *arg)
} else {
webkit_web_inspector_show(vb.gui.inspector);
}
- return TRUE;
+ return true;
}
- vb_echo(VB_MSG_ERROR, TRUE, "webinspector is not enabled");
+ vb_echo(VB_MSG_ERROR, true, "webinspector is not enabled");
return false;
}
/* 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));
- return TRUE;
+ return true;
}
gboolean command_hints_focus(const Arg *arg)
{
- hints_focus_next(arg->i ? TRUE : false);
+ hints_focus_next(arg->i ? true : false);
- return TRUE;
+ return true;
}
gboolean command_yank(const Arg *arg)
{
- vb_set_mode(VB_MODE_NORMAL, TRUE);
+ vb_set_mode(VB_MODE_NORMAL, true);
if (arg->i & COMMAND_YANK_SELECTION) {
char *text = NULL;
vb_echo_force(VB_MSG_NORMAL, false, "Yanked: %s", text);
g_free(text);
- return TRUE;
+ return true;
}
return false;
vb_echo_force(VB_MSG_NORMAL, false, "Yanked: %s", a.s);
g_free(a.s);
- return TRUE;
+ return true;
}
return false;
vb_load_uri(&a);
g_free(a.s);
- return TRUE;
+ return true;
}
return false;
}
webkit_web_view_unmark_text_matches(vb.gui.webview);
#endif
- return TRUE;
+ return true;
}
/* copy search query for later use */
if (vb.state.search_query) {
#ifdef FEATURE_SEARCH_HIGHLIGHT
webkit_web_view_mark_text_matches(vb.gui.webview, vb.state.search_query, false, 0);
- webkit_web_view_set_highlight_text_matches(vb.gui.webview, TRUE);
+ webkit_web_view_set_highlight_text_matches(vb.gui.webview, true);
#endif
/* make sure we have a count greater than 0 */
vb.state.count = vb.state.count ? vb.state.count : 1;
do {
- webkit_web_view_search_text(vb.gui.webview, vb.state.search_query, false, forward, TRUE);
+ webkit_web_view_search_text(vb.gui.webview, vb.state.search_query, false, forward, true);
} while (--vb.state.count);
}
vb_set_mode(VB_MODE_SEARCH, false);
- return TRUE;
+ return true;
}
gboolean command_searchengine(const Arg *arg)
webkit_web_view_set_zoom_level(vb.gui.webview, 1.0);
vb_set_mode(VB_MODE_NORMAL, false);
- return TRUE;
+ return true;
}
count = vb.state.count ? vb.state.count : 1;
vb_set_mode(VB_MODE_NORMAL, false);
- return TRUE;
+ return true;
}
vb_echo_force(VB_MSG_NORMAL, false, entry);
g_free(entry);
- return TRUE;
+ return true;
}
gboolean command_bookmark(const Arg *arg)
{
bookmark_add(webkit_web_view_get_uri(vb.gui.webview), arg->s);
vb_set_mode(VB_MODE_NORMAL, false);
- return TRUE;
+ return true;
}
/* updatecompletions */
vb.comps.active = update(vb.comps.completions, vb.comps.active, back);
g_free(text);
- return TRUE;
+ return true;
} else {
g_free(text);
/* if current input isn't the content of the completion item */
/* create new completion */
#ifdef HAS_GTK3
vb.gui.compbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
- gtk_box_set_homogeneous(GTK_BOX(vb.gui.compbox), TRUE);
+ gtk_box_set_homogeneous(GTK_BOX(vb.gui.compbox), true);
#else
- vb.gui.compbox = gtk_vbox_new(TRUE, 0);
+ vb.gui.compbox = gtk_vbox_new(true, 0);
#endif
gtk_box_pack_start(GTK_BOX(vb.gui.box), vb.gui.compbox, false, false, 0);
}
show(back);
- return TRUE;
+ return true;
}
void completion_clean()
for (GList *l = source; l; l = l->next) {
Completion *c = get_new(l->data, prefix);
target = g_list_prepend(target, c);
- gtk_box_pack_start(GTK_BOX(vb.gui.compbox), c->event, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(vb.gui.compbox), c->event, true, true, 0);
}
target = g_list_reverse(target);
#ifdef HAS_GTK3
GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_set_homogeneous(GTK_BOX(hbox), TRUE);
+ gtk_box_set_homogeneous(GTK_BOX(hbox), true);
#else
- GtkWidget *hbox = gtk_hbox_new(TRUE, 0);
+ GtkWidget *hbox = gtk_hbox_new(true, 0);
#endif
- gtk_box_pack_start(GTK_BOX(hbox), c->label, TRUE, TRUE, 5);
+ gtk_box_pack_start(GTK_BOX(hbox), c->label, true, true, 5);
gtk_label_set_ellipsize(GTK_LABEL(c->label), PANGO_ELLIPSIZE_MIDDLE);
gtk_misc_set_alignment(GTK_MISC(c->label), 0.0, 0.5);
tagname = webkit_dom_element_get_tag_name(element);
type = webkit_dom_element_get_attribute(element, "type");
if (!g_ascii_strcasecmp(tagname, "textarea")) {
- result = TRUE;
+ result = true;
} else if (!g_ascii_strcasecmp(tagname, "input")
&& g_ascii_strcasecmp(type, "submit")
&& g_ascii_strcasecmp(type, "reset")
&& g_ascii_strcasecmp(type, "image")
) {
- result = TRUE;
+ result = true;
} else {
result = false;
}
{
if (dom_is_editable(element)) {
vb_set_mode(VB_MODE_INSERT, false);
- return TRUE;
+ return true;
}
return false;
}
MAXIMUM_HINTS
);
- observe_input(TRUE);
+ observe_input(true);
run_script(js);
g_free(js);
vb.gui.webview, "hovering-over-link", NULL, *(value + 5) == '\0' ? NULL : (value + 5)
);
} else if (!strncmp(value, "DONE:", 5)) {
- vb_set_mode(VB_MODE_NORMAL, TRUE);
+ vb_set_mode(VB_MODE_NORMAL, true);
} else if (!strncmp(value, "INSERT:", 7)) {
vb_set_mode(VB_MODE_INSERT, false);
} else if (!strncmp(value, "DATA:", 5)) {
/* skip hinting prefixes like '.', ',', ';y' ... */
hints_create(text + vb.hints.prefixLength, vb.hints.mode, vb.hints.prefixLength);
- return TRUE;
+ return true;
}
static gboolean keypress_cb(WebKitWebView *webview, GdkEventKey *event)
if (keyval == GDK_Return) {
fire();
- return TRUE;
+ return true;
}
if (keyval == GDK_BackSpace && (state & GDK_SHIFT_MASK) && (state & GDK_CONTROL_MASK)) {
vb.hints.num /= 10;
hints_update(vb.hints.num);
- return TRUE;
+ return true;
}
numval = g_unichar_digit_value((gunichar)gdk_keyval_to_unicode(keyval));
if ((numval >= 1 && numval <= 9) || (numval == 0 && vb.hints.num)) {
vb.hints.num = (vb.hints.num ? vb.hints.num * 10 : 0) + numval;
hints_update(vb.hints.num);
- return TRUE;
+ return true;
}
return false;
g_slist_free_full(vb.behave.keys, (GDestroyNotify)free_keybind);
}
if (vb.behave.modkeys) {
- g_string_free(vb.behave.modkeys, TRUE);
+ g_string_free(vb.behave.modkeys, true);
}
}
g_string_append_c(vb.behave.modkeys, keybind->modkey);
}
- return TRUE;
+ return true;
}
gboolean keybind_remove_from_string(char *str, const Mode mode)
/* remove eventually no more used modkeys */
rebuild_modkeys();
}
- return TRUE;
+ return true;
}
/**
GSList *link;
/* remove previous modkeys */
if (vb.behave.modkeys) {
- g_string_free(vb.behave.modkeys, TRUE);
+ g_string_free(vb.behave.modkeys, true);
vb.behave.modkeys = g_string_new("");
}
/* check for escape or modkeys or counts */
if (IS_ESCAPE_KEY(keyval, state)) {
/* switch to normal mode and clear the input box */
- vb_set_mode(VB_MODE_NORMAL, TRUE);
+ vb_set_mode(VB_MODE_NORMAL, true);
- return TRUE;
+ return true;
}
/* allow mode keys and counts only in normal mode */
if ((VB_MODE_SEARCH | VB_MODE_NORMAL) & vb.state.mode) {
vb.state.count = (vb.state.count ? vb.state.count * 10 : 0) + (keyval - GDK_0);
vb_update_statusbar();
- return TRUE;
+ return true;
}
if (strchr(vb.behave.modkeys->str, keyval) && vb.state.modkey != keyval) {
vb.state.modkey = (char)keyval;
vb_update_statusbar();
- return TRUE;
+ return true;
}
}
Keybind *keybind = (Keybind*)link->data;
command_run(keybind->command, keybind->param);
- return TRUE;
+ return true;
}
return false;
vsnprintf(message, 255, error, arg_list);
va_end(arg_list);
- inputbox_print(TRUE, type, hide, message);
+ inputbox_print(true, type, hide, message);
}
void vb_echo(const MessageType type, gboolean hide, const char *error, ...)
if (result) {
*value = jsref_to_string(js, result);
- return TRUE;
+ return true;
}
*value = jsref_to_string(js, exception);
}
g_free(uri);
- return TRUE;
+ return true;
}
gboolean vb_set_clipboard(const Arg *arg)
if (arg->i & VB_CLIPBOARD_PRIMARY) {
gtk_clipboard_set_text(PRIMARY_CLIPBOARD(), arg->s, -1);
- result = TRUE;
+ result = true;
}
if (arg->i & VB_CLIPBOARD_SECONDARY) {
gtk_clipboard_set_text(SECONDARY_CLIPBOARD(), arg->s, -1);
- result = TRUE;
+ result = true;
}
return result;
hints_clear();
} else if (current_mode == VB_MODE_INSERT) {
/* clean the input if current mode is insert to remove -- INPUT -- */
- clean = TRUE;
+ clean = true;
dom_clear_focus();
} else if (current_mode == VB_MODE_SEARCH) {
/* cleaup previous search */
vb_update_statusbar();
- return TRUE;
+ return true;
}
void vb_set_widget_font(GtkWidget *widget, const VbColor *fg, const VbColor *bg, PangoFontDescription *font)
}
gtk_label_set_text(GTK_LABEL(vb.gui.statusbar.right), status->str);
- g_string_free(status, TRUE);
+ g_string_free(status, true);
}
void vb_update_status_style(void)
gtk_window_get_size(GTK_WINDOW(vb.gui.window), NULL, &height);
gtk_paned_set_position(GTK_PANED(vb.gui.pane), 2 * height / 3);
- gtk_paned_pack2(GTK_PANED(vb.gui.pane), GTK_WIDGET(webview), TRUE, TRUE);
+ gtk_paned_pack2(GTK_PANED(vb.gui.pane), GTK_WIDGET(webview), true, true);
gtk_widget_show(GTK_WIDGET(webview));
- vb.state.is_inspecting = TRUE;
+ vb.state.is_inspecting = true;
- return TRUE;
+ return true;
}
static gboolean inspector_close(WebKitWebInspector *inspector)
vb.state.is_inspecting = false;
- return TRUE;
+ return true;
}
static void inspector_finished(WebKitWebInspector *inspector)
/* Prepare the event box */
gui->eventbox = gtk_event_box_new();
- gtk_paned_pack1(GTK_PANED(gui->pane), GTK_WIDGET(gui->box), TRUE, TRUE);
+ gtk_paned_pack1(GTK_PANED(gui->pane), GTK_WIDGET(gui->box), true, true);
gtk_widget_show_all(gui->window);
setup_signals();
gtk_container_add(GTK_CONTAINER(gui->window), GTK_WIDGET(gui->pane));
gtk_misc_set_alignment(GTK_MISC(gui->statusbar.left), 0.0, 0.0);
gtk_misc_set_alignment(GTK_MISC(gui->statusbar.right), 1.0, 0.0);
- gtk_box_pack_start(gui->statusbar.box, gui->statusbar.left, TRUE, TRUE, 2);
+ gtk_box_pack_start(gui->statusbar.box, gui->statusbar.left, true, true, 2);
gtk_box_pack_start(gui->statusbar.box, gui->statusbar.right, false, false, 2);
- gtk_box_pack_start(gui->box, gui->scroll, TRUE, TRUE, 0);
+ gtk_box_pack_start(gui->box, gui->scroll, true, true, 0);
gtk_box_pack_start(gui->box, gui->eventbox, false, false, 0);
gtk_entry_set_has_frame(GTK_ENTRY(gui->inputbox), false);
gtk_box_pack_end(gui->box, gui->inputbox, false, false, 0);
if (mode == VB_MODE_NORMAL && context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE) {
vb_set_mode(VB_MODE_INSERT, false);
- propagate = TRUE;
+ propagate = true;
}
/* middle mouse click onto link */
if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK && event->button == 2) {
g_object_get(result, "link-uri", &a.s, NULL);
vb_load_uri(&a);
- propagate = TRUE;
+ propagate = true;
}
g_object_unref(result);
/* open in a new window */
Arg a = {VB_TARGET_NEW, (char*)webkit_network_request_get_uri(request)};
vb_load_uri(&a);
- return TRUE;
+ return true;
}
return false;
}
if (webkit_web_view_can_show_mime_type(webview, mime_type) == false) {
webkit_web_policy_decision_download(decision);
- return TRUE;
+ return true;
}
return false;
}
vb_update_statusbar();
- return TRUE;
+ return true;
}
/**
vb.behave.searchengines = g_slist_prepend(vb.behave.searchengines, s);
- return TRUE;
+ return true;
}
gboolean searchengine_remove(const char *handle)
free_searchengine((Searchengine*)list->data);
vb.behave.searchengines = g_slist_delete_link(vb.behave.searchengines, list);
- return TRUE;
+ return true;
}
return false;
* before defining the search engines */
OVERWRITE_STRING(vb.behave.searchengine_default, handle);
- return TRUE;
+ return true;
}
/**
Setting *s = g_hash_table_lookup(vb.settings, name);
if (!s) {
- vb_echo(VB_MSG_ERROR, TRUE, "Config '%s' not found", name);
+ vb_echo(VB_MSG_ERROR, true, "Config '%s' not found", name);
return false;
}
* it to the arg of the setting */
a = char_to_arg(param, s->type);
if (a == NULL) {
- vb_echo(VB_MSG_ERROR, TRUE, "No valid value");
+ vb_echo(VB_MSG_ERROR, true, "No valid value");
return false;
}
g_free(a);
if (!result) {
- vb_echo(VB_MSG_ERROR, TRUE, "Could not set %s", s->alias ? s->alias : s->name);
+ vb_echo(VB_MSG_ERROR, true, "Could not set %s", s->alias ? s->alias : s->name);
}
return result;
if (type == SETTING_GET) {
result = s->func(s, type);
if (!result) {
- vb_echo(VB_MSG_ERROR, TRUE, "Could not get %s", s->alias ? s->alias : s->name);
+ vb_echo(VB_MSG_ERROR, true, "Could not get %s", s->alias ? s->alias : s->name);
}
return result;
/* toggle bolean vars */
if (s->type != TYPE_BOOLEAN) {
- vb_echo(VB_MSG_ERROR, TRUE, "Could not toggle none boolean %s", s->alias ? s->alias : s->name);
+ vb_echo(VB_MSG_ERROR, true, "Could not toggle none boolean %s", s->alias ? s->alias : s->name);
return false;
}
result = s->func(s, type);
if (!result) {
- vb_echo(VB_MSG_ERROR, TRUE, "Could not toggle %s", s->alias ? s->alias : s->name);
+ vb_echo(VB_MSG_ERROR, true, "Could not toggle %s", s->alias ? s->alias : s->name);
}
return result;
/* print the new value */
print_value(s, &value);
} else {
- g_object_set(G_OBJECT(web_setting), s->name, s->arg.i ? TRUE : false, NULL);
+ g_object_set(G_OBJECT(web_setting), s->name, s->arg.i ? true : false, NULL);
}
break;
break;
}
- return TRUE;
+ return true;
}
static gboolean cookie_timeout(const Setting *s, const SettingType type)
{
vb.config.cookie_timeout = s->arg.i;
}
- return TRUE;
+ return true;
}
static gboolean scrollstep(const Setting *s, const SettingType type)
vb.config.scrollstep = s->arg.i;
}
- return TRUE;
+ return true;
}
static gboolean status_color_bg(const Setting *s, const SettingType type)
vb_update_status_style();
}
- return TRUE;
+ return true;
}
static gboolean status_color_fg(const Setting *s, const SettingType type)
vb_update_status_style();
}
- return TRUE;
+ return true;
}
static gboolean status_font(const Setting *s, const SettingType type)
vb_update_status_style();
}
- return TRUE;
+ return true;
}
static gboolean input_style(const Setting *s, const SettingType type)
vb_update_input_style();
}
- return TRUE;
+ return true;
}
static gboolean completion_style(const Setting *s, const SettingType type)
}
}
- return TRUE;
+ return true;
}
static gboolean hint_style(const Setting *s, const SettingType type)
}
}
- return TRUE;
+ return true;
}
static gboolean strict_ssl(const Setting *s, const SettingType type)
if (type == SETTING_GET) {
print_value(s, &value);
- return TRUE;
+ return true;
}
}
- value = type == SETTING_TOGGLE ? !value : (s->arg.i ? TRUE : false);
+ value = type == SETTING_TOGGLE ? !value : (s->arg.i ? true : false);
g_object_set(vb.soup_session, "ssl-strict", value, NULL);
- return TRUE;
+ return true;
}
static gboolean ca_bundle(const Setting *s, const SettingType type)
g_object_set(vb.soup_session, "ssl-ca-file", s->arg.s, NULL);
}
- return TRUE;
+ return true;
}
static gboolean home_page(const Setting *s, const SettingType type)
OVERWRITE_STRING(vb.config.home_page, s->arg.s);
}
- return TRUE;
+ return true;
}
static gboolean download_path(const Setting *s, const SettingType type)
util_create_dir_if_not_exists(vb.config.download_dir);
}
- return TRUE;
+ return true;
}
static gboolean proxy(const Setting *s, const SettingType type)
if (type == SETTING_GET) {
print_value(s, &enabled);
- return TRUE;
+ return true;
}
}
g_object_set(vb.soup_session, "proxy-uri", NULL, NULL);
}
- return TRUE;
+ return true;
}
static gboolean user_style(const Setting *s, const SettingType type)
if (type == SETTING_GET) {
print_value(s, &enabled);
- return TRUE;
+ return true;
}
}
g_object_set(web_setting, "user-stylesheet-uri", NULL, NULL);
}
- return TRUE;
+ return true;
}
static gboolean history_max_items(const Setting *s, const SettingType type)
if (type == SETTING_GET) {
print_value(s, &vb.config.history_max);
- return TRUE;
+ return true;
}
vb.config.history_max = s->arg.i;
- return TRUE;
+ return true;
}