- g_object_set(G_OBJECT(settings), "user-agent", ua, NULL);
- g_object_set(G_OBJECT(settings),
- "auto-load-images", loadimages, NULL);
- g_object_set(G_OBJECT(settings),
- "enable-plugins", enableplugins, NULL);
- g_object_set(G_OBJECT(settings),
- "enable-scripts", enablescripts, NULL);
- g_object_set(G_OBJECT(settings),
- "enable-spatial-navigation", enablespatialbrowsing, NULL);
- g_object_set(G_OBJECT(settings),
- "enable-developer-extras", enableinspector, NULL);
- g_object_set(G_OBJECT(settings),
- "enable-default-context-menu", kioskmode ^ 1, NULL);
- g_object_set(G_OBJECT(settings),
- "default-font-size", defaultfontsize, NULL);
- g_object_set(G_OBJECT(settings),
- "resizable-text-areas", 1, NULL);
- if (enablestyle)
- setstyle(c, getstyle("about:blank"));
-
- if (enableinspector) {
- c->inspector = webkit_web_view_get_inspector(v);
- g_signal_connect(G_OBJECT(c->inspector), "inspect-web-view",
- G_CALLBACK(inspector_new), c);
- g_signal_connect(G_OBJECT(c->inspector), "show-window",
- G_CALLBACK(inspector_show), c);
- g_signal_connect(G_OBJECT(c->inspector), "close-window",
- G_CALLBACK(inspector_close), c);
- g_signal_connect(G_OBJECT(c->inspector), "finished",
- G_CALLBACK(inspector_finished), c);
- c->isinspecting = false;
- }
+ webkit_settings_set_user_agent(settings, ua);
+ /* Have a look at http://webkitgtk.org/reference/webkit2gtk/stable/WebKitSettings.html
+ * for more interesting settings */
+
+ contentmanager = webkit_user_content_manager_new();
+
+ context = webkit_web_context_new_with_website_data_manager(
+ webkit_website_data_manager_new(
+ "base-cache-directory", cachedir,
+ "base-data-directory", cachedir,
+ NULL));
+
+ /* rendering process model, can be a shared unique one or one for each
+ * view */
+ webkit_web_context_set_process_model(context,
+ WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);
+ /* ssl */
+ webkit_web_context_set_tls_errors_policy(context, strictssl ?
+ WEBKIT_TLS_ERRORS_POLICY_FAIL : WEBKIT_TLS_ERRORS_POLICY_IGNORE);
+ /* disk cache */
+ webkit_web_context_set_cache_model(context, enablecache ?
+ WEBKIT_CACHE_MODEL_WEB_BROWSER : WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER);
+
+ /* Currently only works with text file to be compatible with curl */
+ webkit_cookie_manager_set_persistent_storage(
+ webkit_web_context_get_cookie_manager(context), cookiefile,
+ WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT);
+ /* cookie policy */
+ webkit_cookie_manager_set_accept_policy(
+ webkit_web_context_get_cookie_manager(context),
+ cookiepolicy_get());
+
+ g_signal_connect(G_OBJECT(context), "download-started",
+ G_CALLBACK(downloadstarted), c);
+
+ v = g_object_new(WEBKIT_TYPE_WEB_VIEW,
+ "settings", settings,
+ "user-content-manager", contentmanager,
+ "web-context", context,
+ NULL);