[Xfce4-commits] <midori:master> Add some #ifdef to build Midori with WebKit2 support

Christian Dywan noreply at xfce.org
Thu Feb 21 20:20:03 CET 2013


Updating branch refs/heads/master
         to 615cee49051c6711e7f862824ec538f2b7631e1b (commit)
       from fa16534c0be54af1e9dcf831a5291b7cea384e76 (commit)

commit 615cee49051c6711e7f862824ec538f2b7631e1b
Author: André Stösel <andre at stoesel.de>
Date:   Tue Feb 19 19:47:23 2013 +0100

    Add some #ifdef to build Midori with WebKit2 support
    
    Notice: Only --plain works right now

 katze/katze-item.c             |    7 ++-
 katze/katze-net.c              |    4 ++
 katze/midori-paths.vala        |    6 ++
 midori/main.c                  |    6 ++
 midori/midori-browser.c        |   40 +++++++++++++++-
 midori/midori-browser.h        |    4 ++
 midori/midori-download.vala    |   34 +++++++++++++
 midori/midori-frontend.c       |    7 ++-
 midori/midori-locationaction.c |    2 +
 midori/midori-preferences.c    |    2 +
 midori/midori-privatedata.c    |    4 ++
 midori/midori-searchaction.c   |    4 ++
 midori/midori-session.c        |    6 ++-
 midori/midori-settings.vala    |    7 ++-
 midori/midori-speeddial.vala   |    4 ++
 midori/midori-tab.vala         |   14 ++++++
 midori/midori-view.c           |  102 ++++++++++++++++++++++++++++++++++++++--
 midori/midori-websettings.c    |    5 ++
 midori/sokoke.c                |    9 ++++
 midori/sokoke.h                |    4 ++
 panels/midori-transfers.c      |    8 +++
 toolbars/midori-transferbar.c  |    6 ++
 22 files changed, 274 insertions(+), 11 deletions(-)

diff --git a/katze/katze-item.c b/katze/katze-item.c
index beba534..f91bc90 100644
--- a/katze/katze-item.c
+++ b/katze/katze-item.c
@@ -457,7 +457,7 @@ katze_item_get_pixbuf (KatzeItem* item,
 static void
 katze_item_image_destroyed_cb (GtkWidget* image,
                                KatzeItem* item);
-
+#ifndef HAVE_WEBKIT2
 #if WEBKIT_CHECK_VERSION (1, 3, 13)
 static void
 #if WEBKIT_CHECK_VERSION (1, 8, 0)
@@ -482,11 +482,13 @@ katze_item_icon_loaded_cb (WebKitIconDatabase*    database,
     }
 }
 #endif
