From 427a482033d6c8d4911dbea02add1f1ab0174c6e Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Thu, 19 Nov 2009 23:14:48 +0100 Subject: [PATCH] Only use internal res:// server with WebKitGTK+ < 1.1.14 --- midori/midori-view.c | 13 +++++++++++-- midori/sokoke.c | 2 ++ midori/sokoke.h | 5 +++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/midori/midori-view.c b/midori/midori-view.c index 11cc85af..1fd8416d 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -890,20 +890,22 @@ webkit_web_view_load_error_cb (WebKitWebView* web_view, g_free (template_file); if (g_file_get_contents (path, &template, NULL, NULL)) { + #if !WEBKIT_CHECK_VERSION (1, 1, 14) SoupServer* res_server; guint port; + #endif gchar* res_root; gchar* stock_root; gchar* title; gchar* message; gchar* result; - res_server = sokoke_get_res_server (); - port = soup_server_get_port (res_server); #if WEBKIT_CHECK_VERSION (1, 1, 14) res_root = g_strdup ("res:/"); stock_root = g_strdup ("stock:/"); #else + res_server = sokoke_get_res_server (); + port = soup_server_get_port (res_server); res_root = g_strdup_printf ("http://localhost:%d/res", port); stock_root = g_strdup_printf ("http://localhost:%d/stock", port); #endif @@ -2869,8 +2871,10 @@ midori_view_set_uri (MidoriView* view, if (view->speed_dial_in_new_tabs && !g_strcmp0 (uri, "")) { + #if !WEBKIT_CHECK_VERSION (1, 1, 14) SoupServer* res_server; guint port; + #endif gchar* res_root; gchar* speed_dial_head; gchar* speed_dial_body; @@ -2884,10 +2888,15 @@ midori_view_set_uri (MidoriView* view, if (G_UNLIKELY (!speed_dial_head)) speed_dial_head = g_strdup (""); + #if WEBKIT_CHECK_VERSION (1, 1, 14) + res_root = g_strdup ("res:/"); + stock_root = g_strdup ("stock:/"); + #else res_server = sokoke_get_res_server (); port = soup_server_get_port (res_server); res_root = g_strdup_printf ("http://localhost:%d/res", port); stock_root = g_strdup_printf ("http://localhost:%d/stock", port); + #endif body_fname = g_build_filename (sokoke_set_config_dir (NULL), "speeddial.json", NULL); diff --git a/midori/sokoke.c b/midori/sokoke.c index ce5e3b5a..17993b8b 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -1156,6 +1156,7 @@ sokoke_find_data_filename (const gchar* filename) return g_build_filename (MDATADIR, filename, NULL); } +#if !WEBKIT_CHECK_VERSION (1, 1, 14) static void res_server_handler_cb (SoupServer* res_server, SoupMessage* msg, @@ -1248,6 +1249,7 @@ sokoke_get_res_server (void) return res_server; } +#endif gchar* sokoke_replace_variables (const gchar* template, diff --git a/midori/sokoke.h b/midori/sokoke.h index 36a59e0c..78ef12d9 100644 --- a/midori/sokoke.h +++ b/midori/sokoke.h @@ -15,8 +15,7 @@ #include -#include -#include +#include #include gchar* @@ -150,8 +149,10 @@ sokoke_find_config_filename (const gchar* folder, gchar* sokoke_find_data_filename (const gchar* filename); +#if !WEBKIT_CHECK_VERSION (1, 1, 14) SoupServer* sokoke_get_res_server (void); +#endif gchar* sokoke_replace_variables (const gchar* template,