Only use internal res:// server with WebKitGTK+ < 1.1.14

This commit is contained in:
Christian Dywan 2009-11-19 23:14:48 +01:00
parent 6658afb885
commit 427a482033
3 changed files with 16 additions and 4 deletions

View file

@ -890,20 +890,22 @@ webkit_web_view_load_error_cb (WebKitWebView* web_view,
g_free (template_file); g_free (template_file);
if (g_file_get_contents (path, &template, NULL, NULL)) if (g_file_get_contents (path, &template, NULL, NULL))
{ {
#if !WEBKIT_CHECK_VERSION (1, 1, 14)
SoupServer* res_server; SoupServer* res_server;
guint port; guint port;
#endif
gchar* res_root; gchar* res_root;
gchar* stock_root; gchar* stock_root;
gchar* title; gchar* title;
gchar* message; gchar* message;
gchar* result; gchar* result;
res_server = sokoke_get_res_server ();
port = soup_server_get_port (res_server);
#if WEBKIT_CHECK_VERSION (1, 1, 14) #if WEBKIT_CHECK_VERSION (1, 1, 14)
res_root = g_strdup ("res:/"); res_root = g_strdup ("res:/");
stock_root = g_strdup ("stock:/"); stock_root = g_strdup ("stock:/");
#else #else
res_server = sokoke_get_res_server ();
port = soup_server_get_port (res_server);
res_root = g_strdup_printf ("http://localhost:%d/res", port); res_root = g_strdup_printf ("http://localhost:%d/res", port);
stock_root = g_strdup_printf ("http://localhost:%d/stock", port); stock_root = g_strdup_printf ("http://localhost:%d/stock", port);
#endif #endif
@ -2869,8 +2871,10 @@ midori_view_set_uri (MidoriView* view,
if (view->speed_dial_in_new_tabs && !g_strcmp0 (uri, "")) if (view->speed_dial_in_new_tabs && !g_strcmp0 (uri, ""))
{ {
#if !WEBKIT_CHECK_VERSION (1, 1, 14)
SoupServer* res_server; SoupServer* res_server;
guint port; guint port;
#endif
gchar* res_root; gchar* res_root;
gchar* speed_dial_head; gchar* speed_dial_head;
gchar* speed_dial_body; gchar* speed_dial_body;
@ -2884,10 +2888,15 @@ midori_view_set_uri (MidoriView* view,
if (G_UNLIKELY (!speed_dial_head)) if (G_UNLIKELY (!speed_dial_head))
speed_dial_head = g_strdup (""); 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 (); res_server = sokoke_get_res_server ();
port = soup_server_get_port (res_server); port = soup_server_get_port (res_server);
res_root = g_strdup_printf ("http://localhost:%d/res", port); res_root = g_strdup_printf ("http://localhost:%d/res", port);
stock_root = g_strdup_printf ("http://localhost:%d/stock", port); stock_root = g_strdup_printf ("http://localhost:%d/stock", port);
#endif
body_fname = g_build_filename (sokoke_set_config_dir (NULL), body_fname = g_build_filename (sokoke_set_config_dir (NULL),
"speeddial.json", NULL); "speeddial.json", NULL);

View file

@ -1156,6 +1156,7 @@ sokoke_find_data_filename (const gchar* filename)
return g_build_filename (MDATADIR, filename, NULL); return g_build_filename (MDATADIR, filename, NULL);
} }
#if !WEBKIT_CHECK_VERSION (1, 1, 14)
static void static void
res_server_handler_cb (SoupServer* res_server, res_server_handler_cb (SoupServer* res_server,
SoupMessage* msg, SoupMessage* msg,
@ -1248,6 +1249,7 @@ sokoke_get_res_server (void)
return res_server; return res_server;
} }
#endif
gchar* gchar*
sokoke_replace_variables (const gchar* template, sokoke_replace_variables (const gchar* template,

View file

@ -15,8 +15,7 @@
#include <katze/katze.h> #include <katze/katze.h>
#include <gtk/gtk.h> #include <webkit/webkit.h>
#include <libsoup/soup.h>
#include <JavaScriptCore/JavaScript.h> #include <JavaScriptCore/JavaScript.h>
gchar* gchar*
@ -150,8 +149,10 @@ sokoke_find_config_filename (const gchar* folder,
gchar* gchar*
sokoke_find_data_filename (const gchar* filename); sokoke_find_data_filename (const gchar* filename);
#if !WEBKIT_CHECK_VERSION (1, 1, 14)
SoupServer* SoupServer*
sokoke_get_res_server (void); sokoke_get_res_server (void);
#endif
gchar* gchar*
sokoke_replace_variables (const gchar* template, sokoke_replace_variables (const gchar* template,