[evolution/webkit: 2/196] Preliminary WebKit conversion.



commit e6969be8f300a5eed7e82eec145cfd43da848faf
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Mar 28 06:14:15 2010 -0400

    Preliminary WebKit conversion.
    
    - Change EWebView's base class from GtkHTML to WebKitWebView.
    
    - Use WebKit's search API in ESearchBar.  Much cleaner!
    
    - Add a web-inspector module.  Activate it by right-clicking in any
      WebKitWebView and selecting "Inspect...".
    
    - Use <object> tags in the contact preview widget (EABContactDisplay)
      for displaying the contact's photo and themed icons for various
      instant messaging services.  Doesn't seem to be working.

 addressbook/gui/widgets/eab-contact-display.c   |   79 +++-
 addressbook/importers/Makefile.am               |    7 +-
 configure.ac                                    |    1 +
 mail/e-mail-paned-view.c                        |    3 +-
 modules/Makefile.am                             |    1 +
 modules/mail/em-mailer-prefs.c                  |    6 +-
 modules/web-inspector/Makefile.am               |   21 +
 modules/web-inspector/evolution-web-inspector.c |  183 ++++++++
 widgets/misc/e-search-bar.c                     |  126 ++----
 widgets/misc/e-search-bar.h                     |    3 -
 widgets/misc/e-web-view.c                       |  569 +++++++++++------------
 widgets/misc/e-web-view.h                       |   19 +-
 12 files changed, 610 insertions(+), 408 deletions(-)
---
diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c
index 8ade5c5..2f43ef6 100644
--- a/addressbook/gui/widgets/eab-contact-display.c
+++ b/addressbook/gui/widgets/eab-contact-display.c
@@ -39,9 +39,6 @@
 
 #include <string.h>
 #include <glib/gi18n.h>
