[Xfce4-commits] <midori:master> Allow building with GTK+3

Christian Dywan noreply at xfce.org
Fri Oct 7 20:30:02 CEST 2011


Updating branch refs/heads/master
         to b5aad2d17650ba11677d397cc890ba0787f74ebb (commit)
       from b46db9b1708291def5876a0d3522598f3c9785da (commit)

commit b5aad2d17650ba11677d397cc890ba0787f74ebb
Author: Lucas Baudin <xapantu at gmail.com>
Date:   Sat Oct 1 15:12:04 2011 +0200

    Allow building with GTK+3
    
    Fixes: https://bugs.launchpad.net/midori/+bug/861351

 extensions/adblock.c                            |   37 ++
 extensions/cookie-manager/cookie-manager-page.c |    3 +-
 extensions/cookie-manager/cookie-manager.c      |    2 +-
 extensions/feed-panel/feed-panel.c              |    4 +
 extensions/feed-panel/main.c                    |   12 +
 extensions/history-list.vala                    |   22 +-
 extensions/shortcuts.c                          |   20 +-
 extensions/toolbar-editor.c                     |    6 +
 extensions/wscript_build                        |    6 +-
 katze/gtk3-compat.h                             |   45 ++
 katze/katze-http-auth.c                         |    4 +
 katze/katze-preferences.c                       |    2 +
 katze/katze-throbber.c                          |   90 +++-
 katze/katze-utils.c                             |   28 +-
 midori/midori-browser.c                         |   56 ++-
 midori/midori-locationaction.c                  |   52 +-
 midori/midori-panel.c                           |    2 +
 midori/midori-searchaction.c                    |   19 +-
 midori/midori-view.c                            |   27 +-
 midori/sokoke.c                                 |   11 +-
 midori/webkitgtk-3.0.deps                       |    8 +
 midori/webkitgtk-3.0.vapi                       |  653 +++++++++++++++++++++++
 panels/midori-bookmarks.c                       |    3 +-
 panels/midori-history.c                         |    3 +-
 toolbars/midori-findbar.c                       |    5 +-
 wscript                                         |   17 +-
 26 files changed, 1045 insertions(+), 92 deletions(-)

diff --git a/extensions/adblock.c b/extensions/adblock.c
index 9fcad6e..9969de1 100644
--- a/extensions/adblock.c
+++ b/extensions/adblock.c
@@ -417,7 +417,11 @@ adblock_get_preferences_dialog (MidoriExtension* extension)
 
     dialog_title = _("Configure Advertisement filters");
     dialog = gtk_dialog_new_with_buttons (dialog_title, GTK_WINDOW (browser),
+#if GTK_CHECK_VERSION(3,0,0)
+        GTK_DIALOG_DESTROY_WITH_PARENT,
+#else
         GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+#endif
         #if !HAVE_OSX
         #if !HAVE_HILDON
         GTK_STOCK_HELP, GTK_RESPONSE_HELP,
@@ -438,11 +442,19 @@ adblock_get_preferences_dialog (MidoriExtension* extension)
     /* TODO: We need mnemonics */
     if ((xfce_heading = sokoke_xfce_header_new (
         gtk_window_get_icon_name (GTK_WINDOW (dialog)), dialog_title)))
+#if GTK_CHECK_VERSION(3,0,0)
+        gtk_box_pack_start (gtk_dialog_get_content_area (GTK_DIALOG (dialog)),
+                            xfce_heading, FALSE, FALSE, 0);
+    hbox = gtk_hbox_new (FALSE, 0);
+    gtk_box_pack_start (gtk_dialog_get_content_area (GTK_DIALOG (dialog)), hbox,
+                                 TRUE, TRUE, 12);
+#else
         gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
                             xfce_heading, FALSE, FALSE, 0);
     hbox = gtk_hbox_new (FALSE, 0);
     gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox,
                                  TRUE, TRUE, 12);
+#endif
     vbox = gtk_vbox_new (FALSE, 0);
     gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 4);
     button = gtk_label_new (NULL);
@@ -553,10 +565,19 @@ adblock_get_preferences_dialog (MidoriExtension* extension)
         G_CALLBACK (adblock_preferences_help_clicked_cb), dialog); */
     gtk_box_pack_end (GTK_BOX (hbox),
         button, FALSE, FALSE, 4);
+#if GTK_CHECK_VERSION(3,0,0)
+    gtk_box_pack_end (gtk_dialog_get_content_area(GTK_DIALOG (dialog)),
+        hbox, FALSE, FALSE, 0);
+#else
     gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox),
         hbox, FALSE, FALSE, 0);
+#endif
     #endif
+#if GTK_CHECK_VERSION(3,0,0)
+    gtk_widget_show_all (gtk_dialog_get_content_area(GTK_DIALOG (dialog)));
+#else
     gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
+#endif
 
     g_object_unref (browser);
 
@@ -818,13 +839,21 @@ adblock_custom_block_image_cb (GtkWidget*       widget,
 
     title = _("Edit rule");
     dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (browser),
+#if GTK_CHECK_VERSION(3,0,0)
+            GTK_DIALOG_DESTROY_WITH_PARENT,
+#else
             GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+#endif
             GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
             GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,
             NULL);
     gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_ADD);
     gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+#if GTK_CHECK_VERSION(3,0,0)
+    gtk_container_set_border_width (gtk_dialog_get_content_area (GTK_DIALOG (dialog)), 5);
+#else
     gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 5);
+#endif
     sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
     hbox = gtk_hbox_new (FALSE, 8);
