Allow to setup initial webkit settings.
authorDaniel Carl <danielcarl@gmx.de>
Sat, 13 Oct 2012 19:02:24 +0000 (21:02 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Sat, 13 Oct 2012 19:02:24 +0000 (21:02 +0200)
config.mk
src/config.h
src/main.c

index d0a5fb0..be2c1ff 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -1,7 +1,7 @@
 #----------------user/install options----------------
 VERSION = 0.1.0
 
-PROJECT = vimprobable
+PROJECT = vimp
 PREFIX ?= /usr/local
 BINDIR ?= $(PREFIX)/bin/
 MANDIR ?= $(PREFIX)/share/man/
index 5af42f6..0f8511d 100644 (file)
@@ -8,6 +8,11 @@
 #define STATUS_BAR_FONT "monospace bold 8"
 #define URL_BOX_FONT    "monospace 8"
 
+#define SETTING_DEFAUL_FONT_SIZE    12
+#define SETTING_USER_AGENT          PROJECT "/" VERSION " (X11; Linux i686) AppleWebKit/535.22+ Compatible (Safari)"
+#define SETTING_MAX_CONNS           25
+#define SETTING_MAX_CONNS_PER_HOST  5
+
 #define SCROLLSTEP (40) /* cursor difference in pixel for scrolling */
 
 #endif /* end of include guard: CONFIG_H */
index 6c03424..2d8eca6 100644 (file)
@@ -16,6 +16,7 @@ static gboolean vp_frame_scrollbar_policy_changed_cb(void);
 static void vp_print_version(void);
 static void vp_init(void);
 static void vp_init_gui(void);
+static void vp_setup_settings(void);
 static void vp_setup_signals(void);
 
 
@@ -236,6 +237,8 @@ static void vp_init_gui(void)
     /* Create a browser instance */
     gui->webview = WEBKIT_WEB_VIEW(webkit_web_view_new());
 
+    vp_setup_settings();
+
     /* Create a scrollable area */
     gui->viewport = gtk_scrolled_window_new(gui->adjust_h, gui->adjust_v);
     gtk_scrolled_window_set_policy(
@@ -294,6 +297,17 @@ static void vp_init_gui(void)
     gtk_widget_show_all(gui->window);
 }
 
+static void vp_setup_settings(void)
+{
+    WebKitWebSettings *settings = webkit_web_view_get_settings(vp.gui.webview);
+
+    g_object_set(G_OBJECT(settings), "user-agent", SETTING_USER_AGENT, NULL);
+    g_object_set(G_OBJECT(settings), "max-conns", SETTING_MAX_CONNS, NULL);
+    g_object_set(G_OBJECT(settings), "max-conns-per-host", SETTING_MAX_CONNS_PER_HOST, NULL);
+    webkit_web_view_set_settings(vp.gui.webview, settings);
+}
+
+
 static void vp_setup_signals(void)
 {
     Gui* gui              = &vp.gui;