-#include <gtkhtml/gtkhtml.h>
-#include <gtkhtml/gtkhtml-stream.h>
-#include <gtkhtml/gtkhtml-embedded.h>
 
 #define EAB_CONTACT_DISPLAY_GET_PRIVATE(obj) \
 	(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -308,8 +305,10 @@ accum_name_value (GString *buffer,
 			buffer, "<td valign=\"top\" width=\"" IMAGE_COL_WIDTH "\">");
 		if (icon != NULL)
 			g_string_append_printf (
-				buffer, "<img width=\"16\" height=\"16\" "
-				"src=\"evo-icon:%s\"></td></tr>", icon);
+				buffer,
+				"<object width=\"16\" height=\"16\" "
+				"type=\"image/x-themed-icon\" "
+				"data=\"%s\"/></td></tr>", icon);
 		else
 			g_string_append_printf (buffer, "</td></tr>");
 	} else {
@@ -317,8 +316,10 @@ accum_name_value (GString *buffer,
 			buffer, "<tr><td valign=\"top\" width=\"" IMAGE_COL_WIDTH "\">");
 		if (icon != NULL)
 			g_string_append_printf (
-				buffer, "<img width=\"16\" height=\"16\" "
-				"src=\"evo-icon:%s\">", icon);
+				buffer,
+				"<object width=\"16\" height=\"16\" "
+				"type=\"image/x-themed-icon\" "
+				"data=\"%s\"/>", icon);
 		g_string_append_printf (
 			buffer, "</td><td valign=\"top\" width=\"100\" nowrap>"
 			"<font color=" HEADER_COLOR ">%s:</font>"
@@ -438,16 +439,23 @@ render_title_block (GString *buffer,
 		photo = e_contact_get (contact, E_CONTACT_LOGO);
 	/* Only handle inlined photos for now */
 	if (photo && photo->type == E_CONTACT_PHOTO_TYPE_INLINED) {
-		g_string_append (buffer, "<img border=\"1\" src=\"internal-contact-photo:\">");
+		g_string_append (
+			buffer,
+			"<object border=\"1\" "
+			"type=\"image/x-contact-photo\"/>");
 	} else if (photo && photo->type == E_CONTACT_PHOTO_TYPE_URI && photo->data.uri && *photo->data.uri) {
 		g_string_append_printf (buffer, "<img border=\"1\" src=\"%s\">", photo->data.uri);
 	}
+
 	if (photo)
 		e_contact_photo_free (photo);
 
 	if (e_contact_get (contact, E_CONTACT_IS_LIST))
-		g_string_append (buffer, "<img src=\"evo-icon:" CONTACT_LIST_ICON "\">");
-
+		g_string_append (
+			buffer, 
+			"<object width=\"16\" height=\"16\" "
+			"type=\"image/x-themed-icon\" "
+			"data=\"" CONTACT_LIST_ICON "\"/>");
 	g_string_append_printf (
 		buffer, "</td><td width=\"20\"></td><td %s valign=\"top\">\n",
 		TEXT_IS_RIGHT_TO_LEFT ? "align=\"right\"" : "");
@@ -989,7 +997,8 @@ eab_contact_display_render_compact (EABContactDisplay *display,
 			else
 				g_string_append_printf (
 					buffer,
-					"<img width=\"%d\" height=\"%d\" src=\"internal-contact-photo:\">",
+				"<object width=\"%d\" height=\"%d\" "
+				"type=\"image/x-contact-photo\"/>",
 					calced_width, calced_height);
 
 			e_contact_photo_free (photo);
@@ -1188,6 +1197,7 @@ contact_display_dispose (GObject *object)
 	G_OBJECT_CLASS (parent_class)->dispose (object);
 }
 
+#if 0  /* WEBKIT */
 static void
 contact_display_url_requested (GtkHTML *html,
                                const gchar *uri,
@@ -1256,6 +1266,48 @@ contact_display_url_requested (GtkHTML *html,
 	/* Chain up to parent's uri_requested() method. */
 	class->url_requested (html, uri, handle);
 }
+#endif
+
+static GtkWidget *
+contact_display_create_plugin_widget (EWebView *web_view,
+                                      const gchar *mime_type,
+                                      const gchar *uri,
+                                      GHashTable *param)
+{
+	EWebViewClass *web_view_class;
+	EABContactDisplay *display;
+
+	display = EAB_CONTACT_DISPLAY (web_view);
+
+	if (g_strcmp0 (mime_type, "image/x-contact-photo") == 0) {
+		EContactPhoto *photo;
+		EContact *contact;
+		GdkPixbuf *pixbuf;
+		GdkPixbufLoader *loader;
+		GtkWidget *widget = NULL;
+
+		contact = eab_contact_display_get_contact (display);
+		photo = e_contact_get (contact, E_CONTACT_PHOTO);
+		if (photo == NULL)
+			photo = e_contact_get (contact, E_CONTACT_LOGO);
+
+		loader = gdk_pixbuf_loader_new ();
+		gdk_pixbuf_loader_write (
+			loader, photo->data.inlined.data,
+			photo->data.inlined.length, NULL);
+		gdk_pixbuf_loader_close (loader, NULL);
+		pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
+		if (pixbuf != NULL)
+			widget = gtk_image_new_from_pixbuf (pixbuf);
+		g_object_unref (loader);
+
+		return widget;
+	}
+
+	/* Chain up to parent's create_plugin_widget() method. */
+	web_view_class = E_WEB_VIEW_CLASS (parent_class);
+	return web_view_class->create_plugin_widget (web_view, mime_type, uri, param);
+}
 
 static void
 contact_display_hovering_over_link (EWebView *web_view,
@@ -1419,7 +1471,9 @@ static void
 eab_contact_display_class_init (EABContactDisplayClass *class)
 {
 	GObjectClass *object_class;
+#if 0  /* WEBKIT */
 	GtkHTMLClass *html_class;
+#endif
 	EWebViewClass *web_view_class;
 
 	parent_class = g_type_class_peek_parent (class);
@@ -1430,10 +1484,13 @@ eab_contact_display_class_init (EABContactDisplayClass *class)
 	object_class->get_property = contact_display_get_property;
 	object_class->dispose = contact_display_dispose;
 
+#if 0  /* WEBKIT */
 	html_class = GTK_HTML_CLASS (class);
 	html_class->url_requested = contact_display_url_requested;
+#endif
 
 	web_view_class = E_WEB_VIEW_CLASS (class);
+	web_view_class->create_plugin_widget = contact_display_create_plugin_widget;
 	web_view_class->hovering_over_link = contact_display_hovering_over_link;
 	web_view_class->link_clicked = contact_display_link_clicked;
 	web_view_class->update_actions = contact_display_update_actions;
diff --git a/addressbook/importers/Makefile.am b/addressbook/importers/Makefile.am
index 2c5f587..b0f44ee 100644
--- a/addressbook/importers/Makefile.am
+++ b/addressbook/importers/Makefile.am
@@ -10,7 +10,7 @@ libevolution_addressbook_importers_la_CPPFLAGS =	\
 	-I$(top_srcdir)/widgets				\
 	-I$(top_builddir)/addressbook			\
 	$(EVOLUTION_DATA_SERVER_CFLAGS)			\
-	$(GTKHTML_CFLAGS)
+	$(WEBKITGTK_CFLAGS)
 
 libevolution_addressbook_importers_la_SOURCES = \
 	evolution-ldif-importer.c		\
@@ -24,7 +24,12 @@ libevolution_addressbook_importers_la_LIBADD = \
 	$(top_builddir)/e-util/libeutil.la 				\
 	$(top_builddir)/addressbook/util/libeabutil.la			\
 	$(top_builddir)/widgets/misc/libemiscwidgets.la			\
+<<<<<<< HEAD
 	$(EVOLUTION_DATA_SERVER_LIBS)					\
 	$(GTKHTML_LIBS)
+=======
+	$(GNOME_PLATFORM_LIBS)						\
+	$(IMPORTERS_LIBS)
+>>>>>>> Preliminary WebKit conversion.
 
 -include $(top_srcdir)/git.mk
diff --git a/configure.ac b/configure.ac
index 054aa55..04dda6f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1692,6 +1692,7 @@ modules/plugin-mono/Makefile
 modules/plugin-python/Makefile
 modules/spamassassin/Makefile
 modules/startup-wizard/Makefile
+modules/web-inspector/Makefile
 modules/windows-sens/Makefile
 plugins/Makefile
 plugins/addressbook-file/Makefile
diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c
index e1779a8..c926cc5 100644
--- a/mail/e-mail-paned-view.c
+++ b/mail/e-mail-paned-view.c
@@ -749,7 +749,7 @@ static void
 mail_paned_view_set_search_strings (EMailView *view,
                                     GSList *search_strings)
 {
-	EMailReader *reader;
+#if 0  /* WEBKIT */
 	EPreviewPane *preview_pane;
 	ESearchBar *search_bar;
 	ESearchingTokenizer *tokenizer;
@@ -769,6 +769,7 @@ mail_paned_view_set_search_strings (EMailView *view,
 	}
 
 	e_search_bar_changed (search_bar);
+#endif
 }
 
 static GalViewInstance *
diff --git a/modules/Makefile.am b/modules/Makefile.am
index ee3cdfd..671215b 100644
--- a/modules/Makefile.am
+++ b/modules/Makefile.am
@@ -35,6 +35,7 @@ SUBDIRS = \
 	plugin-manager \
 	spamassassin \
 	startup-wizard \
+	web-inspector \
 	$(MONO_DIR) \
 	$(PYTHON_DIR) \
 	$(ONLINE_ACCOUNTS_DIR) \
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index 3f5e371..d81656f 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -529,10 +529,10 @@ toggle_button_init (EMMailerPrefs *prefs,
                     const gchar *key,
                     GCallback toggled)
 {
-	gboolean bool;
+	gboolean v_bool;
 
-	bool = g_settings_get_boolean (prefs->settings, key);
-	gtk_toggle_button_set_active (toggle, not ? !bool : bool);
+	v_bool = g_settings_get_boolean (prefs->settings, key);
+	gtk_toggle_button_set_active (toggle, not ? !v_bool : v_bool);
 
 	if (toggled) {
 		g_object_set_data ((GObject *) toggle, "key", (gpointer) key);
diff --git a/modules/web-inspector/Makefile.am b/modules/web-inspector/Makefile.am
new file mode 100644
index 0000000..208011c
--- /dev/null
+++ b/modules/web-inspector/Makefile.am
@@ -0,0 +1,21 @@
+module_LTLIBRARIES = libevolution-module-web-inspector.la
+
+libevolution_module_web_inspector_la_CPPFLAGS =			\
+	$(AM_CPPFLAGS)						\
+	-I$(top_srcdir)						\
+	-I$(top_srcdir)/widgets					\
+	-DG_LOG_DOMAIN=\"evolution-web-inspector\"		\
+	$(GNOME_PLATFORM_CFLAGS)
+
+libevolution_module_web_inspector_la_SOURCES =			\
+	evolution-web-inspector.c
+
+libevolution_module_web_inspector_la_LIBADD =			\
+	$(top_builddir)/e-util/libeutil.la			\
+	$(top_builddir)/widgets/misc/libemiscwidgets.la		\
+	$(GNOME_PLATFORM_LIBS)
+
+libevolution_module_web_inspector_la_LDFLAGS =			\
+	-module -avoid-version $(NO_UNDEFINED)
+
+-include $(top_srcdir)/git.mk
diff --git a/modules/web-inspector/evolution-web-inspector.c b/modules/web-inspector/evolution-web-inspector.c
new file mode 100644
index 0000000..8682f75
--- /dev/null
+++ b/modules/web-inspector/evolution-web-inspector.c
@@ -0,0 +1,183 @@
+/*
+ * evolution-web-inspector.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include <config.h>
+#include <glib/gi18n-lib.h>
+
+#include <misc/e-web-view.h>
+#include <e-util/e-extension.h>
+
+/* Standard GObject macros */
+#define E_TYPE_WEB_INSPECTOR \
+	(e_web_inspector_get_type ())
+#define E_WEB_INSPECTOR(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), E_TYPE_WEB_INSPECTOR, EWebInspector))
+
+typedef struct _EWebInspector EWebInspector;
+typedef struct _EWebInspectorClass EWebInspectorClass;
+
+struct _EWebInspector {
+	EExtension parent;
+};
+
+struct _EWebInspectorClass {
+	EExtensionClass parent_class;
+};
+
+static const gchar *ui =
+"<ui>"
+"  <popup name='context'>"
+"    <menuitem action='inspect'/>"
+"  </popup>"
+"</ui>";
+
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+
+/* Forward Declarations */
+GType e_web_inspector_get_type (void);
+
+G_DEFINE_DYNAMIC_TYPE (EWebInspector, e_web_inspector, E_TYPE_EXTENSION)
+
+static EWebView *
+web_inspector_get_web_view (EWebInspector *extension)
+{
+	EExtensible *extensible;
+
+	extensible = e_extension_get_extensible (E_EXTENSION (extension));
+
+	return E_WEB_VIEW (extensible);
+}
+
+static void
+web_inspector_action_inspect_cb (GtkAction *action,
+                                 EWebInspector *extension)
+{
+	WebKitWebInspector *inspector;
+	EWebView *web_view;
+
+	web_view = web_inspector_get_web_view (extension);
+	inspector = webkit_web_view_get_inspector (WEBKIT_WEB_VIEW (web_view));
+
+	webkit_web_inspector_show (inspector);
+}
+
+static GtkActionEntry inspect_entries[] = {
+
+	{ "inspect",
+	  NULL,
+	  N_("_Inspect..."),
+	  NULL,
+	  N_("Inspect the HTML content (debugging feature)"),
+	  G_CALLBACK (web_inspector_action_inspect_cb) }
+};
+
+static WebKitWebView *
+web_inspector_inspect_web_view_cb (WebKitWebInspector *inspector,
+                                   EWebInspector *extension)
+{
+	GtkWidget *web_view;
+	GtkWidget *window;
+	const gchar *title;
+
+	title = _("Evolution Web Inspector");
+	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+	gtk_window_set_title (GTK_WINDOW (window), title);
+	gtk_widget_set_size_request (window, 600, 400);
+	gtk_widget_show (window);
+
+	web_view = webkit_web_view_new ();
+	gtk_container_add (GTK_CONTAINER (window), web_view);
+	gtk_widget_show (web_view);
+
+	return WEBKIT_WEB_VIEW (web_view);
+}
+
+static void
+web_inspector_constructed (GObject *object)
+{
+	EWebInspector *extension;
+	WebKitWebSettings *settings;
+	WebKitWebInspector *inspector;
+	GtkActionGroup *action_group;
+	GtkUIManager *ui_manager;
+	EWebView *web_view;
+	GError *error = NULL;
+
+	extension = E_WEB_INSPECTOR (object);
+	web_view = web_inspector_get_web_view (extension);
+
+	ui_manager = e_web_view_get_ui_manager (web_view);
+	action_group = e_web_view_get_action_group (web_view, "standard");
+
+	settings = webkit_web_view_get_settings (WEBKIT_WEB_VIEW (web_view));
+	g_object_set (settings, "enable-developer-extras", TRUE, NULL);
+
+	inspector = webkit_web_view_get_inspector (WEBKIT_WEB_VIEW (web_view));
+
+	g_signal_connect (
+		inspector, "inspect-web-view",
+		G_CALLBACK (web_inspector_inspect_web_view_cb), extension);
+
+	gtk_action_group_add_actions (
+		action_group, inspect_entries,
+		G_N_ELEMENTS (inspect_entries), extension);
+
+	/* Because we are loading from a hard-coded string, there is
+	 * no chance of I/O errors.  Failure here implies a malformed
+	 * UI definition.  Full stop. */
+	gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
+	if (error != NULL)
+		g_error ("%s", error->message);
+}
+
+static void
+e_web_inspector_class_init (EWebInspectorClass *class)
+{
+	GObjectClass *object_class;
+	EExtensionClass *extension_class;
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->constructed = web_inspector_constructed;
+
+	extension_class = E_EXTENSION_CLASS (class);
+	extension_class->extensible_type = E_TYPE_WEB_VIEW;
+}
+
+static void
+e_web_inspector_class_finalize (EWebInspectorClass *class)
+{
+}
+
+static void
+e_web_inspector_init (EWebInspector *extension)
+{
+}
+
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
+{
+	e_web_inspector_register_type (type_module);
+}
+
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
+{
+}
diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c
index eafb1b6..b2f8c36 100644
--- a/widgets/misc/e-search-bar.c
+++ b/widgets/misc/e-search-bar.c
@@ -27,7 +27,6 @@
 
 #include <glib/gi18n.h>
 #include <gdk/gdkkeysyms.h>
-#include <gtkhtml/gtkhtml-search.h>
 
 #define E_SEARCH_BAR_GET_PRIVATE(obj) \
 	(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -41,7 +40,6 @@ struct _ESearchBarPrivate {
 	GtkWidget *wrapped_prev_box;
 	GtkWidget *matches_label;
 
-	ESearchingTokenizer *tokenizer;
 	gchar *active_search;
 
 	guint rerun_search : 1;
@@ -69,46 +67,33 @@ G_DEFINE_TYPE (
 	GTK_TYPE_HBOX)
 
 static void
-search_bar_update_matches (ESearchBar *search_bar)
+search_bar_update_matches (ESearchBar *search_bar,
+                           guint matches)
 {
-	ESearchingTokenizer *tokenizer;
 	GtkWidget *matches_label;
-	gint matches;
 	gchar *text;
 
 	search_bar->priv->rerun_search = FALSE;
-
-	tokenizer = e_search_bar_get_tokenizer (search_bar);
 	matches_label = search_bar->priv->matches_label;
 
-	matches = e_searching_tokenizer_match_count (tokenizer);
-	text = g_strdup_printf (_("Matches: %d"), matches);
-
+	text = g_strdup_printf (_("Matches: %u"), matches);
 	gtk_label_set_text (GTK_LABEL (matches_label), text);
 	gtk_widget_show (matches_label);
-
 	g_free (text);
 }
 
 static void
-search_bar_update_tokenizer (ESearchBar *search_bar)
+search_bar_update_highlights (ESearchBar *search_bar)
 {
-	ESearchingTokenizer *tokenizer;
-	gboolean case_sensitive;
-	gchar *active_search;
+	EWebView *web_view;
+	gboolean visible;
 
-	tokenizer = e_search_bar_get_tokenizer (search_bar);
-	case_sensitive = e_search_bar_get_case_sensitive (search_bar);
+	web_view = e_search_bar_get_web_view (search_bar);
 
-	if (gtk_widget_get_visible (GTK_WIDGET (search_bar)))
-		active_search = search_bar->priv->active_search;
-	else
-		active_search = NULL;
+	visible = gtk_widget_get_visible (GTK_WIDGET (search_bar));
 
-	e_searching_tokenizer_set_primary_case_sensitivity (
-		tokenizer, case_sensitive);
-	e_searching_tokenizer_set_primary_search_string (
-		tokenizer, active_search);
+	webkit_web_view_set_highlight_text_matches (
+		WEBKIT_WEB_VIEW (web_view), visible);
 
 	e_search_bar_changed (search_bar);
 }
@@ -122,6 +107,7 @@ search_bar_find (ESearchBar *search_bar,
 	gboolean case_sensitive;
 	gboolean new_search;
 	gboolean wrapped = FALSE;
+	gboolean success;
 	gchar *text;
 
 	web_view = e_search_bar_get_web_view (search_bar);
@@ -138,44 +124,29 @@ search_bar_find (ESearchBar *search_bar,
 		(search_bar->priv->active_search == NULL) ||
 		(g_strcmp0 (text, search_bar->priv->active_search) != 0);
 
-	/* XXX On a new search, the HTMLEngine's search state gets
-	 *     destroyed when we redraw the message with highlighted
-	 *     matches (EMHTMLStream's write() method triggers this,
-	 *     but it's really GtkHtml's fault).  That's why the first
-	 *     match isn't selected automatically.  It also causes
-	 *     gtk_html_engine_search_next() to return FALSE, which we
-	 *     assume to mean the search wrapped.
-	 *
-	 *     So to avoid mistakenly thinking the search wrapped when
-	 *     it hasn't, we have to trap the first button click after a
-	 *     search and re-run the search to recreate the HTMLEngine's
-	 *     search state, so that gtk_html_engine_search_next() will
-	 *     succeed. */
 	if (new_search) {
-		g_free (search_bar->priv->active_search);
-		search_bar->priv->active_search = text;
-		search_bar->priv->rerun_search = TRUE;
-		search_bar_update_tokenizer (search_bar);
-	} else if (search_bar->priv->rerun_search) {
-		gtk_html_engine_search (
-			GTK_HTML (web_view),
-			search_bar->priv->active_search,
-			case_sensitive, search_forward, FALSE);
-		search_bar->priv->rerun_search = FALSE;
-		g_free (text);
-	} else {
-		gtk_html_engine_search_set_forward (
-			GTK_HTML (web_view), search_forward);
-		if (!gtk_html_engine_search_next (GTK_HTML (web_view)))
-			wrapped = TRUE;
-		g_free (text);
+		guint matches;
+
+		matches = webkit_web_view_mark_text_matches (
+			WEBKIT_WEB_VIEW (web_view),
+			text, case_sensitive, 0);
+		webkit_web_view_set_highlight_text_matches (
+			WEBKIT_WEB_VIEW (web_view), TRUE);
+		search_bar_update_matches (search_bar, matches);
 	}
 
-	if (new_search || wrapped)
-		gtk_html_engine_search (
-			GTK_HTML (web_view),
-			search_bar->priv->active_search,
-			case_sensitive, search_forward, FALSE);
+
+	success = webkit_web_view_search_text (
+		WEBKIT_WEB_VIEW (web_view),
+		text, case_sensitive, search_forward, FALSE);
+
+	if (!success)
+		wrapped = webkit_web_view_search_text (
+			WEBKIT_WEB_VIEW (web_view),
+			text, case_sensitive, search_forward, TRUE);
+
+	g_free (search_bar->priv->active_search);
+	search_bar->priv->active_search = text;
 
 	g_object_notify (G_OBJECT (search_bar), "active-search");
 
@@ -239,16 +210,10 @@ static void
 search_bar_set_web_view (ESearchBar *search_bar,
                          EWebView *web_view)
 {
-	GtkHTML *html;
-	ESearchingTokenizer *tokenizer;
-
+	g_return_if_fail (E_IS_WEB_VIEW (web_view));
 	g_return_if_fail (search_bar->priv->web_view == NULL);
 
 	search_bar->priv->web_view = g_object_ref (web_view);
-
-	html = GTK_HTML (web_view);
-	tokenizer = e_search_bar_get_tokenizer (search_bar);
-	gtk_html_set_tokenizer (html, HTML_TOKENIZER (tokenizer));
 }
 
 static void
@@ -352,11 +317,6 @@ search_bar_dispose (GObject *object)
 		priv->matches_label = NULL;
 	}
 
-	if (priv->tokenizer != NULL) {
-		g_object_unref (priv->tokenizer);
-		priv->tokenizer = NULL;
-	}
-
 	/* Chain up to parent's dispose() method. */
 	G_OBJECT_CLASS (e_search_bar_parent_class)->dispose (object);
 }
@@ -403,7 +363,7 @@ search_bar_show (GtkWidget *widget)
 
 	gtk_widget_grab_focus (search_bar->priv->entry);
 
-	search_bar_update_tokenizer (search_bar);
+	search_bar_update_highlights (search_bar);
 }
 
 static void
@@ -416,7 +376,7 @@ search_bar_hide (GtkWidget *widget)
 	/* Chain up to parent's hide() method. */
 	GTK_WIDGET_CLASS (e_search_bar_parent_class)->hide (widget);
 
-	search_bar_update_tokenizer (search_bar);
+	search_bar_update_highlights (search_bar);
 }
 
 static gboolean
@@ -438,6 +398,8 @@ search_bar_key_press_event (GtkWidget *widget,
 static void
 search_bar_clear (ESearchBar *search_bar)
 {
+	WebKitWebView *web_view;
+
 	g_free (search_bar->priv->active_search);
 	search_bar->priv->active_search = NULL;
 
@@ -447,7 +409,10 @@ search_bar_clear (ESearchBar *search_bar)
 	gtk_widget_hide (search_bar->priv->wrapped_prev_box);
 	gtk_widget_hide (search_bar->priv->matches_label);
 
-	search_bar_update_tokenizer (search_bar);
+	search_bar_update_highlights (search_bar);
+
+	web_view = WEBKIT_WEB_VIEW (search_bar->priv->web_view);
+	webkit_web_view_unmark_text_matches (web_view);
 
 	g_object_notify (G_OBJECT (search_bar), "active-search");
 }
@@ -542,11 +507,12 @@ e_search_bar_init (ESearchBar *search_bar)
 	GtkWidget *container;
 
 	search_bar->priv = E_SEARCH_BAR_GET_PRIVATE (search_bar);
-	search_bar->priv->tokenizer = e_searching_tokenizer_new ();
 
+#if 0  /* WEBKIT */
 	g_signal_connect_swapped (
 		search_bar->priv->tokenizer, "match",
 		G_CALLBACK (search_bar_update_matches), search_bar);
+#endif
 
 	gtk_box_set_spacing (GTK_BOX (search_bar), 12);
 
@@ -743,14 +709,6 @@ e_search_bar_get_web_view (ESearchBar *search_bar)
 	return search_bar->priv->web_view;
 }
 
-ESearchingTokenizer *
-e_search_bar_get_tokenizer (ESearchBar *search_bar)
-{
-	g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), NULL);
-
-	return search_bar->priv->tokenizer;
-}
-
 gboolean
 e_search_bar_get_active_search (ESearchBar *search_bar)
 {
diff --git a/widgets/misc/e-search-bar.h b/widgets/misc/e-search-bar.h
index 87e1023..4df8c97 100644
--- a/widgets/misc/e-search-bar.h
+++ b/widgets/misc/e-search-bar.h
@@ -23,7 +23,6 @@
 #define E_SEARCH_BAR_H
 
 #include <gtk/gtk.h>
-#include <misc/e-searching-tokenizer.h>
 #include <misc/e-web-view.h>
 
 /* Standard GObject macros */
@@ -69,8 +68,6 @@ GtkWidget *	e_search_bar_new		(EWebView *web_view);
 void		e_search_bar_clear		(ESearchBar *search_bar);
 void		e_search_bar_changed		(ESearchBar *search_bar);
 EWebView *	e_search_bar_get_web_view	(ESearchBar *search_bar);
-ESearchingTokenizer *
-		e_search_bar_get_tokenizer	(ESearchBar *search_bar);
 gboolean	e_search_bar_get_active_search
 						(ESearchBar *search_bar);
 gboolean	e_search_bar_get_case_sensitive
diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c
index 26c9224..157d56a 100644
--- a/widgets/misc/e-web-view.c
+++ b/widgets/misc/e-web-view.c
@@ -53,12 +53,11 @@ struct _EWebViewPrivate {
 	GtkAction *print_proxy;
 	GtkAction *save_as_proxy;
 
-	GtkTargetList *copy_target_list;
-	GtkTargetList *paste_target_list;
-
 	/* Lockdown Options */
 	guint disable_printing     : 1;
 	guint disable_save_to_disk : 1;
+
+	guint caret_mode : 1;
 };
 
 struct _EWebViewRequest {
@@ -66,7 +65,7 @@ struct _EWebViewRequest {
 	EWebView *web_view;
 	GCancellable *cancellable;
 	GInputStream *input_stream;
-	GtkHTMLStream *output_stream;
+	GString *output_buffer;
 	gchar buffer[4096];
 };
 
@@ -74,26 +73,20 @@ enum {
 	PROP_0,
 	PROP_ANIMATE,
 	PROP_CARET_MODE,
-	PROP_COPY_TARGET_LIST,
 	PROP_CURSOR_IMAGE,
 	PROP_CURSOR_IMAGE_SRC,
 	PROP_DISABLE_PRINTING,
 	PROP_DISABLE_SAVE_TO_DISK,
-	PROP_EDITABLE,
 	PROP_INLINE_SPELLING,
 	PROP_MAGIC_LINKS,
 	PROP_MAGIC_SMILEYS,
 	PROP_OPEN_PROXY,
-	PROP_PASTE_TARGET_LIST,
 	PROP_PRINT_PROXY,
 	PROP_SAVE_AS_PROXY,
 	PROP_SELECTED_URI
 };
 
 enum {
-	COPY_CLIPBOARD,
-	CUT_CLIPBOARD,
-	PASTE_CLIPBOARD,
 	POPUP_EVENT,
 	STATUS_MESSAGE,
 	STOP_LOADING,
@@ -135,7 +128,7 @@ static void e_web_view_selectable_init (ESelectableInterface *interface);
 G_DEFINE_TYPE_WITH_CODE (
 	EWebView,
 	e_web_view,
-	GTK_TYPE_HTML,
+	WEBKIT_TYPE_WEB_VIEW,
 	G_IMPLEMENT_INTERFACE (
 		E_TYPE_EXTENSIBLE, NULL)
 	G_IMPLEMENT_INTERFACE (
@@ -147,8 +140,7 @@ G_DEFINE_TYPE_WITH_CODE (
 
 static EWebViewRequest *
 web_view_request_new (EWebView *web_view,
-                      const gchar *uri,
-                      GtkHTMLStream *stream)
+                      const gchar *uri)
 {
 	EWebViewRequest *request;
 	GList *list;
@@ -164,7 +156,7 @@ web_view_request_new (EWebView *web_view,
 	request->web_view = g_object_ref (web_view);
 	request->cancellable = g_cancellable_new ();
 	request->input_stream = NULL;
-	request->output_stream = stream;
+	request->output_buffer = g_string_sized_new (4096);
 
 	list = request->web_view->priv->requests;
 	list = g_list_prepend (list, request);
@@ -189,6 +181,8 @@ web_view_request_free (EWebViewRequest *request)
 	if (request->input_stream != NULL)
 		g_object_unref (request->input_stream);
 
+	g_string_free (request->output_buffer, TRUE);
+
 	g_slice_free (EWebViewRequest, request);
 }
 
@@ -202,9 +196,6 @@ static gboolean
 web_view_request_check_for_error (EWebViewRequest *request,
                                   GError *error)
 {
-	GtkHTML *html;
-	GtkHTMLStream *stream;
-
 	if (error == NULL)
 		return FALSE;
 
@@ -216,10 +207,6 @@ web_view_request_check_for_error (EWebViewRequest *request,
 
 	/* XXX Should we log errors that are not cancellations? */
 
-	html = GTK_HTML (request->web_view);
-	stream = request->output_stream;
-
-	gtk_html_end (html, stream, GTK_HTML_STREAM_ERROR);
 	web_view_request_free (request);
 	g_error_free (error);
 
@@ -240,16 +227,15 @@ web_view_request_stream_read_cb (GInputStream *input_stream,
 		return;
 
 	if (bytes_read == 0) {
-		gtk_html_end (
-			GTK_HTML (request->web_view),
-			request->output_stream, GTK_HTML_STREAM_OK);
+		e_web_view_load_string (
+			request->web_view,
+			request->output_buffer->str);
 		web_view_request_free (request);
 		return;
 	}
 
-	gtk_html_write (
-		GTK_HTML (request->web_view),
-		request->output_stream, request->buffer, bytes_read);
+	g_string_append_len (
+		request->output_buffer, request->buffer, bytes_read);
 
 	g_input_stream_read_async (
 		request->input_stream, request->buffer,
@@ -470,55 +456,6 @@ static GtkActionEntry standard_entries[] = {
 	  G_CALLBACK (action_select_all_cb) }
 };
 
-static gboolean
-web_view_button_press_event_cb (EWebView *web_view,
-                                GdkEventButton *event,
-                                GtkHTML *frame)
-{
-	gboolean event_handled = FALSE;
-	gchar *uri = NULL;
-
-	if (event) {
-		GdkPixbufAnimation *anim;
-		gchar *image_src;
-
-		if (frame == NULL)
-			frame = GTK_HTML (web_view);
-
-		anim = gtk_html_get_image_at (frame, event->x, event->y);
-		e_web_view_set_cursor_image (web_view, anim);
-		if (anim != NULL)
-			g_object_unref (anim);
-
-		image_src = gtk_html_get_image_src_at (
-			frame, event->x, event->y);
-		e_web_view_set_cursor_image_src (web_view, image_src);
-		g_free (image_src);
-	}
-
-	if (event != NULL && event->button != 3)
-		return FALSE;
-
-	/* Only extract a URI if no selection is active.  Selected text
-	 * implies the user is more likely to want to copy the selection
-	 * to the clipboard than open a link within the selection. */
-	if (!e_web_view_is_selection_active (web_view))
-		uri = e_web_view_extract_uri (web_view, event, frame);
-
-	if (uri != NULL && g_str_has_prefix (uri, "##")) {
-		g_free (uri);
-		return FALSE;
-	}
-
-	g_signal_emit (
-		web_view, signals[POPUP_EVENT], 0,
-		event, uri, &event_handled);
-
-	g_free (uri);
-
-	return event_handled;
-}
-
 static void
 web_view_menu_item_select_cb (EWebView *web_view,
                               GtkWidget *widget)
@@ -560,6 +497,98 @@ web_view_connect_proxy_cb (EWebView *web_view,
 		G_CALLBACK (web_view_menu_item_deselect_cb), web_view);
 }
 
+static GtkWidget *
+web_view_create_plugin_widget_cb (EWebView *web_view,
+                                  const gchar *mime_type,
+                                  const gchar *uri,
+                                  GHashTable *param)
+{
+	EWebViewClass *class;
+
+	/* XXX WebKitWebView does not provide a class method for
+	 *     this signal, so we do so we can override the default
+	 *     behavior from subclasses for special URI types. */
+
+	class = E_WEB_VIEW_GET_CLASS (web_view);
+	g_return_val_if_fail (class->create_plugin_widget != NULL, NULL);
+
+	return class->create_plugin_widget (web_view, mime_type, uri, param);
+}
+
+static void
+web_view_hovering_over_link_cb (EWebView *web_view,
+                                const gchar *title,
+                                const gchar *uri)
+{
+	EWebViewClass *class;
+
+	/* XXX WebKitWebView does not provide a class method for
+	 *     this signal, so we do so we can override the default
+	 *     behavior from subclasses for special URI types. */
+
+	class = E_WEB_VIEW_GET_CLASS (web_view);
+	g_return_if_fail (class->hovering_over_link != NULL);
+
+	class->hovering_over_link (web_view, title, uri);
+}
+
+static gboolean
+web_view_navigation_policy_decision_requested_cb (EWebView *web_view,
+                                                  WebKitWebFrame *frame,
+                                                  WebKitNetworkRequest *request,
+                                                  WebKitWebNavigationAction *navigation_action,
+                                                  WebKitWebPolicyDecision *policy_decision)
+{
+	EWebViewClass *class;
+	WebKitWebNavigationReason reason;
+	const gchar *uri;
+
+	reason = webkit_web_navigation_action_get_reason (navigation_action);
+	if (reason != WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED)
+		return FALSE;
+
+	/* XXX WebKitWebView does not provide a class method for
+	 *     this signal, so we do so we can override the default
+	 *     behavior from subclasses for special URI types. */
+
+	class = E_WEB_VIEW_GET_CLASS (web_view);
+	g_return_val_if_fail (class->link_clicked != NULL, FALSE);
+
+	webkit_web_policy_decision_ignore (policy_decision);
+
+	uri = webkit_network_request_get_uri (request);
+
+	class->link_clicked (web_view, uri);
+
+	return TRUE;
+}
+
+static gboolean
+web_view_notify_load_state_idle_cb (gpointer data)
+{
+	/* XXX Xan says I need to queue a resize here in order for
+	 *     embedded widgets to show.  It's a WebKit/GTK+ bug. */
+	gtk_widget_queue_resize (GTK_WIDGET (data));
+
+	g_debug ("Load Finished");
+
+	return FALSE;
+}
+
+static void
+web_view_notify_load_status_cb (WebKitWebView *web_view,
+                                GParamSpec *pspec)
+{
+	WebKitLoadStatus load_status;
+
+	load_status = webkit_web_view_get_load_status (web_view);
+
+	if (load_status == WEBKIT_LOAD_FINISHED) {
+		gdk_threads_add_idle (
+			web_view_notify_load_state_idle_cb, web_view);
+	}
+}
+
 static void
 web_view_set_property (GObject *object,
                        guint property_id,
@@ -603,12 +632,6 @@ web_view_set_property (GObject *object,
 				g_value_get_boolean (value));
 			return;
 
-		case PROP_EDITABLE:
-			e_web_view_set_editable (
-				E_WEB_VIEW (object),
-				g_value_get_boolean (value));
-			return;
-
 		case PROP_INLINE_SPELLING:
 			e_web_view_set_inline_spelling (
 				E_WEB_VIEW (object),
@@ -674,12 +697,6 @@ web_view_get_property (GObject *object,
 				E_WEB_VIEW (object)));
 			return;
 
-		case PROP_COPY_TARGET_LIST:
-			g_value_set_boxed (
-				value, e_web_view_get_copy_target_list (
-				E_WEB_VIEW (object)));
-			return;
-
 		case PROP_CURSOR_IMAGE:
 			g_value_set_object (
 				value, e_web_view_get_cursor_image (
@@ -704,12 +721,6 @@ web_view_get_property (GObject *object,
 				E_WEB_VIEW (object)));
 			return;
 
-		case PROP_EDITABLE:
-			g_value_set_boolean (
-				value, e_web_view_get_editable (
-				E_WEB_VIEW (object)));
-			return;
-
 		case PROP_INLINE_SPELLING:
 			g_value_set_boolean (
 				value, e_web_view_get_inline_spelling (
@@ -734,12 +745,6 @@ web_view_get_property (GObject *object,
 				E_WEB_VIEW (object)));
 			return;
 
-		case PROP_PASTE_TARGET_LIST:
-			g_value_set_boxed (
-				value, e_web_view_get_paste_target_list (
-				E_WEB_VIEW (object)));
-			return;
-
 		case PROP_PRINT_PROXY:
 			g_value_set_object (
 				value, e_web_view_get_print_proxy (
@@ -789,16 +794,6 @@ web_view_dispose (GObject *object)
 		priv->save_as_proxy = NULL;
 	}
 
-	if (priv->copy_target_list != NULL) {
-		gtk_target_list_unref (priv->copy_target_list);
-		priv->copy_target_list = NULL;
-	}
-
-	if (priv->paste_target_list != NULL) {
-		gtk_target_list_unref (priv->paste_target_list);
-		priv->paste_target_list = NULL;
-	}
-
 	if (priv->cursor_image != NULL) {
 		g_object_unref (priv->cursor_image);
 		priv->cursor_image = NULL;
@@ -861,12 +856,31 @@ web_view_button_press_event (GtkWidget *widget,
 {
 	GtkWidgetClass *widget_class;
 	EWebView *web_view;
+	gboolean event_handled = FALSE;
+	gchar *uri;
 
 	web_view = E_WEB_VIEW (widget);
 
-	if (web_view_button_press_event_cb (web_view, event, NULL))
+	if (event != NULL && event->button != 3)
+		goto chainup;
+
+	uri = e_web_view_extract_uri (web_view, event);
+
+	if (uri != NULL && g_str_has_prefix (uri, "##")) {
+		g_free (uri);
+		goto chainup;
+	}
+
+	g_signal_emit (
+		web_view, signals[POPUP_EVENT], 0,
+		event, uri, &event_handled);
+
+	g_free (uri);
+
+	if (event_handled)
 		return TRUE;
 
+chainup:
 	/* Chain up to parent's button_press_event() method. */
 	widget_class = GTK_WIDGET_CLASS (parent_class);
 	return widget_class->button_press_event (widget, event);
@@ -879,10 +893,10 @@ web_view_scroll_event (GtkWidget *widget,
 	if (event->state & GDK_CONTROL_MASK) {
 		switch (event->direction) {
 			case GDK_SCROLL_UP:
-				gtk_html_zoom_in (GTK_HTML (widget));
+				e_web_view_zoom_in (E_WEB_VIEW (widget));
 				return TRUE;
 			case GDK_SCROLL_DOWN:
-				gtk_html_zoom_out (GTK_HTML (widget));
+				e_web_view_zoom_out (E_WEB_VIEW (widget));
 				return TRUE;
 			default:
 				break;
@@ -892,6 +906,7 @@ web_view_scroll_event (GtkWidget *widget,
 	return FALSE;
 }
 
+#if 0  /* WEBKIT */
 static void
 web_view_url_requested (GtkHTML *html,
                         const gchar *uri,
@@ -906,60 +921,73 @@ web_view_url_requested (GtkHTML *html,
 		request->cancellable, (GAsyncReadyCallback)
 		web_view_request_read_cb, request);
 }
+#endif
 
-static void
-web_view_gtkhtml_link_clicked (GtkHTML *html,
-                               const gchar *uri)
+static GtkWidget *
+web_view_create_plugin_widget (EWebView *web_view,
+                               const gchar *mime_type,
+                               const gchar *uri,
+                               GHashTable *param)
 {
-	EWebViewClass *class;
-	EWebView *web_view;
+	GtkWidget *widget = NULL;
 
-	web_view = E_WEB_VIEW (html);
+	if (g_strcmp0 (mime_type, "image/x-themed-icon") == 0) {
+		GtkIconTheme *icon_theme;
+		GdkPixbuf *pixbuf;
+		gpointer data;
+		glong size = 0;
+		GError *error = NULL;
 
-	class = E_WEB_VIEW_GET_CLASS (web_view);
-	g_return_if_fail (class->link_clicked != NULL);
+		icon_theme = gtk_icon_theme_get_default ();
 
-	class->link_clicked (web_view, uri);
-}
-
-static void
-web_view_on_url (GtkHTML *html,
-                 const gchar *uri)
-{
-	EWebViewClass *class;
-	EWebView *web_view;
-
-	web_view = E_WEB_VIEW (html);
+		if (size == 0) {
+			data = g_hash_table_lookup (param, "width");
+			if (data != NULL)
+				size = MAX (size, strtol (data, NULL, 10));
+		}
 
-	class = E_WEB_VIEW_GET_CLASS (web_view);
-	g_return_if_fail (class->hovering_over_link != NULL);
+		if (size == 0) {
+			data = g_hash_table_lookup (param, "height");
+			if (data != NULL)
+				size = MAX (size, strtol (data, NULL, 10));
+		}
 
-	/* XXX WebKit would supply a title here. */
-	class->hovering_over_link (web_view, NULL, uri);
-}
+		if (size == 0)
+			size = 32;  /* arbitrary default */
+
+		pixbuf = gtk_icon_theme_load_icon (
+			icon_theme, uri, size, 0, &error);
+		if (pixbuf != NULL) {
+			widget = gtk_image_new_from_pixbuf (pixbuf);
+			g_object_unref (pixbuf);
+		} else if (error != NULL) {
+			g_warning ("%s", error->message);
+			g_error_free (error);
+		}
+	}
 
-static void
-web_view_iframe_created (GtkHTML *html,
-                         GtkHTML *iframe)
-{
-	g_signal_connect_swapped (
-		iframe, "button-press-event",
-		G_CALLBACK (web_view_button_press_event_cb), html);
+	return widget;
 }
 
 static gchar *
 web_view_extract_uri (EWebView *web_view,
-                      GdkEventButton *event,
-                      GtkHTML *html)
+                      GdkEventButton *event)
 {
-	gchar *uri;
+	WebKitHitTestResult *result;
+	WebKitHitTestResultContext context;
+	gchar *uri = NULL;
 
-	if (event != NULL)
-		uri = gtk_html_get_url_at (html, event->x, event->y);
-	else
-		uri = gtk_html_get_cursor_url (html);
+	result = webkit_web_view_get_hit_test_result (
+		WEBKIT_WEB_VIEW (web_view), event);
 
-	return uri;
+	g_object_get (result, "context", &context, "link-uri", &uri, NULL);
+
+	if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK)
+		return uri;
+
+	g_free (uri);
+
+	return NULL;
 }
 
 static void
@@ -1030,30 +1058,12 @@ static void
 web_view_load_string (EWebView *web_view,
                       const gchar *string)
 {
-	if (string != NULL && *string != '\0')
-		gtk_html_load_from_string (GTK_HTML (web_view), string, -1);
-	else
-		e_web_view_clear (web_view);
-}
-
-static void
-web_view_copy_clipboard (EWebView *web_view)
-{
-	gtk_html_command (GTK_HTML (web_view), "copy");
-}
-
-static void
-web_view_cut_clipboard (EWebView *web_view)
-{
-	if (e_web_view_get_editable (web_view))
-		gtk_html_command (GTK_HTML (web_view), "cut");
-}
+	if (string == NULL)
+		string = "";
 
-static void
-web_view_paste_clipboard (EWebView *web_view)
-{
-	if (e_web_view_get_editable (web_view))
-		gtk_html_command (GTK_HTML (web_view), "paste");
+	webkit_web_view_load_string (
+		WEBKIT_WEB_VIEW (web_view),
+		string, "text/html", "UTF-8", NULL);
 }
 
 static gboolean
@@ -1074,7 +1084,7 @@ web_view_stop_loading (EWebView *web_view)
 		web_view->priv->requests, (GFunc)
 		web_view_request_cancel, NULL);
 
-	gtk_html_stop (GTK_HTML (web_view));
+	webkit_web_view_stop_loading (WEBKIT_WEB_VIEW (web_view));
 }
 
 static void
@@ -1267,48 +1277,27 @@ web_view_selectable_update_actions (ESelectable *selectable,
                                     GdkAtom *clipboard_targets,
                                     gint n_clipboard_targets)
 {
-	EWebView *web_view;
+	WebKitWebView *web_view;
 	GtkAction *action;
-	/*GtkTargetList *target_list;*/
-	gboolean can_paste = FALSE;
-	gboolean editable;
-	gboolean have_selection;
 	gboolean sensitive;
 	const gchar *tooltip;
-	/*gint ii;*/
 
-	web_view = E_WEB_VIEW (selectable);
-	editable = e_web_view_get_editable (web_view);
-	have_selection = e_web_view_is_selection_active (web_view);
-
-	/* XXX GtkHtml implements its own clipboard instead of using
-	 *     GDK_SELECTION_CLIPBOARD, so we don't get notifications
-	 *     when the clipboard contents change.  The logic below
-	 *     is what we would do if GtkHtml worked properly.
-	 *     Instead, we need to keep the Paste action sensitive so
-	 *     its accelerator overrides GtkHtml's key binding. */
-#if 0
-	target_list = e_selectable_get_paste_target_list (selectable);
-	for (ii = 0; ii < n_clipboard_targets && !can_paste; ii++)
-		can_paste = gtk_target_list_find (
-			target_list, clipboard_targets[ii], NULL);
-#endif
-	can_paste = TRUE;
+	web_view = WEBKIT_WEB_VIEW (selectable);
 
 	action = e_focus_tracker_get_cut_clipboard_action (focus_tracker);
-	sensitive = editable && have_selection;
+	sensitive = webkit_web_view_can_cut_clipboard (web_view);
 	tooltip = _("Cut the selection");
 	gtk_action_set_sensitive (action, sensitive);
 	gtk_action_set_tooltip (action, tooltip);
 
 	action = e_focus_tracker_get_copy_clipboard_action (focus_tracker);
-	sensitive = have_selection;
+	sensitive = webkit_web_view_can_copy_clipboard (web_view);
 	tooltip = _("Copy the selection");
 	gtk_action_set_sensitive (action, sensitive);
 	gtk_action_set_tooltip (action, tooltip);
 
 	action = e_focus_tracker_get_paste_clipboard_action (focus_tracker);
-	sensitive = editable && can_paste;
+	sensitive = webkit_web_view_can_paste_clipboard (web_view);
 	tooltip = _("Paste the clipboard");
 	gtk_action_set_sensitive (action, sensitive);
 	gtk_action_set_tooltip (action, tooltip);
@@ -1349,7 +1338,9 @@ e_web_view_class_init (EWebViewClass *class)
 {
 	GObjectClass *object_class;
 	GtkWidgetClass *widget_class;
+#if 0  /* WEBKIT */
 	GtkHTMLClass *html_class;
+#endif
 
 	parent_class = g_type_class_peek_parent (class);
 	g_type_class_add_private (class, sizeof (EWebViewPrivate));
@@ -1365,19 +1356,16 @@ e_web_view_class_init (EWebViewClass *class)
 	widget_class->button_press_event = web_view_button_press_event;
 	widget_class->scroll_event = web_view_scroll_event;
 
+#if 0  /* WEBKIT */
 	html_class = GTK_HTML_CLASS (class);
 	html_class->url_requested = web_view_url_requested;
-	html_class->link_clicked = web_view_gtkhtml_link_clicked;
-	html_class->on_url = web_view_on_url;
-	html_class->iframe_created = web_view_iframe_created;
+#endif
 
+	class->create_plugin_widget = web_view_create_plugin_widget;
 	class->extract_uri = web_view_extract_uri;
 	class->hovering_over_link = web_view_hovering_over_link;
 	class->link_clicked = web_view_link_clicked;
 	class->load_string = web_view_load_string;
-	class->copy_clipboard = web_view_copy_clipboard;
-	class->cut_clipboard = web_view_cut_clipboard;
-	class->paste_clipboard = web_view_paste_clipboard;
 	class->popup_event = web_view_popup_event;
 	class->stop_loading = web_view_stop_loading;
 	class->update_actions = web_view_update_actions;
@@ -1452,16 +1440,6 @@ e_web_view_class_init (EWebViewClass *class)
 
 	g_object_class_install_property (
 		object_class,
-		PROP_EDITABLE,
-		g_param_spec_boolean (
-			"editable",
-			"Editable",
-			NULL,
-			FALSE,
-			G_PARAM_READWRITE));
-
-	g_object_class_install_property (
-		object_class,
 		PROP_INLINE_SPELLING,
 		g_param_spec_boolean (
 			"inline-spelling",
@@ -1500,12 +1478,6 @@ e_web_view_class_init (EWebViewClass *class)
 			GTK_TYPE_ACTION,
 			G_PARAM_READWRITE));
 
-	/* Inherited from ESelectableInterface */
-	g_object_class_override_property (
-		object_class,
-		PROP_PASTE_TARGET_LIST,
-		"paste-target-list");
-
 	g_object_class_install_property (
 		object_class,
 		PROP_PRINT_PROXY,
@@ -1536,33 +1508,6 @@ e_web_view_class_init (EWebViewClass *class)
 			NULL,
 			G_PARAM_READWRITE));
 
-	signals[COPY_CLIPBOARD] = g_signal_new (
-		"copy-clipboard",
-		G_TYPE_FROM_CLASS (class),
-		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-		G_STRUCT_OFFSET (EWebViewClass, copy_clipboard),
-		NULL, NULL,
-		g_cclosure_marshal_VOID__VOID,
-		G_TYPE_NONE, 0);
-
-	signals[CUT_CLIPBOARD] = g_signal_new (
-		"cut-clipboard",
-		G_TYPE_FROM_CLASS (class),
-		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-		G_STRUCT_OFFSET (EWebViewClass, cut_clipboard),
-		NULL, NULL,
-		g_cclosure_marshal_VOID__VOID,
-		G_TYPE_NONE, 0);
-
-	signals[PASTE_CLIPBOARD] = g_signal_new (
-		"paste-clipboard",
-		G_TYPE_FROM_CLASS (class),
-		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-		G_STRUCT_OFFSET (EWebViewClass, paste_clipboard),
-		NULL, NULL,
-		g_cclosure_marshal_VOID__VOID,
-		G_TYPE_NONE, 0);
-
 	signals[POPUP_EVENT] = g_signal_new (
 		"popup-event",
 		G_TYPE_FROM_CLASS (class),
@@ -1634,14 +1579,31 @@ e_web_view_init (EWebView *web_view)
 {
 	GtkUIManager *ui_manager;
 	GtkActionGroup *action_group;
-	GtkTargetList *target_list;
 	EPopupAction *popup_action;
+	WebKitWebSettings *web_settings;
 	const gchar *domain = GETTEXT_PACKAGE;
 	const gchar *id;
 	GError *error = NULL;
 
 	web_view->priv = E_WEB_VIEW_GET_PRIVATE (web_view);
 
+	g_signal_connect (
+		web_view, "create-plugin-widget",
+		G_CALLBACK (web_view_create_plugin_widget_cb), NULL);
+
+	g_signal_connect (
+		web_view, "hovering-over-link",
+		G_CALLBACK (web_view_hovering_over_link_cb), NULL);
+
+	g_signal_connect (
+		web_view, "navigation-policy-decision-requested",
+		G_CALLBACK (web_view_navigation_policy_decision_requested_cb),
+		NULL);
+
+	g_signal_connect (
+		web_view, "notify::load-status",
+		G_CALLBACK (web_view_notify_load_status_cb), NULL);
+
 	ui_manager = gtk_ui_manager_new ();
 	web_view->priv->ui_manager = ui_manager;
 
@@ -1649,11 +1611,14 @@ e_web_view_init (EWebView *web_view)
 		ui_manager, "connect-proxy",
 		G_CALLBACK (web_view_connect_proxy_cb), web_view);
 
-	target_list = gtk_target_list_new (NULL, 0);
-	web_view->priv->copy_target_list = target_list;
+	web_settings = webkit_web_view_get_settings (
+		WEBKIT_WEB_VIEW (web_view));
 
-	target_list = gtk_target_list_new (NULL, 0);
-	web_view->priv->paste_target_list = target_list;
+	g_object_bind_property (
+		web_view, "caret-mode",
+		web_settings, "enable-caret-browsing",
+		G_BINDING_BIDIRECTIONAL |
+		G_BINDING_SYNC_CREATE);
 
 	action_group = gtk_action_group_new ("uri");
 	gtk_action_group_set_translation_domain (action_group, domain);
@@ -1776,7 +1741,7 @@ e_web_view_clear (EWebView *web_view)
 {
 	g_return_if_fail (E_IS_WEB_VIEW (web_view));
 
-	gtk_html_load_empty (GTK_HTML (web_view));
+	e_web_view_load_string (web_view, NULL);
 }
 
 void
@@ -1796,18 +1761,23 @@ e_web_view_load_string (EWebView *web_view,
 gboolean
 e_web_view_get_animate (EWebView *web_view)
 {
+#if 0  /* WEBKIT - XXX No equivalent property? */
 	/* XXX This is just here to maintain symmetry
 	 *     with e_web_view_set_animate(). */
 
 	g_return_val_if_fail (E_IS_WEB_VIEW (web_view), FALSE);
 
 	return gtk_html_get_animate (GTK_HTML (web_view));
+#endif
+
+	return FALSE;
 }
 
 void
 e_web_view_set_animate (EWebView *web_view,
                         gboolean animate)
 {
+#if 0  /* WEBKIT - XXX No equivalent property? */
 	/* XXX GtkHTML does not utilize GObject properties as well
 	 *     as it could.  This just wraps gtk_html_set_animate()
 	 *     so we can get a "notify::animate" signal. */
@@ -1817,30 +1787,24 @@ e_web_view_set_animate (EWebView *web_view,
 	gtk_html_set_animate (GTK_HTML (web_view), animate);
 
 	g_object_notify (G_OBJECT (web_view), "animate");
+#endif
 }
 
 gboolean
 e_web_view_get_caret_mode (EWebView *web_view)
 {
-	/* XXX This is just here to maintain symmetry
-	 *     with e_web_view_set_caret_mode(). */
-
 	g_return_val_if_fail (E_IS_WEB_VIEW (web_view), FALSE);
 
-	return gtk_html_get_caret_mode (GTK_HTML (web_view));
+	return web_view->priv->caret_mode;
 }
 
 void
 e_web_view_set_caret_mode (EWebView *web_view,
                            gboolean caret_mode)
 {
-	/* XXX GtkHTML does not utilize GObject properties as well
-	 *     as it could.  This just wraps gtk_html_set_caret_mode()
-	 *     so we can get a "notify::caret-mode" signal. */
-
 	g_return_if_fail (E_IS_WEB_VIEW (web_view));
 
-	gtk_html_set_caret_mode (GTK_HTML (web_view), caret_mode);
+	web_view->priv->caret_mode = caret_mode;
 
 	g_object_notify (G_OBJECT (web_view), "caret-mode");
 }
@@ -1850,7 +1814,8 @@ e_web_view_get_copy_target_list (EWebView *web_view)
 {
 	g_return_val_if_fail (E_IS_WEB_VIEW (web_view), NULL);
 
-	return web_view->priv->copy_target_list;
+	return webkit_web_view_get_copy_target_list (
+		WEBKIT_WEB_VIEW (web_view));
 }
 
 gboolean
@@ -1894,44 +1859,40 @@ e_web_view_set_disable_save_to_disk (EWebView *web_view,
 gboolean
 e_web_view_get_editable (EWebView *web_view)
 {
-	/* XXX This is just here to maintain symmetry
-	 *     with e_web_view_set_editable(). */
-
 	g_return_val_if_fail (E_IS_WEB_VIEW (web_view), FALSE);
 
-	return gtk_html_get_editable (GTK_HTML (web_view));
+	return webkit_web_view_get_editable (WEBKIT_WEB_VIEW (web_view));
 }
 
 void
 e_web_view_set_editable (EWebView *web_view,
                          gboolean editable)
 {
-	/* XXX GtkHTML does not utilize GObject properties as well
-	 *     as it could.  This just wraps gtk_html_set_editable()
-	 *     so we can get a "notify::editable" signal. */
-
 	g_return_if_fail (E_IS_WEB_VIEW (web_view));
 
-	gtk_html_set_editable (GTK_HTML (web_view), editable);
-
-	g_object_notify (G_OBJECT (web_view), "editable");
+	webkit_web_view_set_editable (WEBKIT_WEB_VIEW (web_view), editable);
 }
 
 gboolean
 e_web_view_get_inline_spelling (EWebView *web_view)
 {
+#if 0  /* WEBKIT - XXX No equivalent property? */
 	/* XXX This is just here to maintain symmetry
 	 *     with e_web_view_set_inline_spelling(). */
 
 	g_return_val_if_fail (E_IS_WEB_VIEW (web_view), FALSE);
 
 	return gtk_html_get_inline_spelling (GTK_HTML (web_view));
+#endif
+
+	return FALSE;
 }
 
 void
 e_web_view_set_inline_spelling (EWebView *web_view,
                                 gboolean inline_spelling)
 {
+#if 0  /* WEBKIT - XXX No equivalent property? */
 	/* XXX GtkHTML does not utilize GObject properties as well
 	 *     as it could.  This just wraps gtk_html_set_inline_spelling()
 	 *     so we get a "notify::inline-spelling" signal. */
@@ -1941,23 +1902,29 @@ e_web_view_set_inline_spelling (EWebView *web_view,
 	gtk_html_set_inline_spelling (GTK_HTML (web_view), inline_spelling);
 
 	g_object_notify (G_OBJECT (web_view), "inline-spelling");
+#endif
 }
 
 gboolean
 e_web_view_get_magic_links (EWebView *web_view)
 {
+#if 0  /* WEBKIT - XXX No equivalent property? */
 	/* XXX This is just here to maintain symmetry
 	 *     with e_web_view_set_magic_links(). */
 
 	g_return_val_if_fail (E_IS_WEB_VIEW (web_view), FALSE);
 
 	return gtk_html_get_magic_links (GTK_HTML (web_view));
+#endif
+
+	return FALSE;
 }
 
 void
 e_web_view_set_magic_links (EWebView *web_view,
                             gboolean magic_links)
 {
+#if 0  /* WEBKIT - XXX No equivalent property? */
 	/* XXX GtkHTML does not utilize GObject properties as well
 	 *     as it could.  This just wraps gtk_html_set_magic_links()
 	 *     so we can get a "notify::magic-links" signal. */
@@ -1967,23 +1934,29 @@ e_web_view_set_magic_links (EWebView *web_view,
 	gtk_html_set_magic_links (GTK_HTML (web_view), magic_links);
 
 	g_object_notify (G_OBJECT (web_view), "magic-links");
+#endif
 }
 
 gboolean
 e_web_view_get_magic_smileys (EWebView *web_view)
 {
+#if 0  /* WEBKIT - No equivalent property? */
 	/* XXX This is just here to maintain symmetry
 	 *     with e_web_view_set_magic_smileys(). */
 
 	g_return_val_if_fail (E_IS_WEB_VIEW (web_view), FALSE);
 
 	return gtk_html_get_magic_smileys (GTK_HTML (web_view));
+#endif
+
+	return FALSE;
 }
 
 void
 e_web_view_set_magic_smileys (EWebView *web_view,
                               gboolean magic_smileys)
 {
+#if 0  /* WEBKIT - No equivalent property? */
 	/* XXX GtkHTML does not utilize GObject properties as well
 	 *     as it could.  This just wraps gtk_html_set_magic_smileys()
 	 *     so we can get a "notify::magic-smileys" signal. */
@@ -1993,6 +1966,7 @@ e_web_view_set_magic_smileys (EWebView *web_view,
 	gtk_html_set_magic_smileys (GTK_HTML (web_view), magic_smileys);
 
 	g_object_notify (G_OBJECT (web_view), "magic-smileys");
+#endif
 }
 
 const gchar *
@@ -2092,7 +2066,8 @@ e_web_view_get_paste_target_list (EWebView *web_view)
 {
 	g_return_val_if_fail (E_IS_WEB_VIEW (web_view), NULL);
 
-	return web_view->priv->paste_target_list;
+	return webkit_web_view_get_paste_target_list (
+		WEBKIT_WEB_VIEW (web_view));
 }
 
 GtkAction *
@@ -2179,20 +2154,16 @@ e_web_view_get_action_group (EWebView *web_view,
 
 gchar *
 e_web_view_extract_uri (EWebView *web_view,
-                        GdkEventButton *event,
-                        GtkHTML *frame)
+                        GdkEventButton *event)
 {
 	EWebViewClass *class;
 
 	g_return_val_if_fail (E_IS_WEB_VIEW (web_view), NULL);
 
-	if (frame == NULL)
-		frame = GTK_HTML (web_view);
-
 	class = E_WEB_VIEW_GET_CLASS (web_view);
 	g_return_val_if_fail (class->extract_uri != NULL, NULL);
 
-	return class->extract_uri (web_view, event, frame);
+	return class->extract_uri (web_view, event);
 }
 
 void
@@ -2200,7 +2171,7 @@ e_web_view_copy_clipboard (EWebView *web_view)
 {
 	g_return_if_fail (E_IS_WEB_VIEW (web_view));
 
-	g_signal_emit (web_view, signals[COPY_CLIPBOARD], 0);
+	webkit_web_view_copy_clipboard (WEBKIT_WEB_VIEW (web_view));
 }
 
 void
@@ -2208,7 +2179,7 @@ e_web_view_cut_clipboard (EWebView *web_view)
 {
 	g_return_if_fail (E_IS_WEB_VIEW (web_view));
 
-	g_signal_emit (web_view, signals[CUT_CLIPBOARD], 0);
+	webkit_web_view_cut_clipboard (WEBKIT_WEB_VIEW (web_view));
 }
 
 gboolean
@@ -2216,7 +2187,7 @@ e_web_view_is_selection_active (EWebView *web_view)
 {
 	g_return_val_if_fail (E_IS_WEB_VIEW (web_view), FALSE);
 
-	return gtk_html_command (GTK_HTML (web_view), "is-selection-active");
+	return webkit_web_view_has_selection (WEBKIT_WEB_VIEW (web_view));
 }
 
 void
@@ -2224,7 +2195,7 @@ e_web_view_paste_clipboard (EWebView *web_view)
 {
 	g_return_if_fail (E_IS_WEB_VIEW (web_view));
 
-	g_signal_emit (web_view, signals[PASTE_CLIPBOARD], 0);
+	webkit_web_view_paste_clipboard (WEBKIT_WEB_VIEW (web_view));
 }
 
 gboolean
@@ -2232,7 +2203,10 @@ e_web_view_scroll_forward (EWebView *web_view)
 {
 	g_return_val_if_fail (E_IS_WEB_VIEW (web_view), FALSE);
 
-	return gtk_html_command (GTK_HTML (web_view), "scroll-forward");
+	webkit_web_view_move_cursor (
+		WEBKIT_WEB_VIEW (web_view), GTK_MOVEMENT_PAGES, 1);
+
+	return TRUE;  /* XXX This means nothing. */
 }
 
 gboolean
@@ -2240,7 +2214,10 @@ e_web_view_scroll_backward (EWebView *web_view)
 {
 	g_return_val_if_fail (E_IS_WEB_VIEW (web_view), FALSE);
 
-	return gtk_html_command (GTK_HTML (web_view), "scroll-backward");
+	webkit_web_view_move_cursor (
+		WEBKIT_WEB_VIEW (web_view), GTK_MOVEMENT_PAGES, -1);
+
+	return TRUE;  /* XXX This means nothing. */
 }
 
 void
@@ -2248,15 +2225,17 @@ e_web_view_select_all (EWebView *web_view)
 {
 	g_return_if_fail (E_IS_WEB_VIEW (web_view));
 
-	gtk_html_command (GTK_HTML (web_view), "select-all");
+	webkit_web_view_select_all (WEBKIT_WEB_VIEW (web_view));
 }
 
 void
 e_web_view_unselect_all (EWebView *web_view)
 {
+#if 0  /* WEBKIT */
 	g_return_if_fail (E_IS_WEB_VIEW (web_view));
 
 	gtk_html_command (GTK_HTML (web_view), "unselect-all");
+#endif
 }
 
 void
@@ -2264,7 +2243,7 @@ e_web_view_zoom_100 (EWebView *web_view)
 {
 	g_return_if_fail (E_IS_WEB_VIEW (web_view));
 
-	gtk_html_command (GTK_HTML (web_view), "zoom-reset");
+	webkit_web_view_set_zoom_level (WEBKIT_WEB_VIEW (web_view), 1.0);
 }
 
 void
@@ -2272,7 +2251,7 @@ e_web_view_zoom_in (EWebView *web_view)
 {
 	g_return_if_fail (E_IS_WEB_VIEW (web_view));
 
-	gtk_html_command (GTK_HTML (web_view), "zoom-in");
+	webkit_web_view_zoom_in (WEBKIT_WEB_VIEW (web_view));
 }
 
 void
@@ -2280,7 +2259,7 @@ e_web_view_zoom_out (EWebView *web_view)
 {
 	g_return_if_fail (E_IS_WEB_VIEW (web_view));
 
-	gtk_html_command (GTK_HTML (web_view), "zoom-out");
+	webkit_web_view_zoom_out (WEBKIT_WEB_VIEW (web_view));
 }
 
 GtkUIManager *
diff --git a/widgets/misc/e-web-view.h b/widgets/misc/e-web-view.h
index 1ca9915..432dc7e 100644
--- a/widgets/misc/e-web-view.h
+++ b/widgets/misc/e-web-view.h
@@ -27,7 +27,7 @@
 #ifndef E_WEB_VIEW_H
 #define E_WEB_VIEW_H
 
-#include <gtkhtml/gtkhtml.h>
+#include <webkit/webkit.h>
 
 /* Standard GObject macros */
 #define E_TYPE_WEB_VIEW \
@@ -55,17 +55,20 @@ typedef struct _EWebViewClass EWebViewClass;
 typedef struct _EWebViewPrivate EWebViewPrivate;
 
 struct _EWebView {
-	GtkHTML parent;
+	WebKitWebView parent;
 	EWebViewPrivate *priv;
 };
 
 struct _EWebViewClass {
-	GtkHTMLClass parent_class;
+	WebKitWebViewClass parent_class;
 
 	/* Methods */
+	GtkWidget *	(*create_plugin_widget)	(EWebView *web_view,
+						 const gchar *mime_type,
+						 const gchar *uri,
+						 GHashTable *param);
 	gchar *		(*extract_uri)		(EWebView *web_view,
-						 GdkEventButton *event,
-						 GtkHTML *frame);
+						 GdkEventButton *event);
 	void		(*hovering_over_link)	(EWebView *web_view,
 						 const gchar *title,
 						 const gchar *uri);
@@ -75,9 +78,6 @@ struct _EWebViewClass {
 						 const gchar *load_string);
 
 	/* Signals */
-	void		(*copy_clipboard)	(EWebView *web_view);
-	void		(*cut_clipboard)	(EWebView *web_view);
-	void		(*paste_clipboard)	(EWebView *web_view);
 	gboolean	(*popup_event)		(EWebView *web_view,
 						 GdkEventButton *event,
 						 const gchar *uri);
@@ -147,8 +147,7 @@ GtkAction *	e_web_view_get_action		(EWebView *web_view,
 GtkActionGroup *e_web_view_get_action_group	(EWebView *web_view,
 						 const gchar *group_name);
 gchar *		e_web_view_extract_uri		(EWebView *web_view,
-						 GdkEventButton *event,
-						 GtkHTML *frame);
+						 GdkEventButton *event);
 void		e_web_view_copy_clipboard	(EWebView *web_view);
 void		e_web_view_cut_clipboard	(EWebView *web_view);
 gboolean	e_web_view_is_selection_active	(EWebView *web_view);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]