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);
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);

View file

@ -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,

View file

@ -15,8 +15,7 @@
#include <katze/katze.h>
#include <gtk/gtk.h>
#include <libsoup/soup.h>
#include <webkit/webkit.h>
#include <JavaScriptCore/JavaScript.h>
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,