/* if ther was at least one command removed - rebuilt the used bits */
if (removed) {
rebuild_used_bits();
+
+ /* update signals dependants of autocmd */
+ vb_update_signals();
}
return true;
/* merge the autocmd bits into the used bits */
usedbits |= cmd->bits;
+
+ /* update signals dependants of autocmd */
+ vb_update_signals();
}
return true;
#endif
}
+void vb_update_signals()
+{
+ /**
+ * search the signal handler for signal associated to vb.session
+ * and matching function session_request_queued_cb
+ */
+ gulong hdl = g_signal_handler_find(vb.session,
+ G_SIGNAL_MATCH_FUNC,
+ 0, 0, NULL, session_request_queued_cb, NULL);
+
+ if ((vb.config.contentsecuritypolicy && *vb.config.contentsecuritypolicy != '\0')
+#ifdef FEATURE_AUTOCMD
+ || autocmd_in_use(AU_REQUEST_QUEUED)
+#endif
+ ) {
+ /**
+ * content-security-policy OR AU_REQUEST_QUEUED are in used:
+ * the signal should be connected
+ */
+ if (hdl == 0) {
+ /* the signal wasn't found: connect it */
+ g_signal_connect(vb.session, "request-queued", G_CALLBACK(session_request_queued_cb), NULL);
+
+ PRINT_DEBUG("request-queued connected");
+ }
+
+ } else {
+ /* the signal should not be here */
+ if (hdl != 0) {
+ /* the signal was found: disconnect it */
+ g_signal_handler_disconnect(vb.session, hdl);
+
+ PRINT_DEBUG("request-queued disconnected");
+ }
+ }
+}
+
void vb_quit(gboolean force)
{
/* if not forced quit - don't quit if there are still running downloads */
NULL
);
- g_signal_connect(vb.session, "request-queued", G_CALLBACK(session_request_queued_cb), NULL);
-
#ifdef FEATURE_NO_SCROLLBARS
WebKitWebFrame *frame = webkit_web_view_get_main_frame(vb.gui.webview);
g_signal_connect(G_OBJECT(frame), "scrollbars-policy-changed", G_CALLBACK(gtk_true), NULL);
void vb_update_status_style(void);
void vb_update_input_style(void);
void vb_update_urlbar(const char *uri);
+void vb_update_signals(void);
void vb_register_add(char buf, const char *value);
const char *vb_register_get(char buf);
gboolean vb_download(WebKitWebView *view, WebKitDownload *download, const char *path);
} SettingType;
enum {
- FLAG_LIST = (1<<1), /* setting contains a ',' separated list of values */
- FLAG_NODUP = (1<<2), /* don't allow duplicate strings within list values */
+ FLAG_LIST = (1<<1), /* setting contains a ',' separated list of values */
+ FLAG_NODUP = (1<<2), /* don't allow duplicate strings within list values */
+ FLAG_SIGNAL = (1<<3), /* changing the setting need call vb_update_signals() */
};
extern VbCore vb;
setting_add("history-max-items", TYPE_INTEGER, &i, internal, 0, &vb.config.history_max);
setting_add("editor-command", TYPE_CHAR, &"x-terminal-emulator -e -vi '%s'", NULL, 0, NULL);
setting_add("header", TYPE_CHAR, &"", headers, FLAG_LIST|FLAG_NODUP, NULL);
- setting_add("content-security-policy", TYPE_CHAR, &"", internal, 0, &vb.config.contentsecuritypolicy);
+ setting_add("content-security-policy", TYPE_CHAR, &"", internal, FLAG_SIGNAL, &vb.config.contentsecuritypolicy);
setting_add("nextpattern", TYPE_CHAR, &"/\\bnext\\b/i,/^(>\\|>>\\|»)$/,/^(>\\|>>\\|»)/,/(>\\|>>\\|»)$/,/\\bmore\\b/i", prevnext, FLAG_LIST|FLAG_NODUP, NULL);
setting_add("previouspattern", TYPE_CHAR, &"/\\bprev\\|previous\\b/i,/^(<\\|<<\\|«)$/,/^(<\\|<<\\|«)/,/(<\\|<<\\|«)$/", prevnext, FLAG_LIST|FLAG_NODUP, NULL);
setting_add("fullscreen", TYPE_BOOLEAN, &off, fullscreen, 0, NULL);
break;
}
+ /* update signals if requested */
+ if (prop->flags & FLAG_SIGNAL) {
+ vb_update_signals();
+ }
+
free:
if (free_newvalue) {
g_free(newvalue);