+#endif
 
 static void
 katze_item_image_destroyed_cb (GtkWidget* image,
                                KatzeItem* item)
 {
+#ifndef HAVE_WEBKIT2
     #if WEBKIT_CHECK_VERSION (1, 8, 0)
     g_signal_handlers_disconnect_by_func (webkit_get_favicon_database (),
         katze_item_icon_loaded_cb, image);
@@ -494,6 +496,7 @@ katze_item_image_destroyed_cb (GtkWidget* image,
     g_signal_handlers_disconnect_by_func (webkit_get_icon_database (),
         katze_item_icon_loaded_cb, image);
     #endif
+#endif
     g_object_unref (item);
 }
 
@@ -528,6 +531,7 @@ katze_item_get_image (KatzeItem* item,
     g_object_set_data (G_OBJECT (image), "KatzeItem", g_object_ref (item));
     g_signal_connect (image, "destroy",
         G_CALLBACK (katze_item_image_destroyed_cb), item);
+#ifndef HAVE_WEBKIT2
     #if WEBKIT_CHECK_VERSION (1, 8, 0)
     g_signal_connect (webkit_get_favicon_database (), "icon-loaded",
         G_CALLBACK (katze_item_icon_loaded_cb), image);
@@ -535,6 +539,7 @@ katze_item_get_image (KatzeItem* item,
     g_signal_connect (webkit_get_icon_database (), "icon-loaded",
         G_CALLBACK (katze_item_icon_loaded_cb), image);
     #endif
+#endif
     return image;
 }
 
diff --git a/katze/katze-net.c b/katze/katze-net.c
index 75a9949..2ba9b87 100644
--- a/katze/katze-net.c
+++ b/katze/katze-net.c
@@ -120,6 +120,7 @@ static void
 katze_net_got_headers_cb (SoupMessage*  msg,
                           KatzeNetPriv* priv)
 {
+#ifndef HAVE_WEBKIT2
     KatzeNetRequest* request = priv->request;
 
     switch (msg->status_code)
@@ -140,6 +141,7 @@ katze_net_got_headers_cb (SoupMessage*  msg,
         g_signal_handlers_disconnect_by_func (msg, katze_net_got_body_cb, priv);
         soup_session_cancel_message (webkit_get_default_session (), msg, 1);
     }
+#endif
 }
 
 static void
@@ -241,6 +243,7 @@ katze_net_load_uri (KatzeNet*          net,
                     KatzeNetTransferCb transfer_cb,
                     gpointer           user_data)
 {
+#ifndef HAVE_WEBKIT2
     KatzeNetRequest* request;
     KatzeNetPriv* priv;
     SoupMessage* msg;
@@ -280,5 +283,6 @@ katze_net_load_uri (KatzeNet*          net,
         g_idle_add ((GSourceFunc)katze_net_local_cb, priv);
     else
         g_idle_add ((GSourceFunc)katze_net_default_cb, priv);
+#endif
 }
 
diff --git a/katze/midori-paths.vala b/katze/midori-paths.vala
index 05d2b05..0652ae3 100644
--- a/katze/midori-paths.vala
+++ b/katze/midori-paths.vala
@@ -112,6 +112,7 @@ namespace Midori {
                 tmp_dir = Path.build_path (Path.DIR_SEPARATOR_S,
                     Environment.get_tmp_dir (), "midori-" + Environment.get_user_name ());
             }
+#if !HAVE_WEBKIT2
 #if HAVE_WEBKIT_1_3_13
             if (user_data_dir != null) {
                 string folder = Path.build_filename (user_data_dir, "webkit", "icondatabase");
@@ -122,6 +123,7 @@ namespace Midori {
 #endif
             }
 #endif
+#endif
             if (strcmp (Environment.get_variable ("MIDORI_DEBUG"), "paths") == 0) {
                 stdout.printf ("config: %s\ncache: %s\nuser_data: %s\ntmp: %s\n",
                                config_dir, cache_dir, user_data_dir, tmp_dir);
@@ -376,11 +378,13 @@ namespace Midori {
         public static void clear_icons () {
             assert (cache_dir != null);
             assert (user_data_dir != null);
+#if !HAVE_WEBKIT2
 #if HAVE_WEBKIT_1_8_0
             WebKit.get_favicon_database ().clear ();
 #elif HAVE_WEBKIT_1_3_13
             WebKit.get_icon_database ().clear ();
 #endif
+#endif
             /* FIXME: Exclude search engine icons */
             remove_path (Path.build_filename (cache_dir, "icons"));
             remove_path (Path.build_filename (user_data_dir, "webkit", "icondatabase"));
@@ -393,6 +397,7 @@ namespace Midori {
             if (widget != null)
                 Gtk.icon_size_lookup_for_settings (widget.get_settings (),
                     Gtk.IconSize.MENU, out icon_width, out icon_height);
+#if !HAVE_WEBKIT2
 #if HAVE_WEBKIT_1_8_0
             Gdk.Pixbuf? pixbuf = WebKit.get_favicon_database ()
                 .try_get_favicon_pixbuf (uri, icon_width, icon_height);
@@ -421,6 +426,7 @@ namespace Midori {
                 catch (GLib.Error error) { }
             }
 #endif
+#endif
             if (widget != null)
                 return widget.render_icon (Gtk.STOCK_FILE, Gtk.IconSize.MENU, null);
             return null;
diff --git a/midori/main.c b/midori/main.c
index 9c5463f..bd17860 100644
--- a/midori/main.c
+++ b/midori/main.c
@@ -32,6 +32,7 @@
 
 #define HAVE_OFFSCREEN GTK_CHECK_VERSION (2, 20, 0)
 
+#ifndef HAVE_WEBKIT2
 static void
 snapshot_load_finished_cb (GtkWidget*      web_view,
                            WebKitWebFrame* web_frame,
@@ -62,6 +63,7 @@ snapshot_load_finished_cb (GtkWidget*      web_view,
     g_print (_("Snapshot saved to: %s\n"), filename);
     gtk_main_quit ();
 }
+#endif
 
 int
 main (int    argc,
@@ -252,8 +254,10 @@ main (int    argc,
             gtk_widget_set_size_request (web_view, 800, 600);
         gtk_widget_show_all (offscreen);
         #endif
+        #ifndef HAVE_WEBKIT2
         g_signal_connect (web_view, "load-finished",
             G_CALLBACK (snapshot_load_finished_cb), filename);
+        #endif
         uri = sokoke_prepare_uri (snapshot);
         webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), uri);
         g_free (uri);
@@ -293,7 +297,9 @@ main (int    argc,
         {
             MidoriBrowser* browser = midori_browser_new ();
             MidoriWebSettings* settings = midori_browser_get_settings (browser);
+#ifndef HAVE_WEBKIT2
             g_object_set_data (G_OBJECT (webkit_get_default_session ()), "pass-through-console", (void*)1);
+#endif
             midori_load_soup_session (settings);
 
             gchar* msg = NULL;
diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index cc30ae4..d5d4e43 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -981,6 +981,7 @@ midori_browser_prepare_download (MidoriBrowser*  browser,
                                  const gchar*    uri)
 
 {
+#ifndef HAVE_WEBKIT2
     if (!midori_download_has_enough_space (download, uri))
         return FALSE;
     webkit_download_set_destination_uri (download, uri);
@@ -989,12 +990,16 @@ midori_browser_prepare_download (MidoriBrowser*  browser,
     midori_transferbar_check_size (browser->statusbar,
         MIDORI_TRANSFERBAR (browser->transferbar));
     return TRUE;
+#else
+    return FALSE;
+#endif
 }
 
 static void
 midori_browser_save_resources (GList*       resources,
                                const gchar* folder)
 {
+#ifndef HAVE_WEBKIT2
     GList* list;
     katze_mkdir_with_parents (folder, 0700);
 
@@ -1026,6 +1031,7 @@ midori_browser_save_resources (GList*       resources,
         g_free (sub_filename);
         g_free (sub_path);
     }
+#endif
 }
 
 void
@@ -1174,6 +1180,7 @@ midori_browser_view_copy_history (GtkWidget* view_to,
                                   GtkWidget* view_from,
                                   gboolean   omit_last)
 {
+#ifndef HAVE_WEBKIT2
     WebKitWebView* copy_from;
     WebKitWebBackForwardList* list_from;
     WebKitWebView* copy_to;
@@ -1194,6 +1201,7 @@ midori_browser_view_copy_history (GtkWidget* view_to,
         webkit_web_back_forward_list_add_item (list_to,
             webkit_web_back_forward_list_get_nth_item (list_from, i));
     }
+#endif
 }
 
 static gboolean
@@ -1292,6 +1300,7 @@ midori_browser_download_status_cb (WebKitDownload*  download,
                                    GParamSpec*      pspec,
                                    GtkWidget*       widget)
 {
+#ifndef HAVE_WEBKIT2
     const gchar* uri = webkit_download_get_destination_uri (download);
     switch (webkit_download_get_status (download))
     {
@@ -1314,6 +1323,7 @@ midori_browser_download_status_cb (WebKitDownload*  download,
         case WEBKIT_DOWNLOAD_STATUS_CANCELLED:
             break;
     }
+#endif
 }
 
 static gboolean
@@ -1332,6 +1342,7 @@ midori_view_download_requested_cb (GtkWidget*      view,
                                    WebKitDownload* download,
                                    MidoriBrowser*  browser)
 {
+#ifndef HAVE_WEBKIT2
     MidoriDownloadType type = midori_download_get_type (download);
     GtkWidget* web_view;
     WebKitWebFrame* web_frame;
@@ -1418,6 +1429,9 @@ midori_view_download_requested_cb (GtkWidget*      view,
     if (midori_view_is_blank (MIDORI_VIEW (view)) && webkit_web_data_source_get_data (datasource) == NULL)
         g_idle_add (midori_browser_close_tab_idle, view);
     return handled;
+#else
+    return FALSE;
+#endif
 }
 
 static void
@@ -1730,6 +1744,7 @@ midori_browser_key_press_event (GtkWidget*   widget,
         return TRUE;
     }
 
+#ifndef HAVE_WEBKIT2
     focus = gtk_window_get_focus (GTK_WINDOW (widget));
     if (focus == NULL)
         gtk_widget_grab_focus (midori_browser_get_current_tab (MIDORI_BROWSER (widget)));
@@ -1756,6 +1771,7 @@ midori_browser_key_press_event (GtkWidget*   widget,
             }
         }
     }
+#endif
 
     if (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))
         if (sokoke_window_activate_key (window, event))
@@ -2597,6 +2613,7 @@ _action_edit_activate (GtkAction*     action,
 
     if (WEBKIT_IS_WEB_VIEW (widget))
     {
+#ifndef HAVE_WEBKIT2
         WebKitWebView* view = WEBKIT_WEB_VIEW (widget);
         can_undo = webkit_web_view_can_undo (view);
         can_redo = webkit_web_view_can_redo (view);
@@ -2604,6 +2621,7 @@ _action_edit_activate (GtkAction*     action,
         can_copy = webkit_web_view_can_copy_clipboard (view);
         can_paste = webkit_web_view_can_paste_clipboard (view);
         can_select_all = TRUE;
+#endif
     }
     else if (GTK_IS_EDITABLE (widget))
     {
@@ -2638,18 +2656,22 @@ static void
 _action_undo_activate (GtkAction*     action,
                        MidoriBrowser* browser)
 {
+#ifndef HAVE_WEBKIT2
     GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
     if (WEBKIT_IS_WEB_VIEW (widget))
         webkit_web_view_undo (WEBKIT_WEB_VIEW (widget));
+#endif
 }
 
 static void
 _action_redo_activate (GtkAction*     action,
                        MidoriBrowser* browser)
 {
+#ifndef HAVE_WEBKIT2
     GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
     if (WEBKIT_IS_WEB_VIEW (widget))
         webkit_web_view_redo (WEBKIT_WEB_VIEW (widget));
+#endif
 }
 
 static void
@@ -2694,6 +2716,7 @@ static void
 _action_delete_activate (GtkAction*     action,
                          MidoriBrowser* browser)
 {
+#ifndef HAVE_WEBKIT2
     GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
     if (G_LIKELY (widget))
     {
@@ -2705,6 +2728,7 @@ _action_delete_activate (GtkAction*     action,
             gtk_text_buffer_delete_selection (
                 gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)), TRUE, FALSE);
     }
+#endif
 }
 
 static void
@@ -3391,7 +3415,9 @@ _action_source_view_activate (GtkAction*     action,
 
         source = midori_view_new_with_item (NULL, browser->settings);
         source_view = midori_view_get_web_view (MIDORI_VIEW (source));
+#ifndef HAVE_WEBKIT2
         webkit_web_view_set_view_source_mode (WEBKIT_WEB_VIEW (source_view), TRUE);
+#endif
         webkit_web_view_load_uri (WEBKIT_WEB_VIEW (source_view), source_uri);
         midori_browser_add_tab (browser, source);
     }
@@ -3500,7 +3526,7 @@ _action_scroll_somewhere_activate (GtkAction*     action,
         return;
     web_view = WEBKIT_WEB_VIEW (midori_view_get_web_view (MIDORI_VIEW (view)));
     name = gtk_action_get_name (action);
-
+#ifndef HAVE_WEBKIT2
     if (g_str_equal (name, "ScrollLeft"))
         webkit_web_view_move_cursor (web_view, GTK_MOVEMENT_VISUAL_POSITIONS, -1);
     else if (g_str_equal (name, "ScrollDown"))
@@ -3509,6 +3535,7 @@ _action_scroll_somewhere_activate (GtkAction*     action,
         webkit_web_view_move_cursor (web_view, GTK_MOVEMENT_DISPLAY_LINES, -1);
     else if (g_str_equal (name, "ScrollRight"))
         webkit_web_view_move_cursor (web_view, GTK_MOVEMENT_VISUAL_POSITIONS, 1);
+#endif
 }
 
 static void
@@ -3560,6 +3587,7 @@ static gboolean
 _action_navigation_activate (GtkAction*     action,
                              MidoriBrowser* browser)
 {
+#ifndef HAVE_WEBKIT2
     MidoriView* view;
     GtkWidget* tab;
     gchar* uri;
@@ -3670,6 +3698,7 @@ _action_navigation_activate (GtkAction*     action,
         g_free (uri);
         return TRUE;
     }
+#endif
     return FALSE;
 }
 
@@ -3719,6 +3748,7 @@ _action_location_reset_uri (GtkAction*     action,
     }
 }
 
+#ifndef HAVE_WEBKIT2
 #if WEBKIT_CHECK_VERSION (1, 3, 13)
 static void
 #if WEBKIT_CHECK_VERSION (1, 8, 0)
@@ -3757,11 +3787,13 @@ midori_browser_item_icon_loaded_cb (WebKitIconDatabase*    database,
     }
 }
 #endif
+#endif
 
 static void
 midori_browser_queue_item_for_icon (KatzeItem*     item,
                                     const gchar*   uri)
 {
+#ifndef HAVE_WEBKIT2
     if (katze_item_get_icon (item) != NULL)
         return;
     g_object_set_data_full (G_OBJECT (item), "browser-queue-icon", g_strdup (uri), g_free);
@@ -3772,6 +3804,7 @@ midori_browser_queue_item_for_icon (KatzeItem*     item,
     g_signal_connect (webkit_get_icon_database (), "icon-loaded",
         G_CALLBACK (midori_browser_item_icon_loaded_cb), item);
     #endif
+#endif
 }
 
 static void
@@ -6457,6 +6490,7 @@ midori_browser_toolbar_popup_context_menu_history (MidoriBrowser* browser,
                                                    gint x,
                                                    gint y)
 {
+#ifndef HAVE_WEBKIT2
     const gint step = back ? -1 : 1;
     gint steps = step;
     GtkWidget* menu;
@@ -6510,6 +6544,7 @@ midori_browser_toolbar_popup_context_menu_history (MidoriBrowser* browser,
 
     katze_widget_popup (widget, GTK_MENU (menu), NULL,
         KATZE_MENU_POSITION_LEFT);
+#endif
 }
 
 static gboolean
@@ -7275,10 +7310,11 @@ midori_browser_add_tab (MidoriBrowser* browser,
     g_return_if_fail (MIDORI_IS_BROWSER (browser));
     g_return_if_fail (GTK_IS_WIDGET (view));
 
+#ifndef HAVE_WEBKIT2
     if (!g_object_get_data (G_OBJECT (webkit_get_default_session ()),
                             "midori-session-initialized"))
         g_critical ("midori_load_soup_session was not called!");
-
+#endif
     g_signal_emit (browser, signals[ADD_TAB], 0, view);
 }
 
diff --git a/midori/midori-browser.h b/midori/midori-browser.h
index a300572..1564145 100644
--- a/midori/midori-browser.h
+++ b/midori/midori-browser.h
@@ -42,7 +42,11 @@ struct _MidoriBrowserClass
     /* Signals */
     void
     (*window_object_cleared)   (MidoriBrowser*       browser,
+#ifndef HAVE_WEBKIT2
                                 WebKitWebFrame*      web_frame,
+#else
+                                void*                web_frame,
+#endif
                                 JSContextRef*        context,
                                 JSObjectRef*         window_object);
     void
diff --git a/midori/midori-download.vala b/midori/midori-download.vala
index 86d3f2f..951332b 100644
--- a/midori/midori-download.vala
+++ b/midori/midori-download.vala
@@ -17,6 +17,7 @@ namespace Sokoke {
 namespace Midori {
     namespace Download {
         public static bool is_finished (WebKit.Download download) {
+#if !HAVE_WEBKIT2
             switch (download.status) {
                 case WebKit.DownloadStatus.FINISHED:
                 case WebKit.DownloadStatus.CANCELLED:
@@ -25,6 +26,9 @@ namespace Midori {
                 default:
                     return false;
             }
+#else
+            return false;
+#endif
         }
 
         public static int get_type (WebKit.Download download) {
@@ -36,10 +40,14 @@ namespace Midori {
         }
 
         public static double get_progress (WebKit.Download download) {
+#if !HAVE_WEBKIT2
             /* Avoid a bug in WebKit */
             if (download.status == WebKit.DownloadStatus.CREATED)
                 return 0.0;
             return download.progress;
+#else
+            return 0.0;
+#endif
         }
 
 #if !HAVE_GLIB_2_30
@@ -49,6 +57,7 @@ namespace Midori {
 #endif
 
         public static string get_tooltip (WebKit.Download download) {
+#if !HAVE_WEBKIT2
             string filename = Path.get_basename (download.destination_uri);
             /* i18n: Download tooltip (size): 4KB of 43MB */
             string size = _("%s of %s").printf (
@@ -105,9 +114,13 @@ namespace Midori {
             }
 
             return "%s\n%s %s%s".printf (filename, size, speed, eta);
+#else
+            return "";
+#endif
         }
 
         public static string get_content_type (WebKit.Download download, string? mime_type) {
+#if !HAVE_WEBKIT2
             string? content_type = ContentType.guess (download.suggested_filename, null, null);
             if (content_type == null) {
                 content_type = ContentType.from_mime_type (mime_type);
@@ -115,9 +128,13 @@ namespace Midori {
                     content_type = ContentType.from_mime_type ("application/octet-stream");
             }
             return content_type;
+#else
+            return ContentType.from_mime_type ("application/octet-stream");
+#endif
         }
 
         public static bool has_wrong_checksum (WebKit.Download download) {
+#if !HAVE_WEBKIT2
             int status = download.get_data<int> ("checksum-status");
             if (status == 0) {
                 /* Link Fingerprint */
@@ -146,9 +163,13 @@ namespace Midori {
                 download.set_data<int> ("checksum-status", status);
             }
             return status == 1;
+#else
+            return false;
+#endif
         }
 
         public static bool action_clear (WebKit.Download download, Gtk.Widget widget) throws Error {
+#if !HAVE_WEBKIT2
             switch (download.status) {
                 case WebKit.DownloadStatus.CREATED:
                 case WebKit.DownloadStatus.STARTED:
@@ -165,10 +186,12 @@ namespace Midori {
                     warn_if_reached ();
                     break;
             }
+#endif
             return false;
         }
 
         public static string action_stock_id (WebKit.Download download) {
+#if !HAVE_WEBKIT2
             switch (download.status) {
                 case WebKit.DownloadStatus.CREATED:
                 case WebKit.DownloadStatus.STARTED:
@@ -186,9 +209,13 @@ namespace Midori {
                     warn_if_reached ();
                     return Gtk.Stock.MISSING_IMAGE;
             }
+#else
+            return Gtk.Stock.MISSING_IMAGE;
+#endif
         }
 
         public static bool open (WebKit.Download download, Gtk.Widget widget) throws Error {
+#if !HAVE_WEBKIT2
             if (!has_wrong_checksum (download))
                 return Sokoke.show_uri (widget.get_screen (),
                     download.destination_uri, Gtk.get_current_event_time ());
@@ -197,6 +224,7 @@ namespace Midori {
                 _("The downloaded file is erroneous."),
     _("The checksum provided with the link did not match. This means the file is probably incomplete or was modified afterwards."),
                 true);
+#endif
             return false;
         }
 
@@ -223,9 +251,13 @@ namespace Midori {
         }
 
         public string get_suggested_filename (WebKit.Download download) {
+#if !HAVE_WEBKIT2
             /* https://bugs.webkit.org/show_bug.cgi?id=83161
                https://d19vezwu8eufl6.cloudfront.net/nlp/slides%2F03-01-FormalizingNB.pdf */
             return clean_filename (download.get_suggested_filename ());
+#else
+            return "";
+#endif
         }
 
         public string get_filename_suggestion_for_uri (string mime_type, string uri) {
@@ -291,6 +323,7 @@ namespace Midori {
         }
 
         public static bool has_enough_space (WebKit.Download download, string uri) {
+#if !HAVE_WEBKIT2
             var folder = File.new_for_uri (uri).get_parent ();
             bool can_write;
             uint64 free_space;
@@ -324,6 +357,7 @@ namespace Midori {
                 Sokoke.message_dialog (Gtk.MessageType.ERROR, message, detailed_message, false);
                 return false;
             }
+#endif
             return true;
         }
     }
diff --git a/midori/midori-frontend.c b/midori/midori-frontend.c
index f481791..a578042 100644
--- a/midori/midori-frontend.c
+++ b/midori/midori-frontend.c
@@ -46,8 +46,9 @@ midori_web_app_new (const gchar* config,
                     const gchar* block_uris)
 {
     midori_paths_init (MIDORI_RUNTIME_MODE_APP, config);
+#ifndef HAVE_WEBKIT2
     g_object_set_data (G_OBJECT (webkit_get_default_session ()), "pass-through-console", (void*)1);
-
+#endif
     MidoriBrowser* browser = midori_browser_new ();
     g_signal_connect (browser, "new-window",
         G_CALLBACK (midori_frontend_browser_new_window_cb), NULL);
@@ -145,7 +146,9 @@ midori_private_app_new (const gchar* config,
                         const gchar* block_uris)
 {
     midori_paths_init (MIDORI_RUNTIME_MODE_PRIVATE, config);
+#ifndef HAVE_WEBKIT2
     g_object_set_data (G_OBJECT (webkit_get_default_session ()), "pass-through-console", (void*)1);
+#endif
 
     /* Mask the timezone, which can be read by Javascript */
     g_setenv ("TZ", "UTC", TRUE);
@@ -541,8 +544,10 @@ midori_normal_app_on_quit (MidoriApp* app)
     midori_history_on_quit (history, settings);
     midori_private_data_on_quit (settings);
     /* Removing KatzeHttpCookies makes it save outstanding changes */
+#ifndef HAVE_WEBKIT2
     soup_session_remove_feature_by_type (webkit_get_default_session (),
                                          KATZE_TYPE_HTTP_COOKIES);
+#endif
 
     MidoriStartup load_on_startup = katze_object_get_int (settings, "load-on-startup");
     if (load_on_startup < MIDORI_STARTUP_LAST_OPEN_PAGES)
diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c
index 52b96d3..70f46e5 100644
--- a/midori/midori-locationaction.c
+++ b/midori/midori-locationaction.c
@@ -1380,6 +1380,7 @@ midori_location_action_show_page_info (GtkWidget* widget,
                                        GtkBox*    box,
                                        GtkWidget* dialog)
 {
+#ifndef HAVE_WEBKIT2
     MidoriBrowser* browser = midori_browser_get_for_widget (widget);
     MidoriView* view = MIDORI_VIEW (midori_browser_get_current_tab (browser));
     WebKitWebView* web_view = WEBKIT_WEB_VIEW (midori_view_get_web_view (view));
@@ -1437,6 +1438,7 @@ midori_location_action_show_page_info (GtkWidget* widget,
     #endif
 
     g_object_unref (tls_cert);
+#endif
 }
 #endif
 
diff --git a/midori/midori-preferences.c b/midori/midori-preferences.c
index 0fe6c58..630c943 100644
--- a/midori/midori-preferences.c
+++ b/midori/midori-preferences.c
@@ -496,6 +496,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
         G_CALLBACK (midori_preferences_notify_proxy_type_cb), entry);
     midori_preferences_notify_proxy_type_cb (settings, NULL, entry);
     #if WEBKIT_CHECK_VERSION (1, 3, 11)
+#ifndef HAVE_WEBKIT2
     if (soup_session_get_feature (webkit_get_default_session (), SOUP_TYPE_CACHE))
     {
         label = gtk_label_new (_("Web Cache"));
@@ -508,6 +509,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
         gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
         SPANNED_ADD (label);
     }
+#endif
     #endif
     label = katze_property_label (settings, "identify-as");
     INDENTED_ADD (label);
diff --git a/midori/midori-privatedata.c b/midori/midori-privatedata.c
index 89fdce6..b323ae4 100644
--- a/midori/midori-privatedata.c
+++ b/midori/midori-privatedata.c
@@ -203,6 +203,7 @@ midori_remove_config_file (gint         clear_prefs,
 static void
 midori_clear_web_cookies_cb (void)
 {
+#ifndef HAVE_WEBKIT2
     SoupSession* session = webkit_get_default_session ();
     MidoriWebSettings* settings = g_object_get_data (G_OBJECT (session), "midori-settings");
     SoupSessionFeature* jar = soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR);
@@ -257,6 +258,7 @@ midori_clear_web_cookies_cb (void)
     webkit_application_cache_set_maximum_size (
         webkit_application_cache_get_maximum_size () - 1);
     #endif
+#endif
 }
 
 static void
@@ -281,6 +283,7 @@ midori_clear_saved_logins_cb (void)
 static void
 midori_clear_web_cache_cb (void)
 {
+#ifndef HAVE_WEBKIT2
     SoupSession* session = webkit_get_default_session ();
     SoupSessionFeature* feature = soup_session_get_feature (session, SOUP_TYPE_CACHE);
     gchar* cache = g_build_filename (midori_paths_get_cache_dir (), "web", NULL);
@@ -288,6 +291,7 @@ midori_clear_web_cache_cb (void)
     soup_cache_flush (SOUP_CACHE (feature));
     midori_paths_remove_path (cache);
     g_free (cache);
+#endif
 }
 #endif
 
diff --git a/midori/midori-searchaction.c b/midori/midori-searchaction.c
index 82fa2bf..dc98def 100644
--- a/midori/midori-searchaction.c
+++ b/midori/midori-searchaction.c
@@ -904,6 +904,7 @@ KatzeItem*
 midori_search_action_get_engine_for_form (WebKitWebView*     web_view,
                                           PangoEllipsizeMode ellipsize)
 {
+#ifndef HAVE_WEBKIT2
     #if WEBKIT_CHECK_VERSION (1, 5, 0)
     WebKitDOMDocument* doc;
     WebKitDOMHTMLFormElement* active_form;
@@ -1017,6 +1018,9 @@ midori_search_action_get_engine_for_form (WebKitWebView*     web_view,
     #else
     return NULL;
     #endif
+#else
+    return NULL;
+#endif
 }
 
 void
diff --git a/midori/midori-session.c b/midori/midori-session.c
index 4042106..67c81a9 100644
--- a/midori/midori-session.c
+++ b/midori/midori-session.c
@@ -154,6 +154,7 @@ midori_soup_session_settings_accept_language_cb (SoupSession*       session,
 gboolean
 midori_load_soup_session (gpointer settings)
 {
+#ifndef HAVE_WEBKIT2
     SoupSession* session = webkit_get_default_session ();
 
     #ifndef G_OS_WIN32
@@ -242,13 +243,14 @@ midori_load_soup_session (gpointer settings)
     }
 
     g_object_set_data (G_OBJECT (session), "midori-session-initialized", (void*)1);
-
+#endif
     return FALSE;
 }
 
 gboolean
 midori_load_soup_session_full (gpointer settings)
 {
+#ifndef HAVE_WEBKIT2
     SoupSession* session = webkit_get_default_session ();
     SoupCookieJar* jar;
     gchar* config_file;
@@ -299,7 +301,7 @@ midori_load_soup_session_full (gpointer settings)
     soup_cache_load (SOUP_CACHE (feature));
     #endif
     g_free (config_file);
-
+#endif
     return FALSE;
 }
 
diff --git a/midori/midori-settings.vala b/midori/midori-settings.vala
index 4580030..14999d8 100644
--- a/midori/midori-settings.vala
+++ b/midori/midori-settings.vala
@@ -19,8 +19,11 @@ namespace Midori {
         FULLSCREEN
     }
     /* Since: 0.1.3 */
-
+#if !HAVE_WEBKIT2
     public class Settings : WebKit.WebSettings {
+#else
+    public class Settings : WebKit.Settings {
+#endif
         public bool remember_last_window_size { get; set; default = true; }
         public int last_window_width { get; set; default = 0; }
         public int last_window_height { get; set; default = 0; }
@@ -43,6 +46,7 @@ namespace Midori {
         public string? block_uris { get {
             return block_uris_regex != null ? block_uris_regex.get_pattern () : null;
         } set {
+#if !HAVE_WEBKIT2
             if (value == null || value == "")
                 return;
             if (block_uris_regex == null)
@@ -56,6 +60,7 @@ namespace Midori {
             catch (Error error) {
                 critical ("block-uris: %s", error.message);
             }
+#endif
         } }
 
         public string? location_entry_search { get; set; default = null; }
diff --git a/midori/midori-speeddial.vala b/midori/midori-speeddial.vala
index e675944..899e3f2 100644
--- a/midori/midori-speeddial.vala
+++ b/midori/midori-speeddial.vala
@@ -334,6 +334,7 @@ namespace Midori {
         }
 
         void load_status (GLib.Object thumb_view_, ParamSpec pspec) {
+#if !HAVE_WEBKIT2
             if (thumb_view.load_status != WebKit.LoadStatus.FINISHED)
                 return;
 
@@ -356,9 +357,11 @@ namespace Midori {
             }
             else
                 /* disconnect_by_func (thumb_view, load_status) */;
+#endif
         }
 
         void get_thumb (string dial_id, string uri) {
+#if !HAVE_WEBKIT2
             if (thumb_view == null) {
                 thumb_view = new WebKit.WebView ();
                 var settings = new WebKit.WebSettings ();
@@ -395,6 +398,7 @@ namespace Midori {
             spec = thumb_queue.data;
             thumb_view.notify["load-status"].connect (load_status);
             thumb_view.load_uri (spec.uri);
+#endif
         }
     }
 }
diff --git a/midori/midori-tab.vala b/midori/midori-tab.vala
index 96b94e2..161300b 100644
--- a/midori/midori-tab.vala
+++ b/midori/midori-tab.vala
@@ -104,6 +104,7 @@ namespace Midori {
         }
 
         public void inject_stylesheet (string stylesheet) {
+#if !HAVE_WEBKIT2
             #if HAVE_DOM
             var dom = web_view.get_dom_document ();
             try {
@@ -129,9 +130,11 @@ namespace Midori {
                 }) ();
                 """.printf (stylesheet));
             #endif
+#endif
         }
 
         public bool can_view_source () {
+#if !HAVE_WEBKIT2
             if (is_blank () || special || web_view.get_view_source_mode ())
                 return false;
             string content_type = ContentType.from_mime_type (mime_type);
@@ -142,6 +145,9 @@ namespace Midori {
             string text_type = ContentType.from_mime_type ("text/plain");
 #endif
             return ContentType.is_a (content_type, text_type);
+#else
+            return true;
+#endif
         }
 
         public static string get_display_title (string? title, string uri) {
@@ -182,12 +188,14 @@ namespace Midori {
 
         /* Since: 0.4.3 */
         public bool can_save () {
+#if !HAVE_WEBKIT2
             if (is_blank () || special)
                 return false;
             if (web_view.get_view_source_mode ())
                 return false;
             if (web_view.get_main_frame ().get_data_source ().get_data () == null)
                 return false;
+#endif
             return true;
         }
 
@@ -207,15 +215,21 @@ namespace Midori {
         }
 
         public void unmark_text_matches () {
+#if !HAVE_WEBKIT2
             web_view.unmark_text_matches ();
+#endif
         }
 
         public bool find (string text, bool case_sensitive, bool forward) {
+#if !HAVE_WEBKIT2
             bool found = false;
             found = web_view.search_text (text, case_sensitive, forward, true);
             web_view.mark_text_matches (text, case_sensitive, 0);
             web_view.set_highlight_text_matches (true);
             return found;
+#else
+            return false;
+#endif
         }
     }
 }
diff --git a/midori/midori-view.c b/midori/midori-view.c
index a465768..082c7c4 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -81,7 +81,11 @@ midori_view_display_error (MidoriView*     view,
                            const gchar*    message,
                            const gchar*    description,
                            const gchar*    try_again,
+#ifndef HAVE_WEBKIT2
                            WebKitWebFrame* web_frame);
+#else
+                           void*           web_frame);
+#endif
 
 struct _MidoriView
 {
@@ -655,6 +659,7 @@ midori_view_update_load_status (MidoriView*      view,
     #endif
 }
 
+#ifndef HAVE_WEBKIT2
 static gboolean
 midori_view_web_view_navigation_decision_cb (WebKitWebView*             web_view,
                                              WebKitWebFrame*            web_frame,
@@ -764,10 +769,11 @@ midori_view_web_view_navigation_decision_cb (WebKitWebView*             web_view
         NULL);
     g_free (result);
     view->find_links = -1;
-
     return FALSE;
 }
+#endif
 
+#ifndef HAVE_WEBKIT2
 static void
 webkit_web_view_load_started_cb (WebKitWebView*  web_view,
                                  WebKitWebFrame* web_frame,
@@ -776,12 +782,14 @@ webkit_web_view_load_started_cb (WebKitWebView*  web_view,
     midori_view_update_load_status (view, MIDORI_LOAD_PROVISIONAL);
     midori_tab_set_progress (MIDORI_TAB (view), 0.0);
 }
+#endif
 
 #ifdef HAVE_GCR
 const gchar*
 midori_location_action_tls_flags_to_string (GTlsCertificateFlags flags);
 #endif
 
+#ifndef HAVE_WEBKIT2
 static void
 webkit_web_view_load_committed_cb (WebKitWebView*  web_view,
                                    WebKitWebFrame* web_frame,
@@ -881,8 +889,8 @@ webkit_web_view_load_committed_cb (WebKitWebView*  web_view,
     midori_view_update_load_status (view, MIDORI_LOAD_COMMITTED);
 
     g_object_thaw_notify (G_OBJECT (view));
-
 }
+#endif
 
 static void
 webkit_web_view_progress_changed_cb (WebKitWebView* web_view,
@@ -892,6 +900,7 @@ webkit_web_view_progress_changed_cb (WebKitWebView* web_view,
     midori_tab_set_progress (MIDORI_TAB (view), progress ? progress / 100.0 : 0.0);
 }
 
+#ifndef HAVE_WEBKIT2
 static void
 midori_view_web_view_resource_request_cb (WebKitWebView*         web_view,
                                           WebKitWebFrame*        web_frame,
@@ -999,6 +1008,7 @@ midori_view_web_view_resource_request_cb (WebKitWebView*         web_view,
         }
     }
 }
+#endif
 
 #define HAVE_GTK_INFO_BAR GTK_CHECK_VERSION (2, 18, 0)
 
@@ -1122,6 +1132,7 @@ midori_view_add_info_bar (MidoriView*    view,
     return infobar;
 }
 
+#ifndef HAVE_WEBKIT2
 static void
 midori_view_database_response_cb (GtkWidget*         infobar,
                                   gint               response,
@@ -1202,13 +1213,19 @@ midori_view_web_view_geolocation_decision_cb (WebKitWebView*                   w
     return TRUE;
 }
 #endif
+#endif
 
 void
 midori_view_set_html (MidoriView*     view,
                       const gchar*    data,
                       const gchar*    uri,
+#ifndef HAVE_WEBKIT2
                       WebKitWebFrame* web_frame)
+#else
+                      void*           web_frame)
+#endif
 {
+#ifndef HAVE_WEBKIT2
     g_return_if_fail (MIDORI_IS_VIEW (view));
     g_return_if_fail (data != NULL);
 
@@ -1221,6 +1238,7 @@ midori_view_set_html (MidoriView*     view,
     midori_tab_set_special (MIDORI_TAB (view), TRUE);
     webkit_web_frame_load_alternate_string (
         web_frame, data, uri, uri);
+#endif
 }
 
 static gboolean
@@ -1230,7 +1248,11 @@ midori_view_display_error (MidoriView*     view,
                            const gchar*    message,
                            const gchar*    description,
                            const gchar*    try_again,
+#ifndef HAVE_WEBKIT2
                            WebKitWebFrame* web_frame)
+#else
+                           void*           web_frame)
+#endif
 {
     gchar* path = midori_paths_get_res_filename ("error.html");
     gchar* template;
@@ -1279,6 +1301,7 @@ midori_view_display_error (MidoriView*     view,
     return FALSE;
 }
 
+#ifndef HAVE_WEBKIT2
 static gboolean
 webkit_web_view_load_error_cb (WebKitWebView*  web_view,
                                WebKitWebFrame* web_frame,
@@ -1310,6 +1333,7 @@ webkit_web_view_load_error_cb (WebKitWebView*  web_view,
     g_free (title);
     return result;
 }
+#endif
 
 static void
 midori_view_apply_scroll_position (MidoriView* view)
@@ -1336,6 +1360,7 @@ midori_view_apply_scroll_position (MidoriView* view)
     }
 }
 
+#ifndef HAVE_WEBKIT2
 static void
 webkit_web_view_load_finished_cb (WebKitWebView*  web_view,
                                   WebKitWebFrame* web_frame,
@@ -1443,6 +1468,7 @@ webkit_web_view_load_finished_cb (WebKitWebView*  web_view,
 
     g_object_thaw_notify (G_OBJECT (view));
 }
+#endif
 
 #if WEBKIT_CHECK_VERSION (1, 1, 18)
 static void
@@ -1450,9 +1476,11 @@ midori_web_view_notify_icon_uri_cb (WebKitWebView* web_view,
                                     GParamSpec*    pspec,
                                     MidoriView*    view)
 {
+#ifndef HAVE_WEBKIT2
     const gchar* icon_uri = webkit_web_view_get_icon_uri (web_view);
     katze_assign (view->icon_uri, g_strdup (icon_uri));
     _midori_web_view_load_icon (view);
+#endif
 }
 #endif
 
@@ -1525,6 +1553,7 @@ midori_view_ensure_link_uri (MidoriView* view,
                              gint        *y,
                              GdkEventButton* event)
 {
+#ifndef HAVE_WEBKIT2
     g_return_if_fail (MIDORI_IS_VIEW (view));
 
     if (gtk_widget_get_window (view->web_view))
@@ -1551,6 +1580,7 @@ midori_view_ensure_link_uri (MidoriView* view,
         katze_assign (view->link_uri,
              katze_object_get_string (view->hit_test, "link-uri"));
     }
+#endif
 }
 
 #define MIDORI_KEYS_MODIFIER_MASK (GDK_SHIFT_MASK | GDK_CONTROL_MASK \
@@ -1561,6 +1591,7 @@ midori_view_web_view_button_press_event_cb (WebKitWebView*  web_view,
                                             GdkEventButton* event,
                                             MidoriView*     view)
 {
+#ifndef HAVE_WEBKIT2
     GtkClipboard* clipboard;
     gchar* uri;
     gchar* new_uri;
@@ -1716,7 +1747,7 @@ midori_view_web_view_button_press_event_cb (WebKitWebView*  web_view,
 
     /* We propagate the event, since it may otherwise be stuck in WebKit */
     g_signal_emit_by_name (view, "event", event, &background);
-
+#endif
     return FALSE;
 }
 
@@ -1748,6 +1779,7 @@ handle_link_hints (WebKitWebView* web_view,
                    GdkEventKey*   event,
                    MidoriView*    view)
 {
+#ifndef HAVE_WEBKIT2
     gint digit = g_ascii_digit_value (event->keyval);
     gunichar uc = gdk_keyval_to_unicode (event->keyval);
     gchar* result = NULL;
@@ -1890,6 +1922,7 @@ handle_link_hints (WebKitWebView* web_view,
     if (result)
         g_free (result);
     return;
+#endif
 }
 
 static gboolean
@@ -1897,6 +1930,7 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
                                GdkEventKey*   event,
                                MidoriView*    view)
 {
+#ifndef HAVE_WEBKIT2
     guint character;
 
     event->state = event->state & MIDORI_KEYS_MODIFIER_MASK;
@@ -1937,7 +1971,7 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
         g_free (text);
         return TRUE;
     }
-
+#endif
     return FALSE;
 }
 
@@ -1991,12 +2025,14 @@ midori_view_download_uri (MidoriView*        view,
                           MidoriDownloadType type,
                           const gchar*       uri)
 {
+#ifndef HAVE_WEBKIT2
     WebKitNetworkRequest* request = webkit_network_request_new (uri);
     WebKitDownload* download = webkit_download_new (request);
     gboolean handled;
     g_object_unref (request);
     midori_download_set_type (download, type);
     g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled);
+#endif
 }
 
 static void
@@ -2019,6 +2055,7 @@ midori_web_view_menu_image_new_tab_activate_cb (GtkWidget*  widget,
 GList*
 midori_view_get_resources (MidoriView* view)
 {
+#ifndef HAVE_WEBKIT2
     g_return_val_if_fail (MIDORI_IS_VIEW (view), NULL);
 
     WebKitWebView* web_view = WEBKIT_WEB_VIEW (view->web_view);
@@ -2026,6 +2063,9 @@ midori_view_get_resources (MidoriView* view)
     WebKitWebDataSource* data_source = webkit_web_frame_get_data_source (frame);
     GList* resources = webkit_web_data_source_get_subresources (data_source);
     return g_list_prepend (resources, webkit_web_data_source_get_main_resource (data_source));
+#else
+    return NULL;
+#endif
 }
 
 static GString*
@@ -2036,6 +2076,7 @@ midori_view_get_data_for_uri (MidoriView*  view,
     GList* list;
     GString* result = NULL;
 
+#ifndef HAVE_WEBKIT2
     for (list = resources; list; list = g_list_next (list))
     {
         WebKitWebResource* resource = WEBKIT_WEB_RESOURCE (list->data);
@@ -2046,6 +2087,7 @@ midori_view_get_data_for_uri (MidoriView*  view,
             break;
         }
     }
+#endif
     g_list_free (resources);
     return result;
 }
@@ -2211,15 +2253,18 @@ static void
 midori_web_view_open_frame_in_new_tab_cb (GtkWidget*  widget,
                                           MidoriView* view)
 {
+#ifndef HAVE_WEBKIT2
     WebKitWebFrame* web_frame = webkit_web_view_get_focused_frame (WEBKIT_WEB_VIEW (view->web_view));
     g_signal_emit (view, signals[NEW_TAB], 0,
         webkit_web_frame_get_uri (web_frame), view->open_tabs_in_the_background);
+#endif
 }
 
 static void
 midori_web_view_menu_inspect_element_activate_cb (GtkWidget*  widget,
                                                   MidoriView* view)
 {
+#ifndef HAVE_WEBKIT2
     WebKitWebInspector* inspector;
     gint x, y;
 
@@ -2228,6 +2273,7 @@ midori_web_view_menu_inspect_element_activate_cb (GtkWidget*  widget,
     y = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "y"));
     webkit_web_inspector_inspect_coordinates (inspector, x, y);
     webkit_web_inspector_show (inspector);
+#endif
 }
 
 #if WEBKIT_CHECK_VERSION (1, 5, 0)
@@ -2301,6 +2347,7 @@ midori_view_populate_popup (MidoriView* view,
                             GtkWidget*  menu,
                             gboolean    manual)
 {
+#ifndef HAVE_WEBKIT2
     g_return_if_fail (MIDORI_IS_VIEW (view));
     g_return_if_fail (GTK_IS_MENU_SHELL (menu));
 
@@ -2723,6 +2770,7 @@ midori_view_populate_popup (MidoriView* view,
     }
 
     gtk_widget_show_all (menu);
+#endif
 }
 
 static void
@@ -2759,6 +2807,7 @@ webkit_web_view_web_view_ready_cb (GtkWidget*  web_view,
     return TRUE;
 }
 
+#ifndef HAVE_WEBKIT2
 static GtkWidget*
 webkit_web_view_create_web_view_cb (GtkWidget*      web_view,
                                     WebKitWebFrame* web_frame,
@@ -2810,12 +2859,14 @@ webkit_web_view_mime_type_decision_cb (GtkWidget*               web_view,
     g_object_set_data(G_OBJECT (view), "download-mime-type", NULL);
     return TRUE;
 }
+#endif
 
 static gboolean
 webkit_web_view_download_requested_cb (GtkWidget*      web_view,
                                        WebKitDownload* download,
                                        MidoriView*     view)
 {
+#ifndef HAVE_WEBKIT2
     gchar* opener_uri;
     gchar* hostname;
     GtkWidget* dialog;
@@ -2933,6 +2984,9 @@ webkit_web_view_download_requested_cb (GtkWidget*      web_view,
 
     g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled);
     return handled;
+#else
+    return FALSE;
+#endif
 }
 
 static gboolean
@@ -2942,6 +2996,7 @@ webkit_web_view_console_message_cb (GtkWidget*   web_view,
                                     const gchar* source_id,
                                     MidoriView*  view)
 {
+#ifndef HAVE_WEBKIT2
     if (g_object_get_data (G_OBJECT (webkit_get_default_session ()),
                            "pass-through-console"))
         return FALSE;
@@ -2961,6 +3016,9 @@ webkit_web_view_console_message_cb (GtkWidget*   web_view,
     else
         g_signal_emit_by_name (view, "console-message", message, line, source_id);
     return TRUE;
+#else
+    return FALSE;
+#endif
 }
 
 static void
@@ -2971,6 +3029,7 @@ midori_view_script_response_cb (GtkWidget*  infobar,
     view->alerts--;
 }
 
+#ifndef HAVE_WEBKIT2
 static gboolean
 midori_view_web_view_script_alert_cb (GtkWidget*      web_view,
                                       WebKitWebFrame* web_frame,
@@ -3033,6 +3092,7 @@ webkit_web_view_window_object_cleared_cb (GtkWidget*      web_view,
         g_free (result);
     }
 }
+#endif
 
 static void
 midori_view_hadjustment_notify_value_cb (GtkAdjustment* hadjustment,
@@ -3591,6 +3651,7 @@ midori_view_constructor (GType                  type,
 
     view->web_view = GTK_WIDGET (midori_tab_get_web_view (MIDORI_TAB (view)));
     g_object_connect (view->web_view,
+                      #ifndef HAVE_WEBKIT2
                       "signal::navigation-policy-decision-requested",
                       midori_view_web_view_navigation_decision_cb, view,
                       "signal::resource-request-starting",
@@ -3605,10 +3666,13 @@ midori_view_constructor (GType                  type,
                       webkit_web_view_load_started_cb, view,
                       "signal::load-committed",
                       webkit_web_view_load_committed_cb, view,
+                      #endif
                       "signal::load-progress-changed",
                       webkit_web_view_progress_changed_cb, view,
+                      #ifndef HAVE_WEBKIT2
                       "signal::load-finished",
                       webkit_web_view_load_finished_cb, view,
+                      #endif
                       #if WEBKIT_CHECK_VERSION (1, 1, 18)
                       "signal::notify::icon-uri",
                       midori_web_view_notify_icon_uri_cb, view,
@@ -3635,6 +3699,7 @@ midori_view_constructor (GType                  type,
                       webkit_web_view_populate_popup_cb, view,
                       "signal::console-message",
                       webkit_web_view_console_message_cb, view,
+                      #ifndef HAVE_WEBKIT2
                       "signal::script-alert",
                       midori_view_web_view_script_alert_cb, view,
                       "signal::window-object-cleared",
@@ -3643,12 +3708,15 @@ midori_view_constructor (GType                  type,
                       webkit_web_view_create_web_view_cb, view,
                       "signal-after::mime-type-policy-decision-requested",
                       webkit_web_view_mime_type_decision_cb, view,
+                      #endif
                       "signal::download-requested",
                       webkit_web_view_download_requested_cb, view,
+                      #ifndef HAVE_WEBKIT2
                       "signal::print-requested",
                       midori_view_web_view_print_requested_cb, view,
                       "signal-after::load-error",
                       webkit_web_view_load_error_cb, view,
+                      #endif
                       NULL);
 
     if (view->settings)
@@ -3845,6 +3913,7 @@ void
 midori_view_set_uri (MidoriView*  view,
                      const gchar* uri)
 {
+#ifndef HAVE_WEBKIT2
     gchar* data;
 
     g_return_if_fail (MIDORI_IS_VIEW (view));
@@ -4088,6 +4157,7 @@ midori_view_set_uri (MidoriView*  view,
             webkit_web_view_load_uri (WEBKIT_WEB_VIEW (view->web_view), uri);
         }
     }
+#endif
 }
 
 /**
@@ -4259,6 +4329,7 @@ midori_view_get_link_uri (MidoriView* view)
 gboolean
 midori_view_has_selection (MidoriView* view)
 {
+#ifndef HAVE_WEBKIT2
 #if WEBKIT_CHECK_VERSION (1, 4, 3)
     WebKitDOMDocument* doc;
     WebKitDOMDOMWindow* window;
@@ -4291,6 +4362,9 @@ midori_view_has_selection (MidoriView* view)
         return TRUE;
     else
         return FALSE;
+#else
+    return FALSE;
+#endif
 }
 
 /**
@@ -4916,6 +4990,7 @@ midori_view_save_source (MidoriView* view,
                          const gchar* uri,
                          const gchar* outfile)
 {
+#ifndef HAVE_WEBKIT2
     WebKitWebFrame *frame;
     WebKitWebDataSource *data_source;
     const GString *data;
@@ -4969,6 +5044,9 @@ midori_view_save_source (MidoriView* view,
         close (fd);
     }
     return unique_filename;
+#else
+    return NULL;
+#endif
 }
 
 /**
@@ -5044,12 +5122,14 @@ void
 midori_view_go_back_or_forward (MidoriView* view,
                                 gint        steps)
 {
+#ifndef HAVE_WEBKIT2
     g_return_if_fail (MIDORI_IS_VIEW (view));
 
     webkit_web_view_go_back_or_forward (WEBKIT_WEB_VIEW (view->web_view), steps);
     /* Force the speed dial to kick in if going back to a blank page */
     if (midori_view_is_blank (view))
         midori_view_set_uri (view, "");
+#endif
 }
 
 /**
@@ -5065,12 +5145,16 @@ gboolean
 midori_view_can_go_back_or_forward (MidoriView* view,
                                     gint        steps)
 {
+#ifndef HAVE_WEBKIT2
     g_return_val_if_fail (MIDORI_IS_VIEW (view), FALSE);
 
     if (view->web_view)
         return webkit_web_view_can_go_back_or_forward (WEBKIT_WEB_VIEW (view->web_view), steps);
     else
         return FALSE;
+#else
+    return FALSE;
+#endif
 }
 
 static gchar*
@@ -5078,6 +5162,7 @@ midori_view_get_related_page (MidoriView*  view,
                               const gchar* rel,
                               const gchar* local)
 {
+#ifndef HAVE_WEBKIT2
     gchar* script;
     static gchar* uri = NULL;
     WebKitWebFrame* web_frame;
@@ -5102,6 +5187,9 @@ midori_view_get_related_page (MidoriView*  view,
     katze_assign (uri, sokoke_js_script_eval (js_context, script, NULL));
     g_free (script);
     return uri && uri[0] != '0' ? uri : NULL;
+#else
+    return NULL;
+#endif
 }
 
 /**
@@ -5169,6 +5257,7 @@ midori_view_print_create_custom_widget_cb (GtkPrintOperation* operation,
 void
 midori_view_print (MidoriView* view)
 {
+#ifndef HAVE_WEBKIT2
     WebKitWebFrame* frame;
     GtkPrintOperation* operation;
     GError* error;
@@ -5201,6 +5290,7 @@ midori_view_print (MidoriView* view)
             G_CALLBACK (gtk_widget_destroy), dialog);
         gtk_widget_show (dialog);
     }
+#endif
 }
 
 /**
@@ -5247,6 +5337,7 @@ midori_view_execute_script (MidoriView*  view,
                             const gchar* script,
                             gchar**      exception)
 {
+#ifndef HAVE_WEBKIT2
     WebKitWebFrame* web_frame;
     JSContextRef js_context;
     gchar* script_decoded;
@@ -5268,6 +5359,9 @@ midori_view_execute_script (MidoriView*  view,
     success = result != NULL;
     g_free (result);
     return success;
+#else
+    return FALSE;
+#endif
 }
 
 /**
diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c
index 781b978..212c785 100644
--- a/midori/midori-websettings.c
+++ b/midori/midori-websettings.c
@@ -720,8 +720,13 @@ generate_ident_string (MidoriWebSettings* web_settings,
     gchar* platform;
     const gchar* os = midori_web_settings_get_system_name (NULL, &platform);
 
+    #ifndef HAVE_WEBKIT2
     const int webcore_major = WEBKIT_USER_AGENT_MAJOR_VERSION;
     const int webcore_minor = WEBKIT_USER_AGENT_MINOR_VERSION;
+    #else
+    const int webcore_major = WEBKIT_MAJOR_VERSION;
+    const int webcore_minor = WEBKIT_MINOR_VERSION;
+    #endif
 
     #if WEBKIT_CHECK_VERSION (1, 1, 18)
     g_object_set (web_settings, "enable-site-specific-quirks",
diff --git a/midori/sokoke.c b/midori/sokoke.c
index 5da6cb3..c61defb 100644
--- a/midori/sokoke.c
+++ b/midori/sokoke.c
@@ -945,7 +945,11 @@ sokoke_gtk_action_count_modifiers (GtkAction* action)
 gboolean
 sokoke_prefetch_uri (MidoriWebSettings*  settings,
                      const char*         uri,
+#ifndef HAVE_WEBKIT2
                      SoupAddressCallback callback,
+#else
+                     void*               callback,
+#endif
                      gpointer            user_data)
 {
     #define MAXHOSTS 50
@@ -984,10 +988,15 @@ sokoke_prefetch_uri (MidoriWebSettings*  settings,
         new_hosts = g_strdup_printf ("%s|%s", hosts, hostname);
         katze_assign (hosts, new_hosts);
     }
+#ifndef HAVE_WEBKIT2
     else if (callback)
         callback (NULL, SOUP_STATUS_OK, user_data);
     g_free (hostname);
     return TRUE;
+#else
+    g_free (hostname);
+    return FALSE;
+#endif
 }
 
 /**
diff --git a/midori/sokoke.h b/midori/sokoke.h
index e076c5c..5d65eb6 100644
--- a/midori/sokoke.h
+++ b/midori/sokoke.h
@@ -106,7 +106,11 @@ sokoke_gtk_action_count_modifiers       (GtkAction* action);
 gboolean
 sokoke_prefetch_uri                     (MidoriWebSettings*  settings,
                                          const char*         uri,
+#ifndef HAVE_WEBKIT2
                                          SoupAddressCallback callback,
+#else
+                                         void*               callback,
+#endif
                                          gpointer            user_data);
 
 gboolean
diff --git a/panels/midori-transfers.c b/panels/midori-transfers.c
index c7dc45a..a4f222c 100644
--- a/panels/midori-transfers.c
+++ b/panels/midori-transfers.c
@@ -362,6 +362,7 @@ static void
 midori_transfers_open_activate_cb (GtkWidget*       menuitem,
                                    MidoriTransfers* transfers)
 {
+#ifndef HAVE_WEBKIT2
     WebKitDownload* download;
     const gchar* uri;
 
@@ -371,12 +372,14 @@ midori_transfers_open_activate_cb (GtkWidget*       menuitem,
     uri = webkit_download_get_destination_uri (download);
     sokoke_show_uri (gtk_widget_get_screen (GTK_WIDGET (transfers->treeview)),
                      uri, gtk_get_current_event_time (), NULL);
+#endif
 }
 
 static void
 midori_transfers_open_folder_activate_cb (GtkWidget*       menuitem,
                                           MidoriTransfers* transfers)
 {
+#ifndef HAVE_WEBKIT2
     WebKitDownload* download;
     const gchar* uri;
     GFile* file;
@@ -396,12 +399,14 @@ midori_transfers_open_folder_activate_cb (GtkWidget*       menuitem,
         g_object_unref (folder);
     }
     g_object_unref (file);
+#endif
 }
 
 static void
 midori_transfers_copy_address_activate_cb (GtkWidget*       menuitem,
                                            MidoriTransfers* transfers)
 {
+#ifndef HAVE_WEBKIT2
     WebKitDownload* download;
     const gchar* uri;
     GtkClipboard* clipboard;
@@ -414,6 +419,7 @@ midori_transfers_copy_address_activate_cb (GtkWidget*       menuitem,
         gtk_widget_get_display (GTK_WIDGET (menuitem)),
         GDK_SELECTION_CLIPBOARD);
     gtk_clipboard_set_text (clipboard, uri, -1);
+#endif
 }
 
 static void
@@ -422,6 +428,7 @@ midori_transfers_popup (GtkWidget*       widget,
                         WebKitDownload*  download,
                         MidoriTransfers* transfers)
 {
+#ifndef HAVE_WEBKIT2
     GtkWidget* menu;
     gboolean finished = FALSE;
 
@@ -439,6 +446,7 @@ midori_transfers_popup (GtkWidget*       widget,
         midori_transfers_copy_address_activate_cb, TRUE, transfers);
 
     katze_widget_popup (widget, GTK_MENU (menu), event, KATZE_MENU_POSITION_CURSOR);
+#endif
 }
 
 static gboolean
diff --git a/toolbars/midori-transferbar.c b/toolbars/midori-transferbar.c
index 81ad85a..c4db861 100644
--- a/toolbars/midori-transferbar.c
+++ b/toolbars/midori-transferbar.c
@@ -88,6 +88,7 @@ midori_transferbar_download_notify_status_cb (WebKitDownload* download,
                                               GParamSpec*     pspec,
                                               TransferInfo*   info)
 {
+#ifndef HAVE_WEBKIT2
     GtkWidget* button = info->button;
 
     const gchar* stock_id = midori_download_action_stock_id (download);
@@ -123,6 +124,7 @@ midori_transferbar_download_notify_status_cb (WebKitDownload* download,
                  gtk_recent_manager_add_item (gtk_recent_manager_get_default (),
                     webkit_download_get_destination_uri (download));
     }
+#endif
 }
 
 static void
@@ -138,6 +140,7 @@ void
 midori_transferbar_check_size (GtkWidget* statusbar,
                                MidoriTransferbar* transferbar)
 {
+#ifndef HAVE_WEBKIT2
   GtkWidget* window;
   GtkRequisition req;
   gint reqwidth, winwidth;
@@ -157,12 +160,14 @@ midori_transferbar_check_size (GtkWidget* statusbar,
           gtk_widget_destroy (info->button);
     }
   }
+#endif
 }
 
 void
 midori_transferbar_add_download_item (MidoriTransferbar* transferbar,
                                       WebKitDownload*    download)
 {
+#ifndef HAVE_WEBKIT2
     GtkWidget* box;
     GtkWidget* icon;
     GtkToolItem* toolitem;
@@ -213,6 +218,7 @@ midori_transferbar_add_download_item (MidoriTransferbar* transferbar,
         G_CALLBACK (midori_transferbar_download_notify_status_cb), info);
     g_signal_connect (button, "clicked",
         G_CALLBACK (midori_transferbar_download_button_clicked_cb), info);
+#endif
 }
 
 static void


More information about the Xfce4-commits mailing list