if (g_str_has_suffix(path, ".js")) {
g_file_get_contents(path, &source, NULL,
NULL);
+ // clang-format off
wkscript = webkit_user_script_new(
source,
- WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES,
- WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_START,
+ WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES,
+ WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_START,
NULL, NULL);
+ // clang-format on
webkit_user_content_manager_add_script(
ucm, wkscript);
webkit_user_script_unref(wkscript);
if (g_str_has_suffix(path, ".css")) {
g_file_get_contents(path, &source, NULL,
NULL);
+ // clang-format off
wkstyle = webkit_user_style_sheet_new(
source,
- WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES,
- WEBKIT_USER_STYLE_LEVEL_USER,
+ WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES,
+ WEBKIT_USER_STYLE_LEVEL_USER,
NULL, NULL);
- webkit_user_content_manager_add_style_sheet(
+ webkit_user_content_manager_add_style_sheet(
ucm, wkstyle);
+ // clang-format on
webkit_user_style_sheet_unref(wkstyle);
}
g_free(path);
c->settings = webkit_web_view_get_settings(
WEBKIT_WEB_VIEW(c->web_view));
- if (cfg.verbose)
- webkit_settings_set_enable_write_console_messages_to_stdout(
+ if (cfg.verbose) {
+ // clang-format off
+ webkit_settings_set_enable_write_console_messages_to_stdout(
c->settings, true);
+ // clang-format on
+ }
webkit_settings_set_enable_developer_extras(c->settings, TRUE);
} else {
c->web_view = webkit_web_view_new_with_related_view(related_wv);
u = webkit_web_view_get_uri(WEBKIT_WEB_VIEW(c->web_view));
t = webkit_web_view_get_title(WEBKIT_WEB_VIEW(c->web_view));
- u = u == NULL ? "chorizo" : u;
- u = u[0] == 0 ? "chorizo" : u;
-
- t = t == NULL ? u : t;
- t = t[0] == 0 ? u : t;
+ if (t == NULL) t = (u == NULL) ? "chorizo" : u;
gchar *name = malloc(strlen(t) + 4);
if (!name) allocfail();
// No g_get_user_state_dir unfortunately
gchar *state_env = getenv("XDG_STATE_DIR");
- gchar *state_dir = (state_env) ?
- state_env :
- g_build_filename(g_get_home_dir(),
+ // clang-format off
+ gchar *state_dir = (state_env)
+ ? state_env
+ : g_build_filename(g_get_home_dir(),
".local", "state",
"chorizo", NULL);
+ // clang-format on
gchar *history_file =
g_build_filename(state_dir, "history", NULL);
fprintf(fp, "%s\n", t);
fclose(fp);
} else {
- perror("chorizo: error: could not open history file");
+ perror("chorizo: error: could not open history"
+ "file");
}
}
g_free(history_file);
jsc_context_get_exception(jsc_value_get_context(value));
if (exception != NULL) {
fprintf(stderr,
- "chorizo: warning: error running javascript: %s\n",
+ "chorizo: warning: error running javascript:"
+ "%s\n",
jsc_exception_get_message(exception));
} else {
c->feed_html = str_value;
g_free(absfile);
if (cert == NULL)
fprintf(stderr,
- "chorizo: warning: could not load trusted cert: %s\n",
+ "chorizo: warning: could not load"
+ "trusted cert: %s\n",
file);
else
- webkit_web_context_allow_tls_certificate_for_host(
+ // clang-format off
+ webkit_web_context_allow_tls_certificate_for_host(
wc, cert, file);
+ // clang-format on
file = g_dir_read_name(dir);
}
g_dir_close(dir);