@@ -837,7 +866,11 @@ adblock_custom_block_image_cb (GtkWidget*       widget,
     gtk_entry_set_text (GTK_ENTRY (entry),
                         g_object_get_data (G_OBJECT (widget), "uri"));
     gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
+#if GTK_CHECK_VERSION(3,0,0)
+    gtk_container_add (gtk_dialog_get_content_area (GTK_DIALOG (dialog)), hbox);
+#else
     gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
+#endif
     gtk_widget_show_all (hbox);
 
     gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
@@ -875,7 +908,11 @@ adblock_populate_popup_cb (WebKitWebView*   web_view,
     WebKitHitTestResultContext context;
     WebKitHitTestResult* hit_test;
 
+#if GTK_CHECK_VERSION(3,0,0)
+    gdk_window_get_pointer (gtk_widget_get_window(GTK_WIDGET (web_view)), &x, &y, NULL);
+#else
     gdk_window_get_pointer (GTK_WIDGET (web_view)->window, &x, &y, NULL);
+#endif
     event.x = x;
     event.y = y;
     hit_test = webkit_web_view_get_hit_test_result (web_view, &event);
diff --git a/extensions/cookie-manager/cookie-manager-page.c b/extensions/cookie-manager/cookie-manager-page.c
index 1db5d50..70947dd 100644
--- a/extensions/cookie-manager/cookie-manager-page.c
+++ b/extensions/cookie-manager/cookie-manager-page.c
@@ -14,6 +14,7 @@
 
 #include <midori/midori.h>
 #include <midori/gtkiconentry.h>
+#include "katze/gtk3-compat.h"
 #include <webkit/webkit.h>
 #include <time.h>
 
@@ -944,7 +945,7 @@ static gboolean cm_tree_button_release_event_cb(GtkWidget *widget, GdkEventButto
 
 static gboolean cm_tree_key_press_cb(GtkWidget *widget, GdkEventKey *event, CookieManagerPage *cmp)
 {
-	if (event->keyval == GDK_Delete && !
+	if (event->keyval == GDK_KEY_Delete && !
 		(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)))
 	{
 		cm_delete_item(cmp);
diff --git a/extensions/cookie-manager/cookie-manager.c b/extensions/cookie-manager/cookie-manager.c
index 70a4f7a..b2a1153 100644
--- a/extensions/cookie-manager/cookie-manager.c
+++ b/extensions/cookie-manager/cookie-manager.c
@@ -114,7 +114,7 @@ static void cookie_manager_panel_pages_foreach(gpointer ptr, gpointer data)
 }
 
 
-static void cookie_manager_page_destroy_cb(GtkObject *page, CookieManager *cm)
+static void cookie_manager_page_destroy_cb(GObject *page, CookieManager *cm)
 {
 	CookieManagerPrivate *priv = COOKIE_MANAGER_GET_PRIVATE(cm);
 
diff --git a/extensions/feed-panel/feed-panel.c b/extensions/feed-panel/feed-panel.c
index 052ca85..576088c 100644
--- a/extensions/feed-panel/feed-panel.c
+++ b/extensions/feed-panel/feed-panel.c
@@ -844,7 +844,11 @@ feed_panel_init (FeedPanel* panel)
     gtk_widget_show (treeview);
 
     webview = webkit_web_view_new ();
+#if GTK_CHECK_VERSION(3,0,0)
+    font_desc = gtk_style_context_get_font(gtk_widget_get_style_context(treeview), GTK_STATE_FLAG_NORMAL);
+#else
     font_desc = treeview->style->font_desc;
+#endif
     family = pango_font_description_get_family (font_desc);
     size = pango_font_description_get_size (font_desc) / PANGO_SCALE;
     settings = webkit_web_settings_new ();
diff --git a/extensions/feed-panel/main.c b/extensions/feed-panel/main.c
index ba9c685..39b2e60 100644
--- a/extensions/feed-panel/main.c
+++ b/extensions/feed-panel/main.c
@@ -363,13 +363,21 @@ panel_add_feed_cb (FeedPanel*   panel,
 
     dialog = gtk_dialog_new_with_buttons (
             _("New feed"), GTK_WINDOW (priv->browser),
+#if GTK_CHECK_VERSION(3,0,0)
+            GTK_DIALOG_DESTROY_WITH_PARENT,
+#else
             GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+#endif
             GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
             GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,
             NULL);
     gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_ADD);
     gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+#if GTK_CHECK_VERSION(3,0,0)
+    gtk_container_set_border_width (GTK_CONTAINER(gtk_dialog_get_content_area( GTK_DIALOG (dialog))), 5);
+#else
     gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 5);
+#endif
     sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
     hbox = gtk_hbox_new (FALSE, 8);
@@ -381,7 +389,11 @@ panel_add_feed_cb (FeedPanel*   panel,
     gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
     gtk_entry_set_text (GTK_ENTRY (entry), "");
     gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
+#if GTK_CHECK_VERSION(3,0,0)
+    gtk_container_add (GTK_CONTAINER(gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox);
+#else
     gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
+#endif
     gtk_widget_show_all (hbox);
 
     gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
diff --git a/extensions/history-list.vala b/extensions/history-list.vala
index 46ad5a4..b86960d 100644
--- a/extensions/history-list.vala
+++ b/extensions/history-list.vala
@@ -54,8 +54,9 @@ namespace HistoryList {
 
             var model = this.treeview.get_model () as Gtk.ListStore;
 
-            while (new_index < 0 || new_index >= model.length)
-                new_index = new_index < 0 ? model.length + new_index : new_index - model.length;
+            int length = model.iter_n_children(null);
+            while (new_index < 0 || new_index >= length)
+                new_index = new_index < 0 ? length + new_index : new_index - length;
 
             path = new Gtk.TreePath.from_indices (new_index);
             this.treeview.set_cursor (path, column, false);
@@ -130,9 +131,16 @@ namespace HistoryList {
             Requisition requisition;
             int height;
             int max_lines = 10;
+#if HAVE_GTK3
+            requisition = Requisition();
+            get_preferred_width(out requisition.width, null);
+            get_preferred_height(out requisition.height, null);
+#else
             this.treeview.size_request (out requisition);
-            if (store.length > max_lines) {
-                height = requisition.height / store.length * max_lines + 2;
+#endif
+            int length = store.iter_n_children(null);
+            if (length > max_lines) {
+                height = requisition.height / length * max_lines + 2;
             } else {
                 height = requisition.height + 2;
             }
@@ -225,7 +233,9 @@ namespace HistoryList {
             this.hl_manager = manager;
 
             this.title = _("Preferences for %s").printf( _("History-List"));
+#if !HAVE_GTK3
             this.has_separator = false;
+#endif
             this.border_width = 5;
             this.set_modal (true);
             this.set_default_size (350, 100);
@@ -295,7 +305,11 @@ namespace HistoryList {
 
             table.attach_defaults (this.closing_behavior, 1, 2, 0, 1);
 
+#if HAVE_GTK3
+            (get_content_area() as Gtk.Box).pack_start (table, false, true, 0);
+#else
             this.vbox.pack_start (table, false, true, 0);
+#endif
 
             this.add_button (Gtk.STOCK_CANCEL, ResponseType.CANCEL);
             this.add_button (Gtk.STOCK_APPLY, ResponseType.APPLY);
diff --git a/extensions/shortcuts.c b/extensions/shortcuts.c
index a9cd165..c399868 100644
--- a/extensions/shortcuts.c
+++ b/extensions/shortcuts.c
@@ -166,6 +166,7 @@ shortcuts_get_preferences_dialog (MidoriExtension* extension)
     GList* actions;
     guint i;
     GtkAction* action;
+    GtkWidget* dialog_vbox;
     #if HAVE_OSX
     GtkWidget* icon;
     #endif
@@ -175,7 +176,11 @@ shortcuts_get_preferences_dialog (MidoriExtension* extension)
 
     dialog_title = _("Customize Keyboard shortcuts");
     dialog = gtk_dialog_new_with_buttons (dialog_title, GTK_WINDOW (browser),
+#if GTK_CHECK_VERSION(3,0,0)
+        GTK_DIALOG_DESTROY_WITH_PARENT,
+#else
         GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+#endif
         #if !HAVE_OSX
         GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
         #endif
@@ -187,12 +192,19 @@ shortcuts_get_preferences_dialog (MidoriExtension* extension)
     gtk_window_set_default_size (GTK_WINDOW (dialog), width * 52, height * 24);
     g_signal_connect (dialog, "response",
                       G_CALLBACK (shortcuts_preferences_response_cb), NULL);
+
+#if GTK_CHECK_VERSION(3,0,0)
+    dialog_vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+#else
+    dialog_vbox = GTK_DIALOG (dialog)->vbox;
+#endif
     if ((xfce_heading = sokoke_xfce_header_new (
         gtk_window_get_icon_name (GTK_WINDOW (dialog)), dialog_title)))
-        gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
+        gtk_box_pack_start (GTK_BOX (dialog_vbox),
                             xfce_heading, FALSE, FALSE, 0);
     hbox = gtk_hbox_new (FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox,
+
+    gtk_box_pack_start (GTK_BOX (dialog_vbox), hbox,
                                  TRUE, TRUE, 12);
     liststore = gtk_list_store_new (7,
         G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_BOOLEAN,
@@ -248,7 +260,11 @@ shortcuts_get_preferences_dialog (MidoriExtension* extension)
                                           0, GTK_SORT_ASCENDING);
     g_object_unref (model);
 
+#if GTK_CHECK_VERSION(3,0,0)
+    gtk_widget_show_all (gtk_dialog_get_content_area(GTK_DIALOG (dialog)));
+#else
     gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
+#endif
 
     g_object_unref (browser);
 
diff --git a/extensions/toolbar-editor.c b/extensions/toolbar-editor.c
index e83fce0..b1fbaf0 100644
--- a/extensions/toolbar-editor.c
+++ b/extensions/toolbar-editor.c
@@ -274,6 +274,7 @@ static void tb_editor_drag_data_rcvd_cb(GtkWidget *widget, GdkDragContext *conte
 										gint x, gint y, GtkSelectionData *data, guint info,
 										guint ltime, TBEditorWidget *tbw)
 {
+#if !GTK_CHECK_VERSION(3,0,0) /* TODO */
 	GtkTreeView *tree = GTK_TREE_VIEW(widget);
 	gboolean del = FALSE;
 
@@ -331,6 +332,7 @@ static void tb_editor_drag_data_rcvd_cb(GtkWidget *widget, GdkDragContext *conte
 	tbw->drag_source = NULL; /* reset the value just to be sure */
 	tb_editor_free_path(tbw);
 	gtk_drag_finish(context, TRUE, del, ltime);
+#endif
 }
 
 
@@ -392,7 +394,11 @@ static TBEditorWidget *tb_editor_create_dialog(MidoriBrowser *parent)
 				GTK_WINDOW(parent),
 				GTK_DIALOG_DESTROY_WITH_PARENT,
 				GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
+#if !GTK_CHECK_VERSION(3,0,0)
 	vbox = (GTK_DIALOG(dialog))->vbox;
+#else
+	vbox = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog)));
+#endif
 	gtk_box_set_spacing(GTK_BOX(vbox), 6);
 	gtk_widget_set_name(dialog, "GeanyDialog");
 	gtk_window_set_default_size(GTK_WINDOW(dialog), -1, 400);
diff --git a/extensions/wscript_build b/extensions/wscript_build
index 668bb6d..e209aed 100644
--- a/extensions/wscript_build
+++ b/extensions/wscript_build
@@ -34,7 +34,11 @@ for extension in extensions:
     obj.source = source
     obj.uselib = 'UNIQUE LIBSOUP GIO GTK SQLITE WEBKIT LIBXML HILDON'
     obj.vapi_dirs = '../midori'
-    obj.packages = 'glib-2.0 gio-2.0 gtk+-2.0 libsoup-2.4 webkit-1.0 midori'
+    obj.packages = 'glib-2.0 gio-2.0 libsoup-2.4 midori'
+    if bld.env['HAVE_GTK3']:
+        obj.packages += ' gtk+-3.0 webkitgtk-3.0'
+    else:
+        obj.packages += ' gtk+-2.0 webkit-1.0 unique-1.0'
     obj.install_path = '${LIBDIR}/midori'
     if bld.env['platform'] == 'win32':
         obj.uselib_local = 'midori'
diff --git a/katze/gtk3-compat.h b/katze/gtk3-compat.h
new file mode 100644
index 0000000..cfa24bc
--- /dev/null
+++ b/katze/gtk3-compat.h
@@ -0,0 +1,45 @@
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+
+#ifndef H_GTK3_COMPAT_20110110
+#define H_GTK3_COMPAT_20110110
+
+#if !GTK_CHECK_VERSION (2, 24 ,0)
+    #define gtk_combo_box_text_append_text gtk_combo_box_append_text
+    #define gtk_combo_box_text_new gtk_combo_box_new_text
+    #define gtk_combo_box_text_get_active_text gtk_combo_box_get_active_text
+    #define GTK_COMBO_BOX_TEXT GTK_COMBO_BOX
+    #define GtkComboBoxText GtkComboBox
+#endif
+
+#ifndef GDK_KEY_Return
+    #define GDK_KEY_0 GDK_0
+    #define GDK_KEY_BackSpace GDK_BackSpace
+    #define GDK_KEY_space GDK_space
+    #define GDK_KEY_F5 GDK_F5
+    #define GDK_KEY_KP_Equal GDK_KP_Equal
+    #define GDK_KEY_KP_Enter GDK_KP_Enter
+    #define GDK_KEY_KP_Left GDK_KP_Left
+    #define GDK_KEY_KP_Right GDK_KP_Right
+    #define GDK_KEY_KP_Delete GDK_KP_Delete
+    #define GDK_KEY_KP_Down GDK_KP_Down
+    #define GDK_KEY_KP_Up GDK_KP_Up
+    #define GDK_KEY_KP_Divide GDK_KP_Divide
+    #define GDK_KEY_Tab GDK_Tab
+    #define GDK_KEY_ISO_Left_Tab GDK_ISO_Left_Tab
+    #define GDK_KEY_equal GDK_equal
+    #define GDK_KEY_ISO_Enter GDK_ISO_Enter
+    #define GDK_KEY_Left GDK_Left
+    #define GDK_KEY_Right GDK_Right
+    #define GDK_KEY_Escape GDK_Escape
+    #define GDK_KEY_Page_Up GDK_Page_Up
+    #define GDK_KEY_Page_Down GDK_Page_Down
+    #define GDK_KEY_Delete GDK_Delete
+    #define GDK_KEY_Down GDK_Down
+    #define GDK_KEY_Up GDK_Up
+    #define GDK_KEY_B GDK_B
+    #define GDK_KEY_H GDK_H
+    #define GDK_KEY_J GDK_J
+#endif
+
+#endif
diff --git a/katze/katze-http-auth.c b/katze/katze-http-auth.c
index 322fe01..62ca99a 100644
--- a/katze/katze-http-auth.c
+++ b/katze/katze-http-auth.c
@@ -212,7 +212,11 @@ katze_http_auth_session_authenticate_cb (SoupSession*   session,
 
     dialog = gtk_dialog_new_with_buttons (_("Authentication Required"),
         NULL,
+#if GTK_CHECK_VERSION(3,0,0)
+        GTK_DIALOG_DESTROY_WITH_PARENT,
+#else
         GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+#endif
         GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
         GTK_STOCK_OK, GTK_RESPONSE_OK,
         NULL);
diff --git a/katze/katze-preferences.c b/katze/katze-preferences.c
index 3f7b808..c700c27 100644
--- a/katze/katze-preferences.c
+++ b/katze/katze-preferences.c
@@ -97,7 +97,9 @@ katze_preferences_init (KatzePreferences* preferences)
     g_object_set (preferences,
                   "icon-name", GTK_STOCK_PREFERENCES,
                   "title", dialog_title,
+#if !GTK_CHECK_VERSION (3, 0, 0)
                   "has-separator", FALSE,
+#endif
                   NULL);
     g_free (dialog_title);
 
diff --git a/katze/katze-throbber.c b/katze/katze-throbber.c
index 8d9ab09..ff40323 100644
--- a/katze/katze-throbber.c
+++ b/katze/katze-throbber.c
@@ -92,11 +92,25 @@ katze_throbber_get_property (GObject* object,
                              GParamSpec* pspec);
 
 static void
+#if GTK_CHECK_VERSION (3, 0, 0)
+katze_throbber_destroy (GtkWidget* object);
+#else
 katze_throbber_destroy (GtkObject* object);
+#endif
 
 static void
 katze_throbber_realize (GtkWidget* widget);
 
+#if GTK_CHECK_VERSION (3, 0, 0)
+static void
+katze_throbber_get_preferred_height (GtkWidget *widget,
+                               gint      *minimal_width,
+                               gint      *natural_width);
+static void
+katze_throbber_get_preferred_width (GtkWidget *widget,
+                               gint      *minimal_width,
+                               gint      *natural_width);
+#endif
 static void
 katze_throbber_unrealize (GtkWidget* widget);
 
@@ -120,7 +134,11 @@ katze_throbber_size_request (GtkWidget*      widget,
 
 static gboolean
 katze_throbber_expose_event (GtkWidget*      widget,
+#if GTK_CHECK_VERSION (3, 0, 0)
+                             cairo_t* cr);
+#else
                              GdkEventExpose* event);
+#endif
 
 static void
 icon_theme_changed (KatzeThrobber* throbber);
@@ -137,7 +155,9 @@ static void
 katze_throbber_class_init (KatzeThrobberClass* class)
 {
     GObjectClass* gobject_class;
+#if !GTK_CHECK_VERSION (3, 0, 0)
     GtkObjectClass* object_class;
+#endif
     GtkWidgetClass* widget_class;
     GParamFlags flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT;
 
@@ -146,19 +166,30 @@ katze_throbber_class_init (KatzeThrobberClass* class)
     gobject_class->set_property = katze_throbber_set_property;
     gobject_class->get_property = katze_throbber_get_property;
 
+    widget_class = GTK_WIDGET_CLASS (class);
+#if GTK_CHECK_VERSION (3, 0, 0)
+    widget_class->destroy = katze_throbber_destroy;
+#else
     object_class = GTK_OBJECT_CLASS (class);
     object_class->destroy = katze_throbber_destroy;
-
-    widget_class = GTK_WIDGET_CLASS (class);
+#endif
     widget_class->realize = katze_throbber_realize;
     widget_class->unrealize = katze_throbber_unrealize;
     widget_class->map = katze_throbber_map;
     widget_class->unmap = katze_throbber_unmap;
     widget_class->style_set = katze_throbber_style_set;
     widget_class->screen_changed = katze_throbber_screen_changed;
+#if GTK_CHECK_VERSION (3, 0, 0)
+    widget_class->get_preferred_width= katze_throbber_get_preferred_width;
+    widget_class->get_preferred_height= katze_throbber_get_preferred_height;
+#else
     widget_class->size_request = katze_throbber_size_request;
+#endif
+#if GTK_CHECK_VERSION (3, 0, 0)
+    widget_class->draw = katze_throbber_expose_event;
+#else
     widget_class->expose_event = katze_throbber_expose_event;
-
+#endif
     g_object_class_install_property (gobject_class,
                                      PROP_ICON_SIZE,
                                      g_param_spec_int (
@@ -246,7 +277,11 @@ katze_throbber_dispose (GObject* object)
 }
 
 static void
+#if GTK_CHECK_VERSION (3, 0, 0)
+katze_throbber_destroy (GtkWidget* object)
+#else
 katze_throbber_destroy (GtkObject* object)
+#endif
 {
     KatzeThrobber* throbber = KATZE_THROBBER (object);
 
@@ -255,8 +290,11 @@ katze_throbber_destroy (GtkObject* object)
     katze_assign (throbber->static_icon_name, NULL);
     katze_object_assign (throbber->static_pixbuf, NULL);
     katze_assign (throbber->static_stock_id, NULL);
-
+#if GTK_CHECK_VERSION (3, 0, 0)
+    GTK_WIDGET_CLASS (katze_throbber_parent_class)->destroy (object);
+#else
     GTK_OBJECT_CLASS (katze_throbber_parent_class)->destroy (object);
+#endif
 }
 
 static void
@@ -817,10 +855,37 @@ katze_throbber_size_request (GtkWidget*      widget,
 
     requisition->width = throbber->width;
     requisition->height = throbber->height;
-
+#if !GTK_CHECK_VERSION (3, 0, 0)
     GTK_WIDGET_CLASS (katze_throbber_parent_class)->size_request (widget,
                                                                   requisition);
+#endif
+}
+
+#if GTK_CHECK_VERSION (3, 0, 0)
+static void
+katze_throbber_get_preferred_height (GtkWidget *widget,
+                                     gint      *minimal_width,
+                                     gint      *natural_width)
+{
+    GtkRequisition requisition;
+
+    katze_throbber_size_request (widget, &requisition);
+
+    *minimal_width = *natural_width = requisition.height;
+}
+
+static void
+katze_throbber_get_preferred_width (GtkWidget *widget,
+                                    gint      *minimal_width,
+                                    gint      *natural_width)
+{
+    GtkRequisition requisition;
+
+    katze_throbber_size_request (widget, &requisition);
+
+    *minimal_width = *natural_width = requisition.width;
 }
+#endif
 
 static void
 katze_throbber_aligned_coords (GtkWidget* widget,
@@ -853,7 +918,11 @@ katze_throbber_aligned_coords (GtkWidget* widget,
 
 static gboolean
 katze_throbber_expose_event (GtkWidget*      widget,
+#if GTK_CHECK_VERSION (3, 0, 0)
+                             cairo_t* cr)
+#else
                              GdkEventExpose* event)
+#endif
 {
     KatzeThrobber* throbber = KATZE_THROBBER (widget);
     gint ax, ay;
@@ -868,8 +937,9 @@ katze_throbber_expose_event (GtkWidget*      widget,
     if (!throbber->animated && (throbber->static_pixbuf
         || throbber->static_icon_name || throbber->static_stock_id))
     {
+#if !GTK_CHECK_VERSION (3, 0, 0)
         cairo_t* cr;
-
+#endif
         if (G_UNLIKELY (!throbber->static_pixbuf && throbber->static_icon_name))
         {
             icon_theme_changed (KATZE_THROBBER (widget));
@@ -899,16 +969,24 @@ katze_throbber_expose_event (GtkWidget*      widget,
 
         katze_throbber_aligned_coords (widget, &ax, &ay);
 
+#if !GTK_CHECK_VERSION (3, 0, 0)
         cr = gdk_cairo_create (gtk_widget_get_window (widget));
+#endif
         gdk_cairo_set_source_pixbuf (cr, throbber->static_pixbuf, ax, ay);
         cairo_paint (cr);
+#if !GTK_CHECK_VERSION (3, 0, 0)
         cairo_destroy (cr);
+#endif
     }
     else
     {
         #if HAVE_SPINNER
         if (throbber->animated)
+#if GTK_CHECK_VERSION (3, 0, 0)
+            return GTK_WIDGET_CLASS (katze_throbber_parent_class)->draw (widget, cr);
+#else
             return GTK_WIDGET_CLASS (katze_throbber_parent_class)->expose_event (widget, event);
+#endif
         #else
         gint cols, rows;
 
diff --git a/katze/katze-utils.c b/katze/katze-utils.c
index 767d814..dccc09e 100644
--- a/katze/katze-utils.c
+++ b/katze/katze-utils.c
@@ -9,6 +9,8 @@
  See the file COPYING for the full license text.
 */
 
+#include "gtk3-compat.h"
+
 #include "katze-utils.h"
 #include "katze-array.h"
 
@@ -85,10 +87,10 @@ proxy_uri_file_set_cb (GtkFileChooser* button,
 }
 
 static void
-proxy_combo_box_text_changed_cb (GtkComboBox* button,
-                                 GObject*     object)
+proxy_combo_box_text_changed_cb (GtkComboBoxText* button,
+                                 GObject*         object)
 {
-    gchar* text = gtk_combo_box_get_active_text (button);
+    gchar* text = gtk_combo_box_text_get_active_text (button);
     const gchar* property = g_object_get_data (G_OBJECT (button), "property");
     g_object_set (object, property, text, NULL);
     g_free (text);
@@ -633,7 +635,7 @@ katze_property_proxy (gpointer     object,
         gboolean monospace = _hint == I_("font-monospace");
         string = katze_object_get_string (object, property);
 
-        widget = gtk_combo_box_new_text ();
+        widget = gtk_combo_box_text_new ();
         combo = GTK_COMBO_BOX (widget);
         context = gtk_widget_get_pango_context (widget);
         pango_context_list_families (context, &families, &n_families);
@@ -650,7 +652,7 @@ katze_property_proxy (gpointer     object,
                 const gchar* font = pango_font_family_get_name (families[i]);
                 if (monospace != pango_font_family_is_monospace (families[i]))
                     continue;
-                gtk_combo_box_append_text (combo, font);
+                gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), font);
                 if (!g_ascii_strcasecmp (font, string))
                     gtk_combo_box_set_active (combo, j);
                 j++;
@@ -815,12 +817,12 @@ katze_property_proxy (gpointer     object,
     {
         gint value = katze_object_get_int (object, property);
         gint active;
-        widget = gtk_combo_box_new_text ();
-        gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("1 hour"));
-        gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("1 day"));
-        gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("1 week"));
-        gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("1 month"));
-        gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("1 year"));
+        widget = gtk_combo_box_text_new ();
+        gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("1 hour"));
+        gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("1 day"));
+        gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("1 week"));
+        gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("1 month"));
+        gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("1 year"));
         switch (value)
         {
         case   0: active = 0; break;
@@ -874,7 +876,7 @@ katze_property_proxy (gpointer     object,
         hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (widget),
                                            HILDON_TOUCH_SELECTOR (selector));
         #else
-        widget = gtk_combo_box_new_text ();
+        widget = gtk_combo_box_text_new ();
         #endif
         for (i = 0; i < enum_class->n_values; i++)
         {
@@ -882,7 +884,7 @@ katze_property_proxy (gpointer     object,
             #ifdef HAVE_HILDON_2_2
             hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), label);
             #else
-            gtk_combo_box_append_text (GTK_COMBO_BOX (widget), label);
+            gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), label);
             #endif
         }
         #ifdef HAVE_HILDON_2_2
diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index e2bdcbd..8f96d3b 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -11,6 +11,8 @@
  See the file COPYING for the full license text.
 */
 
+#include "gtk3-compat.h"
+
 #include "midori-browser.h"
 
 #include "midori-array.h"
@@ -724,7 +726,11 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
         title = new_bookmark ? _("New bookmark") : _("Edit bookmark");
     dialog = gtk_dialog_new_with_buttons (
         title, GTK_WINDOW (browser),
+#if GTK_CHECK_VERSION(3,0,0)
+        GTK_DIALOG_DESTROY_WITH_PARENT,
+#else
         GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+#endif
         GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
         new_bookmark ? GTK_STOCK_ADD : GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
         NULL);
@@ -902,7 +908,8 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
                 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_app)));
         }
 
-        selected = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo_folder));
+        selected = gtk_combo_box_text_get_active_text (
+            GTK_COMBO_BOX_TEXT (combo_folder));
         if (!strcmp (selected, _("Toplevel folder")))
             katze_assign (selected, g_strdup (""));
         katze_item_set_meta_string (bookmark, "folder", selected);
@@ -1638,13 +1645,13 @@ midori_browser_key_press_event (GtkWidget*   widget,
 
     /* Interpret Ctrl(+Shift)+Tab as tab switching for compatibility */
     if (midori_browser_get_nth_tab (browser, 1) != NULL
-     && event->keyval == GDK_Tab
+     && event->keyval == GDK_KEY_Tab
      && (event->state & GDK_CONTROL_MASK))
     {
         gtk_action_activate (_action_by_name (browser, "TabNext"));
         return TRUE;
     }
-    else if (event->keyval == GDK_ISO_Left_Tab
+    else if (event->keyval == GDK_KEY_ISO_Left_Tab
      && (event->state & GDK_CONTROL_MASK)
      && (event->state & GDK_SHIFT_MASK))
     {
@@ -1652,14 +1659,14 @@ midori_browser_key_press_event (GtkWidget*   widget,
         return TRUE;
     }
     /* Interpret Ctrl+= as Zoom In for compatibility */
-    else if ((event->keyval == GDK_KP_Equal || event->keyval == GDK_equal)
+    else if ((event->keyval == GDK_KEY_KP_Equal || event->keyval == GDK_KEY_equal)
           && (event->state & GDK_CONTROL_MASK))
     {
         midori_browser_activate_action (browser, "ZoomIn");
         return TRUE;
     }
     /* Interpret F5 as reloading for compatibility */
-    else if (event->keyval == GDK_F5)
+    else if (event->keyval == GDK_KEY_F5)
     {
         gtk_action_activate (_action_by_name (browser, "Reload"));
         return TRUE;
@@ -1669,7 +1676,7 @@ midori_browser_key_press_event (GtkWidget*   widget,
     if (focus == NULL)
         gtk_widget_grab_focus (midori_browser_get_current_tab (MIDORI_BROWSER (widget)));
     else if (G_OBJECT_TYPE (focus) == WEBKIT_TYPE_WEB_VIEW
-          && event->keyval == GDK_space
+          && event->keyval == GDK_KEY_space
           && !webkit_web_view_can_cut_clipboard (WEBKIT_WEB_VIEW (focus))
           && !webkit_web_view_can_paste_clipboard (WEBKIT_WEB_VIEW (focus)))
     {
@@ -1707,13 +1714,13 @@ midori_browser_key_press_event (GtkWidget*   widget,
         return TRUE;
 
     /* Interpret (Shift+)Backspace as going back (forward) for compatibility */
-    if ((event->keyval == GDK_BackSpace)
+    if ((event->keyval == GDK_KEY_BackSpace)
      && (event->state & GDK_SHIFT_MASK))
     {
         gtk_action_activate (_action_by_name (browser, "Forward"));
         return TRUE;
     }
-    else if (event->keyval == GDK_BackSpace)
+    else if (event->keyval == GDK_KEY_BackSpace)
     {
         gtk_action_activate (_action_by_name (browser, "Back"));
         return TRUE;
@@ -4214,7 +4221,11 @@ _action_bookmarks_import_activate (GtkAction*     action,
 
     dialog = gtk_dialog_new_with_buttons (
         _("Import bookmarks..."), GTK_WINDOW (browser),
+#if GTK_CHECK_VERSION(3,0,0)
+        GTK_DIALOG_DESTROY_WITH_PARENT,
+#else
         GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+#endif
         GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
         _("_Import bookmarks"), GTK_RESPONSE_ACCEPT,
         NULL);
@@ -4265,9 +4276,10 @@ _action_bookmarks_import_activate (GtkAction*     action,
     label = gtk_label_new_with_mnemonic (_("_Folder:"));
     gtk_size_group_add_widget (sizegroup, label);
     gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-    combo = gtk_combo_box_new_text ();
+    combo = gtk_combo_box_text_new ();
     combobox_folder = GTK_COMBO_BOX (combo);
-    gtk_combo_box_append_text (combobox_folder, _("Toplevel folder"));
+    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox_folder),
+                                    _("Toplevel folder"));
     gtk_combo_box_set_active (combobox_folder, 0);
 
     db = g_object_get_data (G_OBJECT (browser->bookmarks), "db");
@@ -4276,7 +4288,7 @@ _action_bookmarks_import_activate (GtkAction*     action,
     KATZE_ARRAY_FOREACH_ITEM (item, bookmarkdirs)
     {
         const gchar* name = katze_item_get_name (item);
-        gtk_combo_box_append_text (combobox_folder, name);
+        gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox_folder), name);
     }
     gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
     gtk_container_add (GTK_CONTAINER (content_area), hbox);
@@ -4294,7 +4306,8 @@ _action_bookmarks_import_activate (GtkAction*     action,
         gtk_combo_box_get_active_iter (combobox, &iter);
         gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, 2, &path, -1);
 
-        selected = gtk_combo_box_get_active_text (combobox_folder);
+        selected = gtk_combo_box_text_get_active_text (
+            GTK_COMBO_BOX_TEXT (combobox_folder));
         if (g_str_equal (selected, _("Toplevel folder")))
             selected = g_strdup ("");
 
@@ -4514,7 +4527,11 @@ _action_clear_private_data_activate (GtkAction*     action,
         /* i18n: Dialog: Clear Private Data, in the Tools menu */
         dialog = gtk_dialog_new_with_buttons (_("Clear Private Data"),
             GTK_WINDOW (browser),
-            GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT,
+#if GTK_CHECK_VERSION(3,0,0)
+            GTK_DIALOG_DESTROY_WITH_PARENT,
+#else
+            GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+#endif
             GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
             _("_Clear private data"), GTK_RESPONSE_ACCEPT, NULL);
         content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
@@ -4712,6 +4729,7 @@ static const gchar* credits_documenters[] =
 static const gchar* credits_artists[] =
     { "Nancy Runge <nancy at twotoasts.de>", NULL };
 
+#if !GTK_CHECK_VERSION (3, 0, 0)
 static void
 _action_about_activate_link (GtkAboutDialog* about,
                              const gchar*    uri,
@@ -4738,6 +4756,7 @@ _action_about_activate_email (GtkAboutDialog* about,
     sokoke_show_uri (NULL, newuri ? newuri : uri, GDK_CURRENT_TIME, NULL);
     g_free (newuri);
 }
+#endif
 
 static void
 _action_about_activate (GtkAction*     action,
@@ -4752,8 +4771,10 @@ _action_about_activate (GtkAction*     action,
     "License as published by the Free Software Foundation; either "
     "version 2.1 of the License, or (at your option) any later version.");
 
+#if !GTK_CHECK_VERSION (3, 0, 0)
     gtk_about_dialog_set_email_hook (_action_about_activate_email, NULL, NULL);
     gtk_about_dialog_set_url_hook (_action_about_activate_link, browser, NULL);
+#endif
     gtk_show_about_dialog (GTK_WINDOW (browser),
         "logo-icon-name", gtk_window_get_icon_name (GTK_WINDOW (browser)),
         "name", PACKAGE_NAME,
@@ -5049,8 +5070,10 @@ midori_browser_notebook_button_press_event_after_cb (GtkNotebook*    notebook,
                                                      GdkEventButton* event,
                                                      MidoriBrowser*  browser)
 {
+#if !GTK_CHECK_VERSION(3,0,0) /* TODO */
     if (event->window != notebook->event_window)
         return FALSE;
+#endif
 
     /* FIXME: Handle double click only when it wasn't handled by GtkNotebook */
 
@@ -5755,7 +5778,7 @@ midori_browser_accel_switch_tab_activate_cb (GtkAccelGroup*  accel_group,
         GtkWidget* view;
 
         /* Switch to n-th tab. 9 and 0 go to the last tab. */
-        n = keyval - GDK_0;
+        n = keyval - GDK_KEY_0;
         browser = g_object_get_data (G_OBJECT (accel_group), "midori-browser");
         if ((view = gtk_notebook_get_nth_page (GTK_NOTEBOOK (browser->notebook),
                                                n < 9 ? n - 1 : -1)))
@@ -5914,7 +5937,7 @@ midori_browser_init (MidoriBrowser* browser)
     for (i = 0; i < 10; i++)
     {
         gchar* accel_path = g_strdup_printf ("<Manual>/Browser/SwitchTab%d", i);
-        gtk_accel_map_add_entry (accel_path, GDK_0 + i, GDK_MOD1_MASK);
+        gtk_accel_map_add_entry (accel_path, GDK_KEY_0 + i, GDK_MOD1_MASK);
         gtk_accel_group_connect_by_path (accel_group, accel_path, accel_closure);
         g_free (accel_path);
     }
@@ -6130,6 +6153,9 @@ midori_browser_init (MidoriBrowser* browser)
     /* Create the navigationbar */
     browser->navigationbar = gtk_ui_manager_get_widget (
         ui_manager, "/toolbar_navigation");
+#if GTK_CHECK_VERSION(3,0,0)
+    gtk_style_context_add_class(gtk_widget_get_style_context(browser->navigationbar), "primary-toolbar");
+#endif
     /* FIXME: Settings should be connected with screen changes */
     gtk_settings = gtk_widget_get_settings (GTK_WIDGET (browser));
     if (gtk_settings)
diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c
index 3a1d2e2..77bf402 100644
--- a/midori/midori-locationaction.c
+++ b/midori/midori-locationaction.c
@@ -12,6 +12,7 @@
 
 #include "midori-locationaction.h"
 
+#include "gtk3-compat.h"
 #include "gtkiconentry.h"
 #include "marshal.h"
 #include "sokoke.h"
@@ -806,15 +807,14 @@ midori_location_action_key_press_event_cb (GtkEntry*    entry,
 
     switch (event->keyval)
     {
-    case GDK_ISO_Enter:
-    case GDK_KP_Enter:
-    case GDK_Return:
+    case GDK_KEY_ISO_Enter:
+    case GDK_KEY_KP_Enter:
+    case GDK_KEY_Return:
         is_enter = TRUE;
-    case GDK_Left:
-    case GDK_KP_Left:
-    case GDK_Right:
-    case GDK_KP_Right:
-
+    case GDK_KEY_Left:
+    case GDK_KEY_KP_Left:
+    case GDK_KEY_Right:
+    case GDK_KEY_KP_Right:
         if (location_action->popup && gtk_widget_get_visible (location_action->popup))
         {
             GtkTreeModel* model = location_action->completion_model;
@@ -842,7 +842,7 @@ midori_location_action_key_press_event_cb (GtkEntry*    entry,
                 g_signal_emit (action, signals[SUBMIT_URI], 0, text,
                                MIDORI_MOD_NEW_TAB (event->state));
         break;
-    case GDK_Escape:
+    case GDK_KEY_Escape:
     {
         if (location_action->popup && gtk_widget_get_visible (location_action->popup))
         {
@@ -856,12 +856,12 @@ midori_location_action_key_press_event_cb (GtkEntry*    entry,
         /* Return FALSE to allow Escape to stop loading */
         return FALSE;
     }
-    case GDK_Page_Up:
-    case GDK_Page_Down:
+    case GDK_KEY_Page_Up:
+    case GDK_KEY_Page_Down:
         if (!(location_action->popup && gtk_widget_get_visible (location_action->popup)))
             return TRUE;
-    case GDK_Delete:
-    case GDK_KP_Delete:
+    case GDK_KEY_Delete:
+    case GDK_KEY_KP_Delete:
     {
         gint selected = location_action->completion_index;
         GtkTreeModel* model = location_action->completion_model;
@@ -902,12 +902,12 @@ midori_location_action_key_press_event_cb (GtkEntry*    entry,
         else
             break;
     }
-    case GDK_Down:
-    case GDK_KP_Down:
-    case GDK_Up:
-    case GDK_KP_Up:
-    case GDK_Tab:
-    case GDK_ISO_Left_Tab:
+    case GDK_KEY_Down:
+    case GDK_KEY_KP_Down:
+    case GDK_KEY_Up:
+    case GDK_KEY_KP_Up:
+    case GDK_KEY_Tab:
+    case GDK_KEY_ISO_Left_Tab:
     {
         if (location_action->popup && gtk_widget_get_visible (location_action->popup))
         {
@@ -917,21 +917,21 @@ midori_location_action_key_press_event_cb (GtkEntry*    entry,
             GtkTreeIter iter;
             gint selected = location_action->completion_index;
 
-            if (event->keyval == GDK_Down || event->keyval == GDK_KP_Down
-             || event->keyval == GDK_Tab  || event->keyval == GDK_ISO_Left_Tab)
+            if (event->keyval == GDK_KEY_Down || event->keyval == GDK_KEY_KP_Down
+             || event->keyval == GDK_KEY_Tab  || event->keyval == GDK_KEY_ISO_Left_Tab)
                 selected = MIN (selected + 1, matches -1);
-            else if (event->keyval == GDK_Up || event->keyval == GDK_KP_Up)
+            else if (event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_KP_Up)
             {
                 if (selected == -1)
                     selected = matches - 1;
                 else
                     selected = MAX (selected - 1, 0);
             }
-            else if (event->keyval == GDK_Page_Down)
+            else if (event->keyval == GDK_KEY_Page_Down)
                 selected = MIN (selected + 14, matches -1);
-            else if (event->keyval == GDK_Page_Up)
+            else if (event->keyval == GDK_KEY_Page_Up)
                 selected = MAX (selected - 14, 0);
-            else if (event->keyval != GDK_KP_Delete && event->keyval != GDK_Delete)
+            else if (event->keyval != GDK_KEY_KP_Delete && event->keyval != GDK_KEY_Delete)
                 g_assert_not_reached ();
 
             path = gtk_tree_path_new_from_indices (selected, -1);
@@ -952,7 +952,7 @@ midori_location_action_key_press_event_cb (GtkEntry*    entry,
         }
 
         /* Allow Tab to handle focus if the popup is closed */
-        if (event->keyval == GDK_Tab  || event->keyval == GDK_ISO_Left_Tab)
+        if (event->keyval == GDK_KEY_Tab  || event->keyval == GDK_KEY_ISO_Left_Tab)
             return FALSE;
         return TRUE;
     }
diff --git a/midori/midori-panel.c b/midori/midori-panel.c
index fb3c66f..260a12b 100644
--- a/midori/midori-panel.c
+++ b/midori/midori-panel.c
@@ -709,9 +709,11 @@ midori_panel_append_page (MidoriPanel*    panel,
         gtk_widget_set_can_focus (scrolled, TRUE);
         gtk_widget_show (scrolled);
         gobject_class = G_OBJECT_GET_CLASS (viewable);
+#if !GTK_CHECK_VERSION(3,0,0) /* TODO */
         if (GTK_WIDGET_CLASS (gobject_class)->set_scroll_adjustments_signal)
             widget = (GtkWidget*)viewable;
         else
+#endif
         {
             widget = gtk_viewport_new (NULL, NULL);
             gtk_widget_show (widget);
diff --git a/midori/midori-searchaction.c b/midori/midori-searchaction.c
index 3be44c3..41eb4de 100644
--- a/midori/midori-searchaction.c
+++ b/midori/midori-searchaction.c
@@ -11,6 +11,7 @@
 
 #include "midori-searchaction.h"
 
+#include "gtk3-compat.h"
 #include "gtkiconentry.h"
 #include "marshal.h"
 #include "sokoke.h"
@@ -347,19 +348,19 @@ midori_search_action_key_press_event_cb (GtkWidget*          entry,
 
     switch (event->keyval)
     {
-    case GDK_ISO_Enter:
-    case GDK_KP_Enter:
-    case GDK_Return:
+    case GDK_KEY_ISO_Enter:
+    case GDK_KEY_KP_Enter:
+    case GDK_KEY_Return:
         text = gtk_entry_get_text (GTK_ENTRY (entry));
         g_signal_emit (search_action, signals[SUBMIT], 0, text,
                        MIDORI_MOD_NEW_TAB (event->state));
         search_action->last_proxy = entry;
         return TRUE;
-    case GDK_Up:
+    case GDK_KEY_Up:
         if (MIDORI_MOD_SCROLL (event->state))
             _midori_search_action_move_index (search_action, - 1);
         return TRUE;
-    case GDK_Down:
+    case GDK_KEY_Down:
         if (MIDORI_MOD_SCROLL (event->state))
             _midori_search_action_move_index (search_action, + 1);
         return TRUE;
@@ -908,7 +909,11 @@ midori_search_action_get_editor (MidoriSearchAction* search_action,
     dialog = gtk_dialog_new_with_buttons (
         new_engine ? _("Add search engine") : _("Edit search engine"),
         toplevel ? GTK_WINDOW (toplevel) : NULL,
+#if GTK_CHECK_VERSION(3,0,0)
+        GTK_DIALOG_DESTROY_WITH_PARENT,
+#else
         GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+#endif
         GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
         new_engine ? GTK_STOCK_ADD : GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
         NULL);
@@ -1303,7 +1308,11 @@ midori_search_action_get_dialog (MidoriSearchAction* search_action)
         gtk_widget_get_toplevel (search_action->last_proxy) : NULL;
     dialog = gtk_dialog_new_with_buttons (dialog_title,
         toplevel ? GTK_WINDOW (toplevel) : NULL,
+#if GTK_CHECK_VERSION(3,0,0)
+        GTK_DIALOG_DESTROY_WITH_PARENT,
+#else
         GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+#endif
         #if !HAVE_OSX
         #if !HAVE_HILDON
         GTK_STOCK_HELP, GTK_RESPONSE_HELP,
diff --git a/midori/midori-view.c b/midori/midori-view.c
index fd45fb7..7b54c4a 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -14,6 +14,7 @@
     #include <config.h>
 #endif
 
+#include "gtk3-compat.h"
 #include "midori-view.h"
 #include "midori-stock.h"
 #include "midori-browser.h"
@@ -1852,7 +1853,7 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
     /* Find links by number: . to show links, type number, Return to go */
     if (event->keyval == '.'
      || (view->find_links > -1
-     && (digit != -1 || event->keyval == GDK_Return || event->keyval == GDK_Escape)))
+     && (digit != -1 || event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_Escape)))
     {
         WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (web_view);
         JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
@@ -1896,17 +1897,17 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
                 NULL);
             view->find_links = 0;
         }
-        else if (digit != -1 && event->keyval != GDK_Return && event->keyval != GDK_Escape)
+        else if (digit != -1 && event->keyval != GDK_KEY_Return && event->keyval != GDK_KEY_Escape)
         {
             if (view->find_links > -1)
                 view->find_links *= 10;
             view->find_links += digit;
         }
-        else if (event->keyval == GDK_Escape)
+        else if (event->keyval == GDK_KEY_Escape)
         {
             view->find_links = 0;
         }
-        else if (event->keyval == GDK_Return)
+        else if (event->keyval == GDK_KEY_Return)
         {
             gchar* script;
             script = g_strdup_printf (
@@ -1915,7 +1916,8 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
                 "if (return_key) {"
                 "    if (typeof links[i] != 'undefined')"
                 "        links[i].parentNode.href; }",
-                view->find_links, event->keyval == GDK_Return);
+                view->find_links, event->keyval == GDK_KEY_Return
+                );
             result = sokoke_js_script_eval (js_context, script, NULL);
             if (result && strstr (result, "://"))
             {
@@ -1956,7 +1958,7 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
     }
 
     /* Find inline */
-    if (event->keyval == ',' || event->keyval == '/' || event->keyval == GDK_KP_Divide)
+    if (event->keyval == ',' || event->keyval == '/' || event->keyval == GDK_KEY_KP_Divide)
         character = '\0';
     else
         return FALSE;
@@ -4518,7 +4520,11 @@ gtk_box_repack (GtkBox*    box,
 
 static void
 midori_view_tab_label_parent_set (GtkWidget*  tab_label,
+#if GTK_CHECK_VERSION(3,0,0)
+                                  GObject*  old_parent,
+#else
                                   GtkObject*  old_parent,
+#endif
                                   MidoriView* view)
 {
     GtkWidget* parent;
@@ -5238,10 +5244,12 @@ midori_view_get_snapshot (MidoriView* view,
     gboolean fast;
     gint x, y, w, h;
     GdkRectangle rect;
+    #if !GTK_CHECK_VERSION (3, 0, 0)
     GdkPixmap* pixmap;
     GdkEvent event;
     gboolean result;
     GdkColormap* colormap;
+    #endif
     GdkPixbuf* pixbuf;
 
     g_return_val_if_fail (MIDORI_IS_VIEW (view), NULL);
@@ -5268,6 +5276,12 @@ midori_view_get_snapshot (MidoriView* view,
         fast = TRUE;
     }
 
+    #if GTK_CHECK_VERSION (3, 0, 0)
+    cairo_t* cr = gdk_cairo_create (window);
+    gtk_widget_draw (web_view, cr);
+    pixbuf = NULL; /* TODO */
+    cairo_destroy (cr);
+    #else
     rect.x = x;
     rect.y = y;
     rect.width = w;
@@ -5290,6 +5304,7 @@ midori_view_get_snapshot (MidoriView* view,
     pixbuf = gdk_pixbuf_get_from_drawable (NULL, pixmap, colormap, 0, 0,
                                            0, 0, rect.width, rect.height);
     g_object_unref (pixmap);
+    #endif
 
     if (width || height)
     {
diff --git a/midori/sokoke.c b/midori/sokoke.c
index c83e0cb..d7b1705 100644
--- a/midori/sokoke.c
+++ b/midori/sokoke.c
@@ -12,6 +12,7 @@
 */
 
 #include "sokoke.h"
+#include "gtk3-compat.h"
 
 #if HAVE_CONFIG_H
     #include <config.h>
@@ -1015,7 +1016,7 @@ sokoke_combo_box_add_strings (GtkComboBox* combobox,
     va_start (args, label_first);
 
     for (label = label_first; label; label = va_arg (args, const gchar*))
-        gtk_combo_box_append_text (combobox, label);
+        gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), label);
 
     va_end (args);
 }
@@ -1513,15 +1514,15 @@ sokoke_register_stock_items (void)
         { STOCK_TRANSFER, NULL, 0, 0, GTK_STOCK_SAVE },
 
         { STOCK_BOOKMARK,       N_("_Bookmark"), 0, 0, GTK_STOCK_FILE },
-        { STOCK_BOOKMARKS,      N_("_Bookmarks"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_B, GTK_STOCK_DIRECTORY },
+        { STOCK_BOOKMARKS,      N_("_Bookmarks"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_B, GTK_STOCK_DIRECTORY },
         { STOCK_BOOKMARK_ADD,   N_("Add Boo_kmark"), 0, 0, GTK_STOCK_ADD },
         { STOCK_CONSOLE,        N_("_Console"), 0, 0, GTK_STOCK_DIALOG_WARNING },
         { STOCK_EXTENSIONS,     N_("_Extensions"), 0, 0, GTK_STOCK_CONVERT },
-        { STOCK_HISTORY,        N_("_History"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_H, GTK_STOCK_SORT_ASCENDING },
+        { STOCK_HISTORY,        N_("_History"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_H, GTK_STOCK_SORT_ASCENDING },
         { STOCK_HOMEPAGE,       N_("_Homepage"), 0, 0, GTK_STOCK_HOME },
         { STOCK_SCRIPTS,        N_("_Userscripts"), 0, 0, GTK_STOCK_EXECUTE },
         { STOCK_TAB_NEW,        N_("New _Tab"), 0, 0, GTK_STOCK_ADD },
-        { STOCK_TRANSFERS,      N_("_Transfers"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_J, GTK_STOCK_SAVE },
+        { STOCK_TRANSFERS,      N_("_Transfers"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_KEY_J, GTK_STOCK_SAVE },
         { STOCK_PLUGINS,        N_("Netscape p_lugins"), 0, 0, GTK_STOCK_CONVERT },
         { STOCK_USER_TRASH,     N_("_Closed Tabs"), 0, 0, "gtk-undo-ltr" },
         { STOCK_WINDOW_NEW,     N_("New _Window"), 0, 0, GTK_STOCK_ADD },
@@ -1865,7 +1866,7 @@ sokoke_window_activate_key (GtkWindow*   window,
 
     /* Hack to allow Ctrl + Shift + Tab */
     if (event->keyval == 65056)
-        event->keyval = GDK_Tab;
+        event->keyval = GDK_KEY_Tab;
 
     /* We don't use gtk_accel_groups_activate because it refuses to
         activate anything that gtk_accelerator_valid doesn't like. */
diff --git a/midori/webkitgtk-3.0.deps b/midori/webkitgtk-3.0.deps
new file mode 100644
index 0000000..91b1dfe
--- /dev/null
+++ b/midori/webkitgtk-3.0.deps
@@ -0,0 +1,8 @@
+atk
+gio-2.0
+cairo
+pango
+gdk-pixbuf-2.0
+gdk-3.0
+gtk+-3.0
+libsoup-2.4
diff --git a/midori/webkitgtk-3.0.vapi b/midori/webkitgtk-3.0.vapi
new file mode 100644
index 0000000..7f03374
--- /dev/null
+++ b/midori/webkitgtk-3.0.vapi
@@ -0,0 +1,653 @@
+/* webkit-1.0.vapi generated by vapigen, do not modify. */
+
+[CCode (cprefix = "WebKit", lower_case_cprefix = "webkit_")]
+namespace WebKit {
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class Download : GLib.Object {
+		[CCode (has_construct_function = false)]
+		public Download (WebKit.NetworkRequest request);
+		public void cancel ();
+		public uint64 get_current_size ();
+		public unowned string get_destination_uri ();
+		public double get_elapsed_time ();
+		public unowned WebKit.NetworkRequest get_network_request ();
+		public unowned WebKit.NetworkResponse get_network_response ();
+		public double get_progress ();
+		public WebKit.DownloadStatus get_status ();
+		public unowned string get_suggested_filename ();
+		public uint64 get_total_size ();
+		public unowned string get_uri ();
+		public void set_destination_uri (string destination_uri);
+		public void start ();
+		public uint64 current_size { get; }
+		public string destination_uri { get; set; }
+		public WebKit.NetworkRequest network_request { get; construct; }
+		public WebKit.NetworkResponse network_response { get; construct; }
+		public double progress { get; }
+		public WebKit.DownloadStatus status { get; }
+		public string suggested_filename { get; }
+		public uint64 total_size { get; }
+		public virtual signal bool error (int p0, int p1, string p2);
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class GeolocationPolicyDecision : GLib.Object {
+		[CCode (has_construct_function = false)]
+		protected GeolocationPolicyDecision ();
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class HitTestResult : GLib.Object {
+		[CCode (has_construct_function = false)]
+		protected HitTestResult ();
+		[NoAccessorMethod]
+		public WebKit.HitTestResultContext context { get; construct; }
+		[NoAccessorMethod]
+		public string image_uri { owned get; construct; }
+		[NoAccessorMethod]
+		public string link_uri { owned get; construct; }
+		[NoAccessorMethod]
+		public string media_uri { owned get; construct; }
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class NetworkRequest : GLib.Object {
+		[CCode (has_construct_function = false)]
+		public NetworkRequest (string uri);
+		public unowned Soup.Message get_message ();
+		public unowned string get_uri ();
+		public void set_uri (string uri);
+		public Soup.Message message { get; construct; }
+		public string uri { get; set; }
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class NetworkResponse : GLib.Object {
+		[CCode (has_construct_function = false)]
+		public NetworkResponse (string uri);
+		public unowned Soup.Message get_message ();
+		public unowned string get_uri ();
+		public void set_uri (string uri);
+		public Soup.Message message { get; construct; }
+		public string uri { get; set; }
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class SecurityOrigin : GLib.Object {
+		[CCode (has_construct_function = false)]
+		protected SecurityOrigin ();
+		public unowned GLib.List<WebKit.WebDatabase> get_all_web_databases ();
+		public unowned string get_host ();
+		public uint get_port ();
+		public unowned string get_protocol ();
+		public uint64 get_web_database_quota ();
+		public uint64 get_web_database_usage ();
+		public void set_web_database_quota (uint64 quota);
+		public string host { get; }
+		public uint port { get; }
+		public string protocol { get; }
+		public uint64 web_database_quota { get; set; }
+		public uint64 web_database_usage { get; }
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class SoupAuthDialog : GLib.Object, Soup.SessionFeature {
+		[CCode (has_construct_function = false)]
+		protected SoupAuthDialog ();
+		public virtual signal unowned Gtk.Widget current_toplevel (Soup.Message message);
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class WebBackForwardList : GLib.Object {
+		[CCode (has_construct_function = false)]
+		protected WebBackForwardList ();
+		public void add_item (WebKit.WebHistoryItem history_item);
+		public void clear ();
+		public bool contains_item (WebKit.WebHistoryItem history_item);
+		public unowned WebKit.WebHistoryItem get_back_item ();
+		public int get_back_length ();
+		public unowned GLib.List<WebKit.WebHistoryItem> get_back_list_with_limit (int limit);
+		public unowned WebKit.WebHistoryItem get_current_item ();
+		public unowned WebKit.WebHistoryItem get_forward_item ();
+		public int get_forward_length ();
+		public unowned GLib.List<WebKit.WebHistoryItem> get_forward_list_with_limit (int limit);
+		public int get_limit ();
+		public unowned WebKit.WebHistoryItem get_nth_item (int index);
+		public void go_back ();
+		public void go_forward ();
+		public void go_to_item (WebKit.WebHistoryItem history_item);
+		public void set_limit (int limit);
+		[CCode (has_construct_function = false)]
+		public WebBackForwardList.with_web_view (WebKit.WebView web_view);
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class WebDataSource : GLib.Object {
+		[CCode (has_construct_function = false)]
+		public WebDataSource ();
+		public unowned GLib.StringBuilder get_data ();
+		public unowned string get_encoding ();
+		public unowned WebKit.NetworkRequest get_initial_request ();
+		public unowned WebKit.WebResource get_main_resource ();
+		public unowned WebKit.NetworkRequest get_request ();
+		public unowned GLib.List<WebKit.WebResource> get_subresources ();
+		public unowned string get_unreachable_uri ();
+		public unowned WebKit.WebFrame get_web_frame ();
+		public bool is_loading ();
+		[CCode (has_construct_function = false)]
+		public WebDataSource.with_request (WebKit.NetworkRequest request);
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class WebDatabase : GLib.Object {
+		[CCode (has_construct_function = false)]
+		protected WebDatabase ();
+		public unowned string get_display_name ();
+		public uint64 get_expected_size ();
+		public unowned string get_filename ();
+		public unowned string get_name ();
+		public unowned WebKit.SecurityOrigin get_security_origin ();
+		public uint64 get_size ();
+		public void remove ();
+		public string display_name { get; }
+		public uint64 expected_size { get; }
+		public string filename { get; }
+		public string name { get; construct; }
+		public WebKit.SecurityOrigin security_origin { get; construct; }
+		public uint64 size { get; }
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class WebFrame : GLib.Object {
+		[CCode (has_construct_function = false)]
+		public WebFrame (WebKit.WebView web_view);
+		public unowned WebKit.WebFrame find_frame (string name);
+		public unowned WebKit.WebDataSource get_data_source ();
+		public Gtk.PolicyType get_horizontal_scrollbar_policy ();
+		public WebKit.LoadStatus get_load_status ();
+		public unowned string get_name ();
+		public unowned WebKit.NetworkResponse get_network_response ();
+		public unowned WebKit.WebFrame get_parent ();
+		public unowned WebKit.WebDataSource get_provisional_data_source ();
+		public unowned WebKit.SecurityOrigin get_security_origin ();
+		public unowned string get_title ();
+		public unowned string get_uri ();
+		public Gtk.PolicyType get_vertical_scrollbar_policy ();
+		public unowned WebKit.WebView get_web_view ();
+		public void load_alternate_string (string content, string base_url, string unreachable_url);
+		public void load_request (WebKit.NetworkRequest request);
+		public void load_string (string content, string mime_type, string encoding, string base_uri);
+		public void load_uri (string uri);
+		public void print ();
+		public Gtk.PrintOperationResult print_full (Gtk.PrintOperation operation, Gtk.PrintOperationAction action) throws GLib.Error;
+		public void reload ();
+		public void stop_loading ();
+		public Gtk.PolicyType horizontal_scrollbar_policy { get; }
+		public WebKit.LoadStatus load_status { get; }
+		public string name { get; }
+		public string title { get; }
+		public string uri { get; }
+		public Gtk.PolicyType vertical_scrollbar_policy { get; }
+		public virtual signal void cleared ();
+		public virtual signal void hovering_over_link (string p0, string p1);
+		public virtual signal void load_committed ();
+		public virtual signal void load_done (bool p0);
+		public virtual signal bool scrollbars_policy_changed ();
+		public virtual signal void title_changed (string p0);
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class WebHistoryItem : GLib.Object {
+		[CCode (has_construct_function = false)]
+		public WebHistoryItem ();
+		public unowned WebKit.WebHistoryItem copy ();
+		public unowned string get_alternate_title ();
+		public double get_last_visited_time ();
+		public unowned string get_original_uri ();
+		public unowned string get_title ();
+		public unowned string get_uri ();
+		public void set_alternate_title (string title);
+		[CCode (has_construct_function = false)]
+		public WebHistoryItem.with_data (string uri, string title);
+		public string alternate_title { get; set; }
+		public double last_visited_time { get; }
+		public string original_uri { get; }
+		public string title { get; }
+		public string uri { get; }
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class WebInspector : GLib.Object {
+		[CCode (has_construct_function = false)]
+		protected WebInspector ();
+		public void close ();
+		public unowned string get_inspected_uri ();
+		public unowned WebKit.WebView get_web_view ();
+		public void inspect_coordinates (double x, double y);
+		public void show ();
+		public string inspected_uri { get; }
+		[NoAccessorMethod]
+		public bool javascript_profiling_enabled { get; set; }
+		[NoAccessorMethod]
+		public bool timeline_profiling_enabled { get; set; }
+		public WebKit.WebView web_view { get; }
+		public virtual signal bool attach_window ();
+		public virtual signal bool close_window ();
+		public virtual signal bool detach_window ();
+		public virtual signal void finished ();
+		public virtual signal unowned WebKit.WebView inspect_web_view (WebKit.WebView p0);
+		public virtual signal bool show_window ();
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class WebNavigationAction : GLib.Object {
+		[CCode (has_construct_function = false)]
+		protected WebNavigationAction ();
+		public int get_button ();
+		public int get_modifier_state ();
+		public unowned string get_original_uri ();
+		public WebKit.WebNavigationReason get_reason ();
+		public unowned string get_target_frame ();
+		public void set_original_uri (string originalUri);
+		public void set_reason (WebKit.WebNavigationReason reason);
+		public int button { get; construct; }
+		public int modifier_state { get; construct; }
+		public string original_uri { get; set construct; }
+		public WebKit.WebNavigationReason reason { get; set construct; }
+		public string target_frame { get; construct; }
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class WebPolicyDecision : GLib.Object {
+		[CCode (has_construct_function = false)]
+		protected WebPolicyDecision ();
+		public void download ();
+		public void ignore ();
+		public void use ();
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class WebResource : GLib.Object {
+		[CCode (has_construct_function = false)]
+		public WebResource (string data, ssize_t size, string uri, string mime_type, string encoding, string frame_name);
+		public unowned GLib.StringBuilder get_data ();
+		public unowned string get_encoding ();
+		public unowned string get_frame_name ();
+		public unowned string get_mime_type ();
+		public unowned string get_uri ();
+		public string encoding { get; }
+		public string frame_name { get; }
+		public string mime_type { get; }
+		public string uri { get; construct; }
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class WebSettings : GLib.Object {
+		[CCode (has_construct_function = false)]
+		public WebSettings ();
+		public WebKit.WebSettings copy ();
+		public unowned string get_user_agent ();
+		[NoAccessorMethod]
+		public bool auto_load_images { get; set construct; }
+		[NoAccessorMethod]
+		public bool auto_resize_window { get; set construct; }
+		[NoAccessorMethod]
+		public bool auto_shrink_images { get; set construct; }
+		[NoAccessorMethod]
+		public string cursive_font_family { owned get; set construct; }
+		[NoAccessorMethod]
+		public string default_encoding { owned get; set construct; }
+		[NoAccessorMethod]
+		public string default_font_family { owned get; set construct; }
+		[NoAccessorMethod]
+		public int default_font_size { get; set construct; }
+		[NoAccessorMethod]
+		public int default_monospace_font_size { get; set construct; }
+		[NoAccessorMethod]
+		public WebKit.EditingBehavior editing_behavior { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_caret_browsing { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_default_context_menu { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_developer_extras { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_dom_paste { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_file_access_from_file_uris { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_html5_database { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_html5_local_storage { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_java_applet { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_offline_web_application_cache { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_page_cache { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_plugins { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_private_browsing { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_scripts { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_site_specific_quirks { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_spatial_navigation { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_spell_checking { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_universal_access_from_file_uris { get; set construct; }
+		[NoAccessorMethod]
+		public bool enable_xss_auditor { get; set construct; }
+		[NoAccessorMethod]
+		public bool enforce_96_dpi { get; set construct; }
+		[NoAccessorMethod]
+		public string fantasy_font_family { owned get; set construct; }
+		[NoAccessorMethod]
+		public bool javascript_can_access_clipboard { get; set construct; }
+		[NoAccessorMethod]
+		public bool javascript_can_open_windows_automatically { get; set construct; }
+		[NoAccessorMethod]
+		public int minimum_font_size { get; set construct; }
+		[NoAccessorMethod]
+		public int minimum_logical_font_size { get; set construct; }
+		[NoAccessorMethod]
+		public string monospace_font_family { owned get; set construct; }
+		[NoAccessorMethod]
+		public bool print_backgrounds { get; set construct; }
+		[NoAccessorMethod]
+		public bool resizable_text_areas { get; set construct; }
+		[NoAccessorMethod]
+		public string sans_serif_font_family { owned get; set construct; }
+		[NoAccessorMethod]
+		public string serif_font_family { owned get; set construct; }
+		[NoAccessorMethod]
+		public string spell_checking_languages { owned get; set construct; }
+		[NoAccessorMethod]
+		public bool tab_key_cycles_through_elements { get; set construct; }
+		[NoAccessorMethod]
+		public string user_agent { owned get; set construct; }
+		[NoAccessorMethod]
+		public string user_stylesheet_uri { owned get; set construct; }
+		[NoAccessorMethod]
+		public float zoom_step { get; set construct; }
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class WebView : Gtk.Container, Atk.Implementor, Gtk.Buildable {
+		[CCode (type = "GtkWidget*", has_construct_function = false)]
+		public WebView ();
+		public bool can_copy_clipboard ();
+		public bool can_cut_clipboard ();
+		public bool can_go_back ();
+		public bool can_go_back_or_forward (int steps);
+		public bool can_go_forward ();
+		public bool can_paste_clipboard ();
+		public bool can_redo ();
+		public bool can_show_mime_type (string mime_type);
+		public bool can_undo ();
+		[NoWrapper]
+		public virtual unowned string choose_file (WebKit.WebFrame frame, string old_file);
+		public void delete_selection ();
+		public void execute_script (string script);
+		public unowned WebKit.WebBackForwardList get_back_forward_list ();
+		public unowned Gtk.TargetList get_copy_target_list ();
+		public unowned string get_custom_encoding ();
+		public bool get_editable ();
+		public unowned string get_encoding ();
+		public unowned WebKit.WebFrame get_focused_frame ();
+		public bool get_full_content_zoom ();
+		public unowned WebKit.HitTestResult get_hit_test_result (Gdk.EventButton event);
+		public unowned string get_icon_uri ();
+		public unowned WebKit.WebInspector get_inspector ();
+		public WebKit.LoadStatus get_load_status ();
+		public unowned WebKit.WebFrame get_main_frame ();
+		public unowned Gtk.TargetList get_paste_target_list ();
+		public double get_progress ();
+		public unowned WebKit.WebSettings get_settings ();
+		public unowned string get_title ();
+		public bool get_transparent ();
+		public unowned string get_uri ();
+		public bool get_view_source_mode ();
+		public unowned WebKit.WebWindowFeatures get_window_features ();
+		public float get_zoom_level ();
+		public void go_back ();
+		public void go_back_or_forward (int steps);
+		public void go_forward ();
+		public bool go_to_back_forward_item (WebKit.WebHistoryItem item);
+		public bool has_selection ();
+		public void load_html_string (string content, string base_uri);
+		public void load_request (WebKit.NetworkRequest request);
+		public void load_string (string content, string mime_type, string encoding, string base_uri);
+		public void load_uri (string uri);
+		public uint mark_text_matches (string str, bool case_sensitive, uint limit);
+		public void open (string uri);
+		public void reload ();
+		public void reload_bypass_cache ();
+		public bool search_text (string text, bool case_sensitive, bool forward, bool wrap);
+		public void set_custom_encoding (string encoding);
+		public void set_editable (bool flag);
+		public void set_full_content_zoom (bool full_content_zoom);
+		public void set_highlight_text_matches (bool highlight);
+		public void set_maintains_back_forward_list (bool flag);
+		public void set_settings (WebKit.WebSettings settings);
+		public void set_transparent (bool flag);
+		public void set_view_source_mode (bool view_source_mode);
+		public void set_zoom_level (float zoom_level);
+		public void stop_loading ();
+		public void unmark_text_matches ();
+		public void zoom_in ();
+		public void zoom_out ();
+		public Gtk.TargetList copy_target_list { get; }
+		public string custom_encoding { get; set; }
+		public bool editable { get; set; }
+		public string encoding { get; }
+		public bool full_content_zoom { get; set; }
+		public string icon_uri { get; }
+		[NoAccessorMethod]
+		public Gtk.IMContext im_context { owned get; }
+		public WebKit.LoadStatus load_status { get; }
+		public Gtk.TargetList paste_target_list { get; }
+		public double progress { get; }
+		public WebKit.WebSettings settings { get; set; }
+		public string title { get; }
+		public bool transparent { get; set; }
+		public string uri { get; }
+		[NoAccessorMethod]
+		public WebKit.WebInspector web_inspector { owned get; }
+		[NoAccessorMethod]
+		public WebKit.WebWindowFeatures window_features { owned get; set; }
+		public float zoom_level { get; set; }
+		public virtual signal bool close_web_view ();
+		public virtual signal bool console_message (string message, int line_number, string source_id);
+		[HasEmitter]
+		public virtual signal void copy_clipboard ();
+		public virtual signal unowned Gtk.Widget create_plugin_widget (string p0, string p1, GLib.HashTable p2);
+		public virtual signal WebKit.WebView create_web_view (WebKit.WebFrame web_frame);
+		[HasEmitter]
+		public virtual signal void cut_clipboard ();
+		public virtual signal void database_quota_exceeded (GLib.Object p0, GLib.Object p1);
+		public virtual signal void document_load_finished (WebKit.WebFrame p0);
+		public virtual signal bool download_requested (GLib.Object p0);
+		public virtual signal void geolocation_policy_decision_cancelled (WebKit.WebFrame p0);
+		public virtual signal bool geolocation_policy_decision_requested (WebKit.WebFrame p0, WebKit.GeolocationPolicyDecision p1);
+		public virtual signal void hovering_over_link (string? p0, string p1);
+		public virtual signal void icon_loaded (string p0);
+		public virtual signal void load_committed (WebKit.WebFrame p0);
+		public virtual signal bool load_error (WebKit.WebFrame p0, string p1, void* p2);
+		public virtual signal void load_finished (WebKit.WebFrame p0);
+		public virtual signal void load_progress_changed (int p0);
+		public virtual signal void load_started (WebKit.WebFrame p0);
+		public virtual signal bool mime_type_policy_decision_requested (WebKit.WebFrame p0, WebKit.NetworkRequest p1, string p2, WebKit.WebPolicyDecision p3);
+		[HasEmitter]
+		public virtual signal bool move_cursor (Gtk.MovementStep step, int count);
+		public virtual signal bool navigation_policy_decision_requested (WebKit.WebFrame p0, WebKit.NetworkRequest p1, WebKit.WebNavigationAction p2, WebKit.WebPolicyDecision p3);
+		public virtual signal WebKit.NavigationResponse navigation_requested (WebKit.WebFrame frame, WebKit.NetworkRequest request);
+		public virtual signal bool new_window_policy_decision_requested (WebKit.WebFrame p0, WebKit.NetworkRequest p1, WebKit.WebNavigationAction p2, WebKit.WebPolicyDecision p3);
+		[HasEmitter]
+		public virtual signal void paste_clipboard ();
+		public virtual signal void populate_popup (Gtk.Menu p0);
+		public virtual signal bool print_requested (WebKit.WebFrame p0);
+		[HasEmitter]
+		public virtual signal void redo ();
+		public virtual signal void resource_request_starting (WebKit.WebFrame p0, WebKit.WebResource p1, WebKit.NetworkRequest p2, WebKit.NetworkResponse p3);
+		public virtual signal bool script_alert (WebKit.WebFrame frame, string alert_message);
+		public virtual signal bool script_confirm (WebKit.WebFrame frame, string confirm_message, void* did_confirm);
+		public virtual signal bool script_prompt (WebKit.WebFrame frame, string message, string default_value, void* value);
+		[HasEmitter]
+		public virtual signal void select_all ();
+		public virtual signal void selection_changed ();
+		public virtual signal void set_scroll_adjustments (Gtk.Adjustment hadjustment, Gtk.Adjustment vadjustment);
+		public virtual signal void status_bar_text_changed (string p0);
+		public virtual signal void title_changed (WebKit.WebFrame p0, string p1);
+		[HasEmitter]
+		public virtual signal void undo ();
+		public virtual signal bool web_view_ready ();
+		public virtual signal void window_object_cleared (WebKit.WebFrame frame, void* context, void* window_object);
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public class WebWindowFeatures : GLib.Object {
+		[CCode (has_construct_function = false)]
+		public WebWindowFeatures ();
+		public bool equal (WebKit.WebWindowFeatures features2);
+		[NoAccessorMethod]
+		public bool fullscreen { get; set construct; }
+		[NoAccessorMethod]
+		public int height { get; set construct; }
+		[NoAccessorMethod]
+		public bool locationbar_visible { get; set construct; }
+		[NoAccessorMethod]
+		public bool menubar_visible { get; set construct; }
+		[NoAccessorMethod]
+		public bool scrollbar_visible { get; set construct; }
+		[NoAccessorMethod]
+		public bool statusbar_visible { get; set construct; }
+		[NoAccessorMethod]
+		public bool toolbar_visible { get; set construct; }
+		[NoAccessorMethod]
+		public int width { get; set construct; }
+		[NoAccessorMethod]
+		public int x { get; set construct; }
+		[NoAccessorMethod]
+		public int y { get; set construct; }
+	}
+	[CCode (cprefix = "WEBKIT_CACHE_MODEL_", cheader_filename = "webkit/webkit.h")]
+	public enum CacheModel {
+		DOCUMENT_VIEWER,
+		WEB_BROWSER
+	}
+	[CCode (cprefix = "WEBKIT_DOWNLOAD_ERROR_", cheader_filename = "webkit/webkit.h")]
+	public enum DownloadError {
+		CANCELLED_BY_USER,
+		DESTINATION,
+		NETWORK
+	}
+	[CCode (cprefix = "WEBKIT_DOWNLOAD_STATUS_", cheader_filename = "webkit/webkit.h")]
+	public enum DownloadStatus {
+		ERROR,
+		CREATED,
+		STARTED,
+		CANCELLED,
+		FINISHED
+	}
+	[CCode (cprefix = "WEBKIT_EDITING_BEHAVIOR_", cheader_filename = "webkit/webkit.h")]
+	public enum EditingBehavior {
+		MAC,
+		WINDOWS
+	}
+	[CCode (cprefix = "WEBKIT_HIT_TEST_RESULT_CONTEXT_", cheader_filename = "webkit/webkit.h")]
+	[Flags]
+	public enum HitTestResultContext {
+		DOCUMENT,
+		LINK,
+		IMAGE,
+		MEDIA,
+		SELECTION,
+		EDITABLE
+	}
+	[CCode (cprefix = "WEBKIT_LOAD_", cheader_filename = "webkit/webkit.h")]
+	public enum LoadStatus {
+		PROVISIONAL,
+		COMMITTED,
+		FINISHED,
+		FIRST_VISUALLY_NON_EMPTY_LAYOUT,
+		FAILED
+	}
+	[CCode (cprefix = "WEBKIT_NAVIGATION_RESPONSE_", cheader_filename = "webkit/webkit.h")]
+	public enum NavigationResponse {
+		ACCEPT,
+		IGNORE,
+		DOWNLOAD
+	}
+	[CCode (cprefix = "WEBKIT_NETWORK_ERROR_", cheader_filename = "webkit/webkit.h")]
+	public enum NetworkError {
+		FAILED,
+		TRANSPORT,
+		UNKNOWN_PROTOCOL,
+		CANCELLED,
+		FILE_DOES_NOT_EXIST
+	}
+	[CCode (cprefix = "WEBKIT_PLUGIN_ERROR_", cheader_filename = "webkit/webkit.h")]
+	public enum PluginError {
+		FAILED,
+		CANNOT_FIND_PLUGIN,
+		CANNOT_LOAD_PLUGIN,
+		JAVA_UNAVAILABLE,
+		CONNECTION_CANCELLED,
+		WILL_HANDLE_LOAD
+	}
+	[CCode (cprefix = "WEBKIT_POLICY_ERROR_", cheader_filename = "webkit/webkit.h")]
+	public enum PolicyError {
+		FAILED,
+		CANNOT_SHOW_MIME_TYPE,
+		CANNOT_SHOW_URL,
+		FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE,
+		CANNOT_USE_RESTRICTED_PORT
+	}
+	[CCode (cprefix = "WEBKIT_WEB_NAVIGATION_REASON_", cheader_filename = "webkit/webkit.h")]
+	public enum WebNavigationReason {
+		LINK_CLICKED,
+		FORM_SUBMITTED,
+		BACK_FORWARD,
+		RELOAD,
+		FORM_RESUBMITTED,
+		OTHER
+	}
+	[CCode (cprefix = "WEBKIT_WEB_VIEW_TARGET_INFO_", cheader_filename = "webkit/webkit.h")]
+	public enum WebViewTargetInfo {
+		HTML,
+		TEXT,
+		IMAGE,
+		URI_LIST,
+		NETSCAPE_URL
+	}
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public const int MAJOR_VERSION;
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public const int MICRO_VERSION;
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public const int MINOR_VERSION;
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public const int USER_AGENT_MAJOR_VERSION;
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public const int USER_AGENT_MINOR_VERSION;
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public static bool check_version (uint major, uint minor, uint micro);
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public static void geolocation_policy_allow (WebKit.GeolocationPolicyDecision decision);
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public static void geolocation_policy_deny (WebKit.GeolocationPolicyDecision decision);
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public static WebKit.CacheModel get_cache_model ();
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public static unowned Soup.Session get_default_session ();
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public static uint64 get_default_web_database_quota ();
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public static unowned string get_web_database_directory_path ();
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public static uint major_version ();
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public static uint micro_version ();
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public static uint minor_version ();
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public static GLib.Quark network_error_quark ();
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public static GLib.Quark plugin_error_quark ();
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public static GLib.Quark policy_error_quark ();
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public static void remove_all_web_databases ();
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public static void set_cache_model (WebKit.CacheModel cache_model);
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public static void set_default_web_database_quota (uint64 defaultQuota);
+	[CCode (cheader_filename = "webkit/webkit.h")]
+	public static void set_web_database_directory_path (string path);
+}
diff --git a/panels/midori-bookmarks.c b/panels/midori-bookmarks.c
index b253860..dca50fa 100644
--- a/panels/midori-bookmarks.c
+++ b/panels/midori-bookmarks.c
@@ -10,6 +10,7 @@
 */
 
 #include "midori-bookmarks.h"
+#include "gtk3-compat.h"
 
 #include "midori-array.h"
 #include "midori-app.h"
@@ -846,7 +847,7 @@ midori_bookmarks_key_release_event_cb (GtkWidget*       widget,
                                        GdkEventKey*     event,
                                        MidoriBookmarks* bookmarks)
 {
-    if (event->keyval == GDK_Delete)
+    if (event->keyval == GDK_KEY_Delete)
         midori_bookmarks_delete_clicked_cb (widget, bookmarks);
 
     return FALSE;
diff --git a/panels/midori-history.c b/panels/midori-history.c
index 975b410..9dfa140 100644
--- a/panels/midori-history.c
+++ b/panels/midori-history.c
@@ -10,6 +10,7 @@
 */
 
 #include "midori-history.h"
+#include "gtk3-compat.h"
 
 #include "midori-app.h"
 #include "midori-array.h"
@@ -821,7 +822,7 @@ midori_history_key_release_event_cb (GtkWidget*     widget,
     GtkTreeModel* model;
     GtkTreeIter iter;
 
-    if (event->keyval != GDK_Delete)
+    if (event->keyval != GDK_KEY_Delete)
         return FALSE;
 
     if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (widget), &model, &iter))
diff --git a/toolbars/midori-findbar.c b/toolbars/midori-findbar.c
index 1622925..ae3e8c5 100644
--- a/toolbars/midori-findbar.c
+++ b/toolbars/midori-findbar.c
@@ -10,6 +10,7 @@
 */
 
 #include "midori-findbar.h"
+#include "gtk3-compat.h"
 
 #include "midori-browser.h"
 #include "gtkiconentry.h"
@@ -81,12 +82,12 @@ static gboolean
 midori_findbar_find_key_press_event_cb (MidoriFindbar* findbar,
                                         GdkEventKey*   event)
 {
-    if (event->keyval == GDK_Escape)
+    if (event->keyval == GDK_KEY_Escape)
     {
         midori_findbar_done (findbar);
         return TRUE;
     }
-    else if (event->keyval == GDK_Return
+    else if (event->keyval == GDK_KEY_Return
           && (event->state & GDK_SHIFT_MASK))
     {
         midori_findbar_find (findbar, FALSE);
diff --git a/wscript b/wscript
index 736ddfc..debd711 100644
--- a/wscript
+++ b/wscript
@@ -164,7 +164,7 @@ def configure (conf):
             atleast_version=version, mandatory=mandatory)
         return conf.env['HAVE_' + var]
 
-    if option_enabled ('unique'):
+    if option_enabled ('unique') and not option_enabled('gtk3'):
         check_pkg ('unique-1.0', '0.9', False)
         unique = ['N/A', 'yes'][conf.env['HAVE_UNIQUE'] == 1]
         if unique != 'yes':
@@ -195,8 +195,18 @@ def configure (conf):
         conf.check (header_name='X11/extensions/scrnsaver.h',
                     includes='/usr/X11R6/include', mandatory=False)
         conf.check (lib='Xss', libpath='/usr/X11R6/lib', mandatory=False)
-    check_pkg ('gtk+-2.0', '2.10.0', var='GTK', args=args)
-    check_pkg ('webkit-1.0', '1.1.17', args=args)
+    if option_enabled ('gtk3'):
+        check_pkg ('gtk+-3.0', '3.0.0', var='GTK', mandatory=False)
+        check_pkg ('webkitgtk-3.0', '1.1.17', var='WEBKIT', mandatory=False)
+        if not conf.env['HAVE_GTK'] or not conf.env['HAVE_WEBKIT']:
+            Utils.pprint ('RED', 'GTK+3 was not found.\n' \
+                'Pass --disable-gtk3 to build without GTK+3.')
+            sys.exit (1)
+        conf.env.append_value ('VALAFLAGS', '-D HAVE_GTK3')
+    else:
+        check_pkg ('gtk+-2.0', '2.10.0', var='GTK')
+        check_pkg ('webkit-1.0', '1.1.17', args=args)
+    conf.env['HAVE_GTK3'] = option_enabled ('gtk3')
     webkit_version = conf.check_cfg (modversion='webkit-1.0').split ('.')
     if int(webkit_version[0]) >= 1 and int(webkit_version[1]) >= 5 and int(webkit_version[2]) >= 1:
         check_pkg ('javascriptcoregtk-1.0', '1.1.17', args=args)
@@ -361,6 +371,7 @@ def set_options (opt):
     add_enable_option ('addons', 'building of extensions', group)
     add_enable_option ('tests', 'building of tests', group, disable=True)
     add_enable_option ('hildon', 'Maemo integration', group, disable=not is_maemo ())
+    add_enable_option ('gtk3', 'gtk3 and webkitgtk3 support')
 
     # Provided for compatibility
     opt.add_option ('--build', help='Ignored')


More information about the Xfce4-commits mailing list