char **lines, *line, *p;
int len, i;
GString *new;
- gboolean removed = false;
+ gboolean removed = FALSE;
if (!uri) {
- return false;
+ return FALSE;
}
lines = util_get_lines(vb.files[FILES_BOOKMARK]);
if ((p = strchr(line, '\t'))) {
*p = '\0';
if (!strcmp(uri, line)) {
- removed = true;
+ removed = TRUE;
continue;
} else {
/* reappend the tags */
}
}
if (!strcmp(uri, line)) {
- removed = true;
+ removed = TRUE;
continue;
}
g_string_append_printf(new, "%s\n", line);
}
g_strfreev(lines);
g_file_set_contents(vb.files[FILES_BOOKMARK], new->str, -1, NULL);
- g_string_free(new, true);
+ g_string_free(new, TRUE);
}
return removed;
gboolean bookmark_fill_completion(GtkListStore *store, const char *input)
{
- gboolean found = false;
+ gboolean found = FALSE;
char **parts;
unsigned int len;
GtkTreeIter iter;
#endif
-1
);
- found = true;
+ found = TRUE;
}
} else {
parts = g_strsplit(input, " ", 0);
#endif
-1
);
- found = true;
+ found = TRUE;
}
}
g_strfreev(parts);
FILE *f;
if ((f = fopen(vb.files[FILES_QUEUE], "w"))) {
fclose(f);
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
#endif /* FEATURE_QUEUE */
* @query: char array with tags to search for
* @qlen: length of given query char array
*
- * Return: true if the bookmark contained all tags
+ * Return: TRUE if the bookmark contained all tags
*/
static gboolean bookmark_contains_all_tags(Bookmark *bm, char **query,
unsigned int qlen)
gboolean found;
if (!qlen) {
- return true;
+ return TRUE;
}
if (bm->tags) {
/* iterate over all query parts */
for (i = 0; i < qlen; i++) {
- found = false;
+ found = FALSE;
/* we want to do a prefix match on all bookmark tags - so we check for
* a match on string begin - if this fails we move the cursor to the
while (cursor && *cursor) {
/* match was not found at current cursor position */
if (g_str_has_prefix(cursor, query[i])) {
- found = true;
+ found = TRUE;
break;
}
/* If match was not found at the cursor position - move cursor
}
if (!found) {
- return false;
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
static Bookmark *line_to_bookmark(const char *uri, const char *data)
return RESULT_COMPLETE;
} else if (key == CTRL('H')) { /* backspace */
- fire_timeout(c, false);
+ fire_timeout(c, FALSE);
if (call_hints_function(c, "update", "null", TRUE)) {
return RESULT_COMPLETE;
}
} else if (key == KEY_TAB) {
- fire_timeout(c, false);
- hints_focus_next(c, false);
+ fire_timeout(c, FALSE);
+ hints_focus_next(c, FALSE);
return RESULT_COMPLETE;
} else if (key == KEY_SHIFT_TAB) {
- fire_timeout(c, false);
- hints_focus_next(c, true);
+ fire_timeout(c, FALSE);
+ hints_focus_next(c, TRUE);
return RESULT_COMPLETE;
} else {
- fire_timeout(c, true);
+ fire_timeout(c, TRUE);
/* try to handle the key by the javascript */
if (call_hints_function(c, "update", (char[]){'"', key, '"', '\0'}, TRUE)) {
return RESULT_COMPLETE;
}
}
- fire_timeout(c, false);
+ fire_timeout(c, FALSE);
return RESULT_ERROR;
}
/* Run this sync else we would disable JavaScript before the hint is
* fired. */
- call_hints_function(c, "clear", "true", TRUE);
+ call_hints_function(c, "clear", "TRUE", TRUE);
/* if open window was not allowed for JavaScript, restore this */
WebKitSettings *setting = webkit_web_view_get_settings(c->webview);
/* if window open is already allowed there's no need to allow it again */
if (!hints.allow_open_win) {
- g_object_set(G_OBJECT(setting), "javascript-can-open-windows-automatically", true, NULL);
+ g_object_set(G_OBJECT(setting), "javascript-can-open-windows-automatically", TRUE, NULL);
}
/* TODO This might be a security issue to toggle JavaScript
* temporarily on. */
/* This is a hack to allow window.setTimeout() and scroll observers in
* hinting script which does not work when JavaScript is disabled. */
if (!hints.allow_javascript) {
- g_object_set(G_OBJECT(setting), "enable-javascript", true, NULL);
+ g_object_set(G_OBJECT(setting), "enable-javascript", TRUE, NULL);
}
hints.promptlen = hints.gmode ? 3 : 2;
jsargs = g_strdup_printf("'%s', %s, %d, '%s', %s, %s",
(char[]){hints.mode, '\0'},
- hints.gmode ? "true" : "false",
+ hints.gmode ? "TRUE" : "false",
MAXIMUM_HINTS,
GET_CHAR(c, "hint-keys"),
- GET_BOOL(c, "hint-follow-last") ? "true" : "false",
- GET_BOOL(c, "hint-number-same-length") ? "true" : "false"
+ GET_BOOL(c, "hint-follow-last") ? "TRUE" : "false",
+ GET_BOOL(c, "hint-number-same-length") ? "TRUE" : "false"
);
call_hints_function(c, "init", jsargs, FALSE);
void hints_focus_next(Client *c, const gboolean back)
{
- call_hints_function(c, "focus", back ? "true" : "false", FALSE);
+ call_hints_function(c, "focus", back ? "TRUE" : "false", FALSE);
}
void hints_fire(Client *c)
#endif
if (!prompt) {
- return false;
+ return FALSE;
}
/* get the mode identifying char from prompt */
/* no mode found in prompt */
if (!pmode) {
- return false;
+ return FALSE;
}
res = *prompt == 'g'
/* following return values mark fired hints */
if (!strncmp(value, "DONE:", 5)) {
- fire_timeout(c, false);
+ fire_timeout(c, FALSE);
/* Change to normal mode only if we are currently in command mode and
* we are not in g-mode hinting. This is required to not switch to
* normal mode when the hinting triggered a click that set focus on
c->mode->flags |= FLAG_NEW_WIN;
}
} else if (!strncmp(value, "INSERT:", 7)) {
- fire_timeout(c, false);
+ fire_timeout(c, FALSE);
vb_enter(c, 'i');
if (hints.mode == 'e') {
input_open_editor(c);
}
} else if (!strncmp(value, "DATA:", 5)) {
- fire_timeout(c, false);
+ fire_timeout(c, FALSE);
/* switch first to normal mode - else we would clear the inputbox
* on switching mode also if we want to show yanked data */
if (!hints.gmode) {
case 'O':
case 'T':
- vb_echo(c, MSG_NORMAL, false, "%s %s", (hints.mode == 'T') ? ":tabopen" : ":open", v);
+ vb_echo(c, MSG_NORMAL, FALSE, "%s %s", (hints.mode == 'T') ? ":tabopen" : ":open", v);
if (!hints.gmode) {
vb_enter(c, 'c');
}
break;
case 'x':
- map_handle_string(c, GET_CHAR(c, "x-hint-command"), true);
+ map_handle_string(c, GET_CHAR(c, "x-hint-command"), TRUE);
break;
case 'y':
/* remove timeout id for the timeout that is removed by return value of
* false automatic */
hints.timeout_id = 0;
- return false;
+ return FALSE;
}
if (fp == -1) {
g_critical("Could not create temp file %s", *file);
g_free(*file);
- return false;
+ return FALSE;
}
len = strlen(content);
g_critical("Could not write temp file %s", *file);
g_free(*file);
- return false;
+ return FALSE;
}
close(fp);
- return true;
+ return TRUE;
}
/**
*/
gboolean util_file_prepend(const char *file, const char *format, ...)
{
- gboolean res = false;
+ gboolean res = FALSE;
va_list args;
char *content;
FILE *f;
flock(fileno(f), LOCK_UN);
fclose(f);
- res = true;
+ res = TRUE;
}
g_free(content);
*/
gboolean util_fill_completion(GtkListStore *store, const char *input, GList *src)
{
- gboolean found = false;
+ gboolean found = FALSE;
GtkTreeIter iter;
if (!input || !*input) {
for (GList *l = src; l; l = l->next) {
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, COMPLETION_STORE_FIRST, l->data, -1);
- found = true;
+ found = TRUE;
}
} else {
for (GList *l = src; l; l = l->next) {
if (g_str_has_prefix(value, input)) {
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, COMPLETION_STORE_FIRST, l->data, -1);
- found = true;
+ found = TRUE;
}
}
}