If they are lower case, vim can highlight them correct.
command = g_hash_table_lookup(vb.behave.commands, name);
if (!command) {
vb_echo(VB_MSG_ERROR, TRUE, "Command '%s' not found", name);
- vb_set_mode(VB_MODE_NORMAL, FALSE);
+ vb_set_mode(VB_MODE_NORMAL, false);
- return FALSE;
+ return false;
}
a.i = command->arg.i;
a.s = g_strdup(param ? param : command->arg.s);
char *command = NULL, *str, **token;
if (!input || *input == '\0') {
- return FALSE;
+ return false;
}
str =g_strdup(input);
if (!token[0]) {
g_strfreev(token);
- return FALSE;
+ return false;
}
success = command_run(token[0], token[1] ? token[1] : NULL);
g_strfreev(token);
unsigned int len, i;
if (!arg->s || *(arg->s) == '\0') {
- return FALSE;
+ return false;
}
input = g_strdup(arg->s);
len = g_strv_length(commands);
if (!len) {
g_strfreev(commands);
- return FALSE;
+ return false;
}
for (i = 0; i < len; i++) {
) {
/* append the current url to the input message */
char *input = g_strconcat(arg->s, url, NULL);
- vb_echo_force(VB_MSG_NORMAL, FALSE, input);
+ vb_echo_force(VB_MSG_NORMAL, false, input);
g_free(input);
} else {
- vb_echo_force(VB_MSG_NORMAL, FALSE, arg->s);
+ vb_echo_force(VB_MSG_NORMAL, false, arg->s);
}
- vb_set_mode(VB_MODE_COMMAND, FALSE);
+ vb_set_mode(VB_MODE_COMMAND, false);
return TRUE;
}
webkit_web_view_set_view_source_mode(vb.gui.webview, !mode);
webkit_web_view_reload(vb.gui.webview);
- vb_set_mode(VB_MODE_NORMAL, FALSE);
+ vb_set_mode(VB_MODE_NORMAL, false);
return TRUE;
}
webkit_web_view_stop_loading(view);
}
- vb_set_mode(VB_MODE_NORMAL, FALSE);
+ vb_set_mode(VB_MODE_NORMAL, false);
return TRUE;
}
gtk_adjustment_set_value(adjust, gtk_adjustment_get_lower(adjust));
}
- vb_set_mode(VB_MODE_NORMAL, FALSE);
+ vb_set_mode(VB_MODE_NORMAL, false);
return TRUE;
}
{
char *key;
- vb_set_mode(VB_MODE_NORMAL, FALSE);
+ vb_set_mode(VB_MODE_NORMAL, false);
if ((key = strchr(arg->s, '='))) {
*key = '\0';
return keybind_add_from_string(arg->s, key + 1, arg->i);
}
}
- return FALSE;
+ return false;
}
gboolean command_unmap(const Arg *arg)
{
- vb_set_mode(VB_MODE_NORMAL, FALSE);
+ vb_set_mode(VB_MODE_NORMAL, false);
return keybind_remove_from_string(arg->s, arg->i);
}
char *param = NULL, *line = NULL;
if (!arg->s || !strlen(arg->s)) {
- return FALSE;
+ return false;
}
line = g_strdup(arg->s);
}
g_free(line);
- vb_set_mode(VB_MODE_NORMAL, FALSE);
+ vb_set_mode(VB_MODE_NORMAL, false);
return success;
}
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);
+ vb_set_mode(VB_MODE_COMMAND | VB_MODE_COMPLETE, false);
return TRUE;
}
gboolean enabled;
WebKitWebSettings *settings = NULL;
- vb_set_mode(VB_MODE_NORMAL, FALSE);
+ vb_set_mode(VB_MODE_NORMAL, false);
settings = webkit_web_view_get_settings(vb.gui.webview);
g_object_get(G_OBJECT(settings), "enable-developer-extras", &enabled, NULL);
vb_echo(VB_MSG_ERROR, TRUE, "webinspector is not enabled");
- return FALSE;
+ return false;
}
gboolean command_hints(const Arg *arg)
{
- vb_echo_force(VB_MSG_NORMAL, FALSE, 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));
gboolean command_hints_focus(const Arg *arg)
{
- hints_focus_next(arg->i ? TRUE : FALSE);
+ hints_focus_next(arg->i ? TRUE : false);
return TRUE;
}
text = gtk_clipboard_wait_for_text(SECONDARY_CLIPBOARD());
}
if (text) {
- vb_echo_force(VB_MSG_NORMAL, FALSE, "Yanked: %s", text);
+ vb_echo_force(VB_MSG_NORMAL, false, "Yanked: %s", text);
g_free(text);
return TRUE;
}
- return FALSE;
+ return false;
}
/* use current arg.s a new clipboard content */
Arg a = {arg->i};
}
if (a.s) {
vb_set_clipboard(&a);
- vb_echo_force(VB_MSG_NORMAL, FALSE, "Yanked: %s", a.s);
+ vb_echo_force(VB_MSG_NORMAL, false, "Yanked: %s", a.s);
g_free(a.s);
return TRUE;
}
- return FALSE;
+ return false;
}
gboolean command_paste(const Arg *arg)
return TRUE;
}
- return FALSE;
+ return false;
}
gboolean command_search(const Arg *arg)
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_mark_text_matches(vb.gui.webview, vb.state.search_query, false, 0);
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);
+ vb_set_mode(VB_MODE_SEARCH, false);
return TRUE;
}
handle++;
result = searchengine_add(arg->s, handle);
} else {
- return FALSE;
+ return false;
}
} else {
/* remove the search engine */
result = searchengine_remove(arg->s);
}
- vb_set_mode(VB_MODE_NORMAL, FALSE);
+ vb_set_mode(VB_MODE_NORMAL, false);
return result;
}
gboolean command_searchengine_default(const Arg *arg)
{
- vb_set_mode(VB_MODE_NORMAL, FALSE);
+ vb_set_mode(VB_MODE_NORMAL, false);
return searchengine_set_default(arg->s);
}
if (arg->i & COMMAND_ZOOM_RESET) {
webkit_web_view_set_zoom_level(vb.gui.webview, 1.0);
- vb_set_mode(VB_MODE_NORMAL, FALSE);
+ vb_set_mode(VB_MODE_NORMAL, false);
return TRUE;
}
level + (float)(count *step) * (arg->i & COMMAND_ZOOM_IN ? 1.0 : -1.0)
);
- vb_set_mode(VB_MODE_NORMAL, FALSE);
+ vb_set_mode(VB_MODE_NORMAL, false);
return TRUE;
char *entry = history_get(input, arg->i);
if (!entry) {
- return FALSE;
+ return false;
}
- vb_echo_force(VB_MSG_NORMAL, FALSE, entry);
+ vb_echo_force(VB_MSG_NORMAL, false, entry);
g_free(entry);
return TRUE;
#else
vb.gui.compbox = gtk_vbox_new(TRUE, 0);
#endif
- gtk_box_pack_start(GTK_BOX(vb.gui.box), vb.gui.compbox, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vb.gui.box), vb.gui.compbox, false, false, 0);
/* TODO move these decision to a more generic place */
if (!strncmp(input, ":set ", 5)) {
}
if (!vb.comps.completions) {
- return FALSE;
+ return false;
}
completion_show(back);
for (GList *l = source; l; l = l->next) {
data = l->data;
- match = FALSE;
+ match = false;
if (*command == 0) {
match = TRUE;
} else {
if (func(data, token[i])) {
match = TRUE;
} else {
- match = FALSE;
+ match = false;
break;
}
}
*/
gboolean dom_is_editable(Element *element)
{
- gboolean result = FALSE;
+ gboolean result = false;
char *tagname, *type;
if (!element) {
) {
result = TRUE;
} else {
- result = FALSE;
+ result = false;
}
g_free(tagname);
g_free(type);
static gboolean dom_auto_insert(Element *element)
{
if (dom_is_editable(element)) {
- vb_set_mode(VB_MODE_INSERT, FALSE);
+ vb_set_mode(VB_MODE_INSERT, false);
return TRUE;
}
- return FALSE;
+ return false;
}
static gboolean dom_editable_focus_cb(Element *element, Event *event)
EventTarget *target = webkit_dom_event_get_target(event);
dom_auto_insert((void*)target);
}
- return FALSE;
+ return false;
}
static Element *dom_get_active_element(Document *doc)
{
char *js, *value = NULL;
- hints_observe_input(FALSE);
+ hints_observe_input(false);
if (CLEAN_MODE(vb.state.mode) == VB_MODE_HINTING) {
js = g_strdup_printf("%s.clear();", HINT_VAR);
vb_eval_script(webkit_web_view_get_main_frame(vb.gui.webview), js, HINT_FILE, &value);
{
char *js = NULL;
if (CLEAN_MODE(vb.state.mode) != VB_MODE_HINTING) {
- vb_set_mode(VB_MODE_HINTING, FALSE);
+ vb_set_mode(VB_MODE_HINTING, false);
Style *style = &vb.style;
vb.hints.prefixLength = prefixLength;
fprintf(stderr, "%s\n", value);
g_free(value);
- vb_set_mode(VB_MODE_NORMAL, FALSE);
+ vb_set_mode(VB_MODE_NORMAL, false);
return;
}
} else if (!strncmp(value, "DONE:", 5)) {
vb_set_mode(VB_MODE_NORMAL, TRUE);
} else if (!strncmp(value, "INSERT:", 7)) {
- vb_set_mode(VB_MODE_INSERT, FALSE);
+ vb_set_mode(VB_MODE_INSERT, false);
} else if (!strncmp(value, "DATA:", 5)) {
Arg a = {0};
char *v = (value + 5);
return TRUE;
}
- return FALSE;
+ return false;
}
{
char **token = NULL;
if (keys == NULL || *keys == '\0') {
- return FALSE;
+ return false;
}
/* split the input string into command and parameter part */
token = g_strsplit(command, " ", 2);
if (!token[0] || !command_exists(token[0])) {
g_strfreev(token);
- return FALSE;
+ return false;
}
Keybind *keybind = g_new0(Keybind, 1);
Keybind keybind = {.mode = mode};
if (str == NULL || *str == '\0') {
- return FALSE;
+ return false;
}
g_strstrip(str);
return TRUE;
}
- return FALSE;
+ return false;
}
static void keybind_free(Keybind *keybind)
vsnprintf(message, 255, error, arg_list);
va_end(arg_list);
- vb_inputbox_print(FALSE, type, hide, message);
+ vb_inputbox_print(false, type, hide, message);
}
gboolean vb_eval_script(WebKitWebFrame *frame, char *script, char *file, char **value)
}
*value = vb_jsref_to_string(js, exception);
- return FALSE;
+ return false;
}
gboolean vb_load_uri(const Arg *arg)
}
/* change state to normal mode */
- vb_set_mode(VB_MODE_NORMAL, FALSE);
+ vb_set_mode(VB_MODE_NORMAL, false);
if (arg->i == VB_TARGET_NEW) {
guint i = 0;
gboolean vb_set_clipboard(const Arg *arg)
{
- gboolean result = FALSE;
+ gboolean result = false;
if (!arg->s) {
return result;
}
case VB_MODE_INSERT:
gtk_widget_grab_focus(GTK_WIDGET(vb.gui.webview));
- vb_echo(VB_MSG_NORMAL, FALSE, "-- INPUT --");
+ vb_echo(VB_MSG_NORMAL, false, "-- INPUT --");
break;
case VB_MODE_PATH_THROUGH:
/* echo message if given */
if (clean) {
- vb_echo(VB_MSG_NORMAL, FALSE, "");
+ vb_echo(VB_MSG_NORMAL, false, "");
}
vb_update_statusbar();
static gboolean vb_hide_message()
{
- vb_inputbox_print(FALSE, VB_MSG_NORMAL, FALSE, "");
+ vb_inputbox_print(false, VB_MSG_NORMAL, false, "");
- return FALSE;
+ return false;
}
static void vb_webview_progress_cb(WebKitWebView *view, GParamSpec *pspec)
}
/* status bar is updated by vb_set_mode */
- vb_set_mode(VB_MODE_NORMAL , FALSE);
+ vb_set_mode(VB_MODE_NORMAL , false);
vb_update_urlbar(uri);
break;
static gboolean vb_inputbox_keyrelease_cb(GtkEntry *entry, GdkEventKey *event)
{
- return FALSE;
+ return false;
}
static void vb_scroll_cb(GtkAdjustment *adjustment)
int height;
if (vb.state.is_inspecting) {
- return FALSE;
+ return false;
}
webview = webkit_web_inspector_get_web_view(inspector);
WebKitWebView *webview;
if (!vb.state.is_inspecting) {
- return FALSE;
+ return false;
}
webview = webkit_web_inspector_get_web_view(inspector);
gtk_widget_hide(GTK_WIDGET(webview));
gtk_widget_destroy(GTK_WIDGET(webview));
- vb.state.is_inspecting = FALSE;
+ vb.state.is_inspecting = false;
return TRUE;
}
{
SoupDate *date;
- SoupCookieJar *jar = soup_cookie_jar_text_new(vb.files[FILES_COOKIE], FALSE);
+ SoupCookieJar *jar = soup_cookie_jar_text_new(vb.files[FILES_COOKIE], false);
cookie = soup_cookie_copy(cookie);
if (cookie->expires == NULL && vb.config.cookie_timeout) {
date = soup_date_new_from_time_t(time(NULL) + vb.config.cookie_timeout);
/* Prepare the inputbox */
gui->inputbox = gtk_entry_new();
gtk_entry_set_inner_border(GTK_ENTRY(gui->inputbox), NULL);
- g_object_set(gtk_widget_get_settings(gui->inputbox), "gtk-entry-select-on-focus", FALSE, NULL);
+ g_object_set(gtk_widget_get_settings(gui->inputbox), "gtk-entry-select-on-focus", false, NULL);
#ifdef HAS_GTK3
gui->pane = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
gui->statusbar.box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
#else
gui->pane = gtk_vpaned_new();
- gui->box = GTK_BOX(gtk_vbox_new(FALSE, 0));
- gui->statusbar.box = GTK_BOX(gtk_hbox_new(FALSE, 0));
+ gui->box = GTK_BOX(gtk_vbox_new(false, 0));
+ gui->statusbar.box = GTK_BOX(gtk_hbox_new(false, 0));
#endif
gui->statusbar.left = gtk_label_new(NULL);
gui->statusbar.right = gtk_label_new(NULL);
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.right, FALSE, FALSE, 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->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);
+ 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);
/* Make sure that when the browser area becomes visible, it will get mouse
* and keyboard events */
static gboolean vb_button_relase_cb(WebKitWebView *webview, GdkEventButton *event)
{
- gboolean propagate = FALSE;
+ gboolean propagate = false;
WebKitHitTestResultContext context;
Mode mode = CLEAN_MODE(vb.state.mode);
g_object_get(result, "context", &context, NULL);
if (mode == VB_MODE_NORMAL && context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE) {
- vb_set_mode(VB_MODE_INSERT, FALSE);
+ vb_set_mode(VB_MODE_INSERT, false);
propagate = TRUE;
}
vb_load_uri(&a);
return TRUE;
}
- return FALSE;
+ return false;
}
static void vb_hover_link_cb(WebKitWebView *webview, const char *title, const char *link)
WebKitWebFrame *frame, WebKitNetworkRequest *request, char *mime_type,
WebKitWebPolicyDecision *decision)
{
- if (webkit_web_view_can_show_mime_type(webview, mime_type) == FALSE) {
+ if (webkit_web_view_can_show_mime_type(webview, mime_type) == false) {
webkit_web_policy_decision_download(decision);
return TRUE;
}
- return FALSE;
+ return false;
}
static gboolean vb_download_requested_cb(WebKitWebView *view, WebKitDownload *download)
guint64 size = webkit_download_get_total_size(download);
if (size > 0) {
- vb_echo(VB_MSG_NORMAL, FALSE, "Download %s [~%uB] started ...", filename, size);
+ vb_echo(VB_MSG_NORMAL, false, "Download %s [~%uB] started ...", filename, size);
} else {
- vb_echo(VB_MSG_NORMAL, FALSE, "Download %s started ...", filename);
+ vb_echo(VB_MSG_NORMAL, false, "Download %s started ...", filename);
}
status = webkit_download_get_status(download);
char *file = g_path_get_basename(webkit_download_get_destination_uri(download));
if (status != WEBKIT_DOWNLOAD_STATUS_FINISHED) {
- vb_echo(VB_MSG_ERROR, FALSE, "Error downloading %s", file);
+ vb_echo(VB_MSG_ERROR, false, "Error downloading %s", file);
} else {
- vb_echo(VB_MSG_NORMAL, FALSE, "Download %s finished", file);
+ vb_echo(VB_MSG_NORMAL, false, "Download %s finished", file);
}
g_free(file);
{
/* validate if the uri contains only one %s sequence */
if (!searchengine_is_valid_uri(uri)) {
- return FALSE;
+ return false;
}
Searchengine *s = g_new0(Searchengine, 1);
return TRUE;
}
- return FALSE;
+ return false;
}
gboolean searchengine_set_default(const char *handle)
gboolean setting_run(char *name, const char *param)
{
Arg *a = NULL;
- gboolean result = FALSE, get = FALSE;
+ gboolean result = false, get = false;
SettingType type = SETTING_SET;
/* determine the type to names last char and param */
Setting *s = g_hash_table_lookup(vb.settings, name);
if (!s) {
vb_echo(VB_MSG_ERROR, TRUE, "Config '%s' not found", name);
- return FALSE;
+ return false;
}
if (type == SETTING_SET) {
a = setting_char_to_arg(param, s->type);
if (a == NULL) {
vb_echo(VB_MSG_ERROR, TRUE, "No valid value");
- return FALSE;
+ return false;
}
s->arg = *a;
if (s->type != TYPE_BOOLEAN) {
vb_echo(VB_MSG_ERROR, TRUE, "Could not toggle none boolean %s", s->alias ? s->alias : s->name);
- return FALSE;
+ return false;
}
result = s->func(s, type);
switch (s->type) {
case TYPE_BOOLEAN:
- vb_echo(VB_MSG_NORMAL, FALSE, " %s=%s", name, *(gboolean*)value ? "true" : "false");
+ vb_echo(VB_MSG_NORMAL, false, " %s=%s", name, *(gboolean*)value ? "true" : "false");
break;
case TYPE_INTEGER:
- vb_echo(VB_MSG_NORMAL, FALSE, " %s=%d", name, *(int*)value);
+ vb_echo(VB_MSG_NORMAL, false, " %s=%d", name, *(int*)value);
break;
case TYPE_FLOAT:
- vb_echo(VB_MSG_NORMAL, FALSE, " %s=%g", name, *(gfloat*)value);
+ vb_echo(VB_MSG_NORMAL, false, " %s=%g", name, *(gfloat*)value);
break;
case TYPE_CHAR:
- vb_echo(VB_MSG_NORMAL, FALSE, " %s=%s", name, (char*)value);
+ vb_echo(VB_MSG_NORMAL, false, " %s=%s", name, (char*)value);
break;
case TYPE_COLOR:
string = VB_COLOR_TO_STRING((VbColor*)value);
- vb_echo(VB_MSG_NORMAL, FALSE, " %s=%s", name, string);
+ vb_echo(VB_MSG_NORMAL, false, " %s=%s", name, string);
g_free(string);
break;
case TYPE_FONT:
string = pango_font_description_to_string((PangoFontDescription*)value);
- vb_echo(VB_MSG_NORMAL, FALSE, " %s=%s", name, string);
+ vb_echo(VB_MSG_NORMAL, false, " %s=%s", name, string);
g_free(string);
break;
}
/* print the new value */
setting_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;
}
}
- 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);
static gboolean setting_user_style(const Setting *s, const SettingType type)
{
- gboolean enabled = FALSE;
+ gboolean enabled = false;
char *uri = NULL;
WebKitWebSettings *web_setting = webkit_web_view_get_settings(vb.gui.webview);
if (type != SETTING_SET) {