- uri = g_strconcat("file://", stylefile, NULL);
- g_object_set(G_OBJECT(settings), "user-stylesheet-uri", uri, NULL);
- g_object_set(G_OBJECT(settings), "auto-load-images", loadimage, NULL);
- g_object_set(G_OBJECT(settings), "enable-plugins", plugin, NULL);
- g_object_set(G_OBJECT(settings), "enable-scripts", script, NULL);
- g_free(uri);
- setatom(c, findprop, "");
- setatom(c, uriprop, "");
-
- c->download = NULL;
- c->title = NULL;
+ if (stylefile != NULL) {
+ uri = g_strconcat("file://", stylefile, NULL);
+ g_object_set(G_OBJECT(settings), "user-stylesheet-uri", uri, 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);
+
+ /*
+ * While stupid, CSS specifies that a pixel represents 1/96 of an inch.
+ * This ensures websites are not unusably small with a high DPI screen.
+ * It is equivalent to firefox's "layout.css.devPixelsPerPx" setting.
+ */
+ if(zoomto96dpi) {
+ screen = gdk_window_get_screen(GTK_WIDGET(c->win)->window);
+ dpi = gdk_screen_get_resolution(screen);
+ if(dpi != -1) {
+ g_object_set(G_OBJECT(settings), "enforce-96-dpi", true,
+ NULL);
+ webkit_web_view_set_zoom_level(c->view, dpi/96);
+ }
+ }
+ /* This might conflict with _zoomto96dpi_. */
+ if(zoomlevel != 1.0)
+ webkit_web_view_set_zoom_level(c->view, zoomlevel);
+
+ if(enableinspector) {
+ c->inspector = WEBKIT_WEB_INSPECTOR(
+ webkit_web_view_get_inspector(c->view));
+ 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;
+ }
+
+ if(runinfullscreen) {
+ c->fullscreen = 0;
+ fullscreen(c, NULL);
+ }
+
+ if(stylefile != NULL)
+ g_free(uri);
+
+ setatom(c, AtomFind, "");
+ setatom(c, AtomUri, "about:blank");
+ if(hidebackground)
+ webkit_web_view_set_transparent(c->view, TRUE);
+