Index: configure.in
===================================================================
--- configure.in	(révision 830)
+++ configure.in	(copie de travail)
@@ -39,12 +39,30 @@
 	gconf-2.0 >= 2.6.0
 ])
 
-# *****
-# Gecko
-# *****
+# ************
+# Engine check
+# ************
 
-GECKO_INIT([GECKO])
+AC_MSG_CHECKING(for which engine to use)
 
+AC_ARG_WITH([engine],
+	AS_HELP_STRING([--with-engine@<:@=mozilla|webkit@:>@],
+		[Which engine to build against @<:@mozilla@:>@]),
+	[], [with_engine="mozilla"])
+
+AC_MSG_RESULT($with_engine)
+AC_SUBST([with_engine])
+
+# *******
+# Mozilla
+# *******
+
+GECKO_INIT([GECKO], [gecko_found=yes],[gecko_found=no])
+
+AM_CONDITIONAL([WITH_GECKO_ENGINE], [test "$with_engine" = "mozilla"])
+if test "$with_engine" = "mozilla" ; then
+
+AC_DEFINE([WITH_GECKO_ENGINE],[1],[Define if you wish to enable mozilla engine])
 AC_SUBST([GECKO])
 AC_SUBST([GECKO_FLAVOUR])
 AC_SUBST([GECKO_INCLUDE_ROOT])
@@ -91,6 +109,22 @@
 GECKO_WARN_CXXFLAGS="-Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
 AC_SUBST(GECKO_WARN_CXXFLAGS)
 
+fi # with_engine = gecko
+
+AM_CONDITIONAL([HAVE_XULRUNNER],[test "$gecko_cv_gecko" = "xulrunner"])
+
+# *******************************
+# webkit renderer
+# *******************************
+
+AM_CONDITIONAL([WITH_WEBKIT_ENGINE], test "$with_engine" = "webkit")
+if test "$with_engine" = "webkit" ; then
+   AC_DEFINE([WITH_WEBKIT_ENGINE],[1],[Define if you wish to enable webkit engine])
+   PKG_CHECK_MODULES([WEBKIT], WebKitGdk)
+   AC_SUBST([WEBKIT_CFLAGS])
+   AC_SUBST([WEBKIT_LIBS])
+fi # with_engine = webkit
+
 dnl Checks for zlib library.
 AC_LANG_PUSH([C])
 _SAVE_CPPFLAGS="$CPPFLAGS"
@@ -159,3 +193,15 @@
 
 AC_OUTPUT
 
+echo "
+Devhelp was configured with the following options:
+        
+	Source code location       : $srcdir
+	Compiler                   : $CC
+	Prefix                     : $prefix
+	Extra debugging support    : $enable_debug
+
+        Engine                     : $with_engine
+	Gecko backend              : $gecko_cv_gecko version $gecko_cv_gecko_version
+
+"
Index: src/dh-base.c
===================================================================
--- src/dh-base.c	(révision 830)
+++ src/dh-base.c	(copie de travail)
@@ -31,7 +31,12 @@
 #define WNCK_I_KNOW_THIS_IS_UNSTABLE
 #include <libwnck/libwnck.h>
 
+#ifdef WITH_GECKO_ENGINE
 #include "dh-gecko-utils.h"
+#endif
+#ifdef WITH_WEBKIT_ENGINE
+#include "dh-webkit-utils.h"
+#endif
 #include "dh-window.h"
 #include "dh-link.h"
 #include "dh-parser.h"
@@ -126,7 +131,12 @@
 
 	g_object_unref (priv->gconf_client);
 	
+#ifdef WITH_GECKO_ENGINE
 	dh_gecko_utils_shutdown ();
+#endif
+#ifdef WITH_WEBKIT_ENGINE
+	dh_webkit_utils_shutdown ();
+#endif
 
 	parent_class->finalize (object);
 }
@@ -335,7 +345,12 @@
 dh_base_get (void)
 {
 	if (!base_instance) {
+#ifdef WITH_GECKO_ENGINE
 		dh_gecko_utils_init ();
+#endif
+#ifdef WITH_WEBKIT_ENGINE
+		dh_webkit_utils_init ();
+#endif
 		
 		base_instance = g_object_new (DH_TYPE_BASE, NULL);		
 
Index: src/Yelper.h
===================================================================
--- src/Yelper.h	(révision 830)
+++ src/Yelper.h	(copie de travail)
@@ -1,74 +0,0 @@
-/*
- *  Copyright (C) 2000-2004 Marco Pesenti Gritti
- *  Copyright (C) 2003-2005 Christian Persch
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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 General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- *  $Id: Yelper.h,v 1.4 2006/09/17 17:24:32 chpe Exp $
- */
-
-#ifndef __YELPER_H__
-#define __YELPER_H__
-
-#include <gtkmozembed.h>
-#include <nsCOMPtr.h>
-
-#if 0
-#include "yelp-print.h"
-#endif
-
-class nsIDOMWindow;
-class nsITypeAheadFind;
-class nsIWebBrowser;
-
-class Yelper
-{
-public:
-	Yelper (GtkMozEmbed *aEmbed);
-	~Yelper ();
-
-	nsresult Init ();
-	void Destroy ();
-
-	void DoCommand (const char *aCommand);
-
-	void SetFindProperties (const char *aSearchString,
-				PRBool aCaseSensitive,
-				PRBool aWrap);
-	PRBool Find (const char *aSearchString);
-	PRBool FindAgain (PRBool aForward);
-	void SetSelectionAttention (PRBool aSelectionAttention);
-
-	void ProcessMouseEvent (void *aEvent);
-
-#if 0 // Disable those methods for compiling errors
-	nsresult Print (YelpPrintInfo *print_info, PRBool preview,
-			int *prev_pages);	
-	nsresult PrintPreviewNavigate (int page_no);
-	nsresult PrintPreviewEnd ();
-#endif
-
-private:
-	PRPackedBool mInitialised;
-	PRPackedBool mSelectionAttention;
-	PRPackedBool mHasFocus;
-
-	GtkMozEmbed *mEmbed;
-	nsCOMPtr<nsIWebBrowser> mWebBrowser;
-	nsCOMPtr<nsIDOMWindow> mDOMWindow;
-	nsCOMPtr<nsITypeAheadFind> mFinder;
-};
-
-#endif /* !__YELPER_H__ */
Index: src/dh-webkit-utils.h
===================================================================
--- src/dh-webkit-utils.h	(révision 0)
+++ src/dh-webkit-utils.h	(révision 0)
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2004 Imendio AB
+ * Copyright (C) 2004 Marco Pesenti Gritti
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef __DH_WEBKIT_UTILS_H__
+#define __DH_WEBKIT_UTILS_H__
+
+#include <webkitgtkpage.h>
+#include <webkitgtkglobal.h>
+
+G_BEGIN_DECLS
+
+enum {
+	DH_WEBKIT_PREF_FONT_VARIABLE,
+	DH_WEBKIT_PREF_FONT_FIXED
+};
+
+#ifndef __cplusplus
+typedef struct _Yelper Yelper;
+#else
+class Yelper;
+#endif
+
+
+void dh_webkit_utils_set_font                  (gint         font_type,
+					       const gchar *fontname);
+void dh_webkit_utils_init                      (void);
+void dh_webkit_utils_shutdown                  (void);
+gint dh_webkit_utils_get_mouse_event_button    (gpointer     event);
+gint dh_webkit_utils_get_mouse_event_modifiers (gpointer     event);
+void dh_webkit_utils_copy_selection            (WebKitGtkPage *gpage);
+gboolean dh_webkit_utils_search_find           (Yelper *yelper, const gchar * text);
+gboolean dh_webkit_utils_search_find_again     (Yelper *yelper, gboolean backward);
+void dh_webkit_utils_search_set_case_sensitive (Yelper *yelper, gboolean match);
+Yelper* dh_webkit_utils_create_yelper          (WebKitGtkPage *gpage);
+void dh_webkit_utils_destroy_yelper            (Yelper* yelper);
+
+G_END_DECLS
+
+#endif /* __DH_HTML_H__ */
+
Index: src/dh-preferences.c
===================================================================
--- src/dh-preferences.c	(révision 830)
+++ src/dh-preferences.c	(copie de travail)
@@ -25,7 +25,12 @@
 #include <string.h>
 
 #include "dh-util.h" 
+#ifdef WITH_GECKO_ENGINE
 #include "dh-gecko-utils.h"
+#endif
+#ifdef WITH_WEBKIT_ENGINE
+#include "dh-webkit-utils.h"
+#endif
 #include "dh-preferences.h"
 #include "dh-base.h"
 
@@ -383,8 +388,10 @@
 	preferences_get_font_names (use_system_fonts,
 				    &var_font_name, &fixed_font_name);
 
+#ifdef WITH_GECKO_ENGINE
 	dh_gecko_utils_set_font (DH_GECKO_PREF_FONT_VARIABLE, var_font_name);
 	dh_gecko_utils_set_font (DH_GECKO_PREF_FONT_FIXED, fixed_font_name);
+#endif
 
 	g_free (var_font_name);
 	g_free (fixed_font_name);
Index: src/dh-html.c
===================================================================
--- src/dh-html.c	(révision 830)
+++ src/dh-html.c	(copie de travail)
@@ -1,459 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2002-2003 CodeFactory AB
- * Copyright (C) 2001-2003 Mikael Hallendal <micke@imendio.com>
- * Copyright (C) 2004-2005 Imendio hB
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <gtkmozembed.h>
-
-#include "dh-util.h"
-#include "dh-marshal.h"
-#include "dh-gecko-utils.h"
-#include "dh-preferences.h"
-#include "dh-html.h"
-
-#define d(x)
-
-struct _DhHtmlPriv {
-	GtkMozEmbed *gecko;
-	Yelper      *yelper;
-};
-
-static void     html_class_init  (DhHtmlClass *klass);
-static void     html_init        (DhHtml      *html);
-static void     html_title_cb    (GtkMozEmbed *embed,
-				  DhHtml      *html);
-static void     html_location_cb (GtkMozEmbed *embed,
-				  DhHtml      *html);
-static gboolean html_open_uri_cb (GtkMozEmbed *embed,
-				  const gchar *uri,
-				  DhHtml      *html);
-
-
-enum {
-	TITLE_CHANGED,
-	LOCATION_CHANGED,
-	OPEN_URI,
-	OPEN_NEW_TAB,
-	LAST_SIGNAL
-};
-
-static gint signals[LAST_SIGNAL] = { 0 };
-
-/* Has the value of the URL under the mouse pointer, otherwise NULL */
-static gchar *current_url = NULL;
-
-GType
-dh_html_get_type (void)
-{
-        static GType type = 0;
-
-        if (!type) {
-                static const GTypeInfo info =
-                        {
-                                sizeof (DhHtmlClass),
-                                NULL,
-                                NULL,
-				(GClassInitFunc) html_class_init,
-                                NULL,
-                                NULL,
-                                sizeof (DhHtml),
-                                0,
-                                (GInstanceInitFunc) html_init,
-                        };
-
-                type = g_type_register_static (G_TYPE_OBJECT,
-					       "DhHtml",
-					       &info, 0);
-        }
-
-        return type;
-}
-
-static void
-html_class_init (DhHtmlClass *klass)
-{
-	signals[TITLE_CHANGED] =
-		g_signal_new ("title-changed",
-			      G_TYPE_FROM_CLASS (klass),
-			      G_SIGNAL_RUN_LAST,
-			      0,
-			      NULL, NULL,
-			      dh_marshal_VOID__STRING,
-			      G_TYPE_NONE,
-			      1, G_TYPE_STRING);
-
-	signals[LOCATION_CHANGED] =
-		g_signal_new ("location-changed",
-			      G_TYPE_FROM_CLASS (klass),
-			      G_SIGNAL_RUN_LAST,
-			      0,
-			      NULL, NULL,
-			      dh_marshal_VOID__STRING,
-			      G_TYPE_NONE,
-			      1, G_TYPE_STRING);
-	signals[OPEN_URI] =
-		g_signal_new ("open-uri",
-			      G_TYPE_FROM_CLASS (klass),
-			      G_SIGNAL_RUN_LAST,
-			      0,
-			      NULL, NULL,
-			      dh_marshal_BOOLEAN__STRING,
-			      G_TYPE_BOOLEAN,
-			      1, G_TYPE_STRING);
-	signals[OPEN_NEW_TAB] =
-		g_signal_new ("open-new-tab",
-			      G_TYPE_FROM_CLASS (klass),
-			      G_SIGNAL_RUN_LAST,
-			      0,
-			      NULL, NULL,
-			      dh_marshal_VOID__STRING,
-			      G_TYPE_NONE,
-			      1, G_TYPE_STRING);
-}
-
-static gboolean
-html_mouse_click_cb (GtkMozEmbed *widget, gpointer dom_event, DhHtml *html)
-{
-	gint button;
-	gint mask;
-
-	button = dh_gecko_utils_get_mouse_event_button (dom_event);
-	mask = dh_gecko_utils_get_mouse_event_modifiers (dom_event);
-
-	if (button == 2 || (button == 1 && mask & GDK_CONTROL_MASK)) {
-		if (current_url) {
-			g_signal_emit (html,
-				       signals[OPEN_NEW_TAB], 0,
-				       current_url);
-			return TRUE;
-		}
-	}
-
-	return FALSE;
-}
-
-/* I'd like to get rid of this hack, there should be a way to get the URI that
- * was clicked instead of tracking it like this.
- */
-static gboolean
-html_link_message_cb (GtkMozEmbed *widget)
-{
-	if (current_url) {
-		g_free (current_url);
-	}
-	current_url = gtk_moz_embed_get_link_message (widget);
-
-	if (current_url[0] == '\0') {
-		g_free (current_url);
-		current_url = NULL;
-	}
-
-	return FALSE;
-}
-
-static void
-html_child_grab_focus_cb (GtkWidget *widget, DhHtml *html)
-{
-        GdkEvent *event;
-
-        event = gtk_get_current_event ();
-
-        if (!event) {
-                g_signal_stop_emission_by_name (widget, "grab-focus");
-        } else {
-                gdk_event_free (event);
-        }
-}
-
-static void
-html_child_add_cb (GtkMozEmbed *embed, GtkWidget *child, DhHtml *html)
-{
-	g_signal_connect (child, "grab-focus",
-			  G_CALLBACK (html_child_grab_focus_cb),
-			  html);
-}
-
-static void
-html_child_remove_cb (GtkMozEmbed *embed, GtkWidget *child, DhHtml *html)
-{
-	g_signal_handlers_disconnect_by_func (child, html_child_grab_focus_cb, html);
-}
-
-static void
-html_init (DhHtml *html)
-{
-        DhHtmlPriv *priv;
-
-	priv = g_new0 (DhHtmlPriv, 1);
-
-	priv->gecko = GTK_MOZ_EMBED (gtk_moz_embed_new ());
-
-	g_signal_connect (priv->gecko, "title",
-			  G_CALLBACK (html_title_cb),
-			  html);
-	g_signal_connect (priv->gecko, "location",
-			  G_CALLBACK (html_location_cb),
-			  html);
-	g_signal_connect (priv->gecko, "open-uri",
-			  G_CALLBACK (html_open_uri_cb),
-			  html);
-	g_signal_connect (priv->gecko, "dom_mouse_click",
-			  G_CALLBACK (html_mouse_click_cb),
-			  html);
-	g_signal_connect (priv->gecko, "link_message",
-			  G_CALLBACK (html_link_message_cb),
-			  html);
-	g_signal_connect (priv->gecko, "add",
-			  G_CALLBACK (html_child_add_cb),
-			  html);
-	g_signal_connect (priv->gecko, "remove",
-			  G_CALLBACK (html_child_remove_cb),
-			  html);
-
-	gtk_moz_embed_load_url (GTK_MOZ_EMBED (priv->gecko), "about:blank");
-
-	priv->yelper = dh_gecko_utils_create_yelper (priv->gecko);
-
-	html->priv = priv;
-}
-
-static void
-html_title_cb (GtkMozEmbed *embed, DhHtml *html)
-{
-	char *new_title;
-
-	new_title = gtk_moz_embed_get_title (embed);
-	g_signal_emit (html, signals[TITLE_CHANGED], 0, new_title);
-	g_free (new_title);
-}
-
-static void
-html_location_cb (GtkMozEmbed *embed, DhHtml *html)
-{
-	DhHtmlPriv *priv;
-	char       *location;
-
-	priv = html->priv;
-
-	location = gtk_moz_embed_get_location (embed);
-	g_signal_emit (html, signals[LOCATION_CHANGED], 0, location);
-	g_free (location);
-}
-
-static gboolean
-html_open_uri_cb (GtkMozEmbed *embed, const gchar *uri, DhHtml *html)
-{
-	DhHtmlPriv *priv;
-	gboolean   retval;
-
-	priv = html->priv;
-
-	retval = TRUE;
-
-	g_signal_emit (html, signals[OPEN_URI], 0, uri, &retval);
-
-	return retval;
-}
-
-DhHtml *
-dh_html_new (void)
-{
-        DhHtml *html;
-
-        html = g_object_new (DH_TYPE_HTML, NULL);
-
-        return html;
-}
-
-void
-dh_html_clear (DhHtml *html)
-{
-	DhHtmlPriv        *priv;
-	static const char *data = "<html><body bgcolor=\"white\"></body></html>";
-
-	g_return_if_fail (DH_IS_HTML (html));
-
-	priv = html->priv;
-
-	gtk_moz_embed_render_data (priv->gecko, data, strlen (data),
-				   "file:///", "text/html");
-}
-
-void
-dh_html_open_uri (DhHtml *html, const gchar *str_uri)
-{
-        DhHtmlPriv *priv;
-	gchar      *full_uri;
-
-	g_return_if_fail (DH_IS_HTML (html));
-	g_return_if_fail (str_uri != NULL);
-
-        priv = html->priv;
-
-	if (str_uri[0] == '/') {
-		full_uri = g_strdup_printf ("file://%s", str_uri);
-	} else {
-		full_uri = (gchar *) str_uri;
-	}
-
-	gtk_moz_embed_load_url (priv->gecko, full_uri);
-
-	if (full_uri != str_uri) {
-		g_free (full_uri);
-	}
-}
-
-
-GtkWidget *
-dh_html_get_widget (DhHtml *html)
-{
-	DhHtmlPriv *priv;
-
-	g_return_val_if_fail (DH_IS_HTML (html), NULL);
-
-	priv = html->priv;
-
-	return GTK_WIDGET (priv->gecko);
-}
-
-gboolean
-dh_html_can_go_forward (DhHtml *html)
-{
-	DhHtmlPriv *priv;
-
-	g_return_val_if_fail (DH_IS_HTML (html), FALSE);
-
-	priv = html->priv;
-
-	return gtk_moz_embed_can_go_forward (priv->gecko);
-}
-
-gboolean
-dh_html_can_go_back (DhHtml *html)
-{
-	DhHtmlPriv *priv;
-
-	g_return_val_if_fail (DH_IS_HTML (html), FALSE);
-
-	priv = html->priv;
-
-	return gtk_moz_embed_can_go_back (priv->gecko);
-}
-
-void
-dh_html_go_forward (DhHtml *html)
-{
-	DhHtmlPriv *priv;
-
-	g_return_if_fail (DH_IS_HTML (html));
-
-	priv = html->priv;
-
-	gtk_moz_embed_go_forward (priv->gecko);
-}
-
-void
-dh_html_go_back (DhHtml *html)
-{
-	DhHtmlPriv *priv;
-
-	g_return_if_fail (DH_IS_HTML (html));
-
-	priv = html->priv;
-
-	gtk_moz_embed_go_back (priv->gecko);
-}
-
-gchar *
-dh_html_get_title (DhHtml *html)
-{
-	DhHtmlPriv *priv;
-
-	g_return_val_if_fail (DH_IS_HTML (html), NULL);
-
-	priv = html->priv;
-
-	return gtk_moz_embed_get_title (priv->gecko);
-}
-
-gchar *
-dh_html_get_location (DhHtml *html)
-{
-	DhHtmlPriv *priv;
-
-	g_return_val_if_fail (DH_IS_HTML (html), NULL);
-
-	priv = html->priv;
-
-	return gtk_moz_embed_get_location (priv->gecko);
-}
-
-void
-dh_html_copy_selection (DhHtml *html)
-{
-	DhHtmlPriv *priv;
-
-	g_return_if_fail (DH_IS_HTML (html));
-
-	priv = html->priv;
-
-	dh_gecko_utils_copy_selection (priv->gecko);
-}
-
-void
-dh_html_search_find (DhHtml      *html,
-		     const gchar *text)
-{
-	DhHtmlPriv *priv;
-
-	g_return_if_fail (DH_IS_HTML (html));
-
-	priv = html->priv;
-
-	dh_gecko_utils_search_find (priv->yelper, text);
-}
-
-gboolean
-dh_html_search_find_again (DhHtml   *html,
-			   gboolean  backwards)
-{
-	DhHtmlPriv *priv;
-
-	g_return_val_if_fail (DH_IS_HTML (html), FALSE);
-
-	priv = html->priv;
-
-	return dh_gecko_utils_search_find_again (priv->yelper, backwards);
-}
-
-void
-dh_html_search_set_case_sensitive (DhHtml   *html,
-				   gboolean  case_sensitive)
-{
-	DhHtmlPriv *priv;
-
-	g_return_if_fail (DH_IS_HTML (html));
-
-	priv = html->priv;
-
-	dh_gecko_utils_search_set_case_sensitive (priv->yelper, case_sensitive);
-}
Index: src/Yelper.cpp
===================================================================
--- src/Yelper.cpp	(révision 830)
+++ src/Yelper.cpp	(copie de travail)
@@ -1,346 +0,0 @@
-/*
- *  Copyright (C) 2000-2004 Marco Pesenti Gritti
- *  Copyright (C) 2003-2006 Christian Persch
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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 General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- *  $Id: Yelper.cpp,v 1.7 2006/09/17 17:24:32 chpe Exp $
- */
-
-#include <mozilla-config.h>
-#include <config.h>
-
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <nsStringAPI.h>
-
-#include <gtkmozembed.h>
-#include <gtkmozembed_internal.h>
-#include <nsComponentManagerUtils.h>
-#include <nsICommandManager.h>
-#include <nsIDocShell.h>
-#include <nsIDOMDocument.h>
-#include <nsIDOMEventTarget.h>
-#include <nsIDOMHTMLAnchorElement.h>
-#include <nsIDOMMouseEvent.h>
-#include <nsIDOMNode.h>
-#include <nsIDOMNSEvent.h>
-#include <nsIDOMWindow.h>
-#include <nsIInterfaceRequestorUtils.h>
-#include <nsIPrefService.h>
-#include <nsIPrintSettings.h>
-#include <nsISelectionController.h>
-#include <nsITypeAheadFind.h>
-#include <nsIWebBrowser.h>
-#include <nsIWebBrowserPrint.h>
-#include <nsIWebBrowserSetup.h>
-#include <nsServiceManagerUtils.h>
-
-#ifndef HAVE_GECKO_1_9
-#include <nsIDocShell.h>
-#include <nsIDocShellTreeItem.h>
-#include <nsISelectionDisplay.h>
-#include <nsISimpleEnumerator.h>
-#include <nsITypeAheadFind.h>
-#endif /* !HAVE_GECKO_1_9 */
-
-/*
-#include "yelp-debug.h"
-#include "yelp-gecko-services.h"
-*/
-
-#include "Yelper.h"
-
-#define NS_TYPEAHEADFIND_CONTRACTID "@mozilla.org/typeaheadfind;1"
-
-Yelper::Yelper (GtkMozEmbed *aEmbed)
-: mInitialised(PR_FALSE)
-, mSelectionAttention(PR_FALSE)
-, mHasFocus(PR_FALSE)
-, mEmbed(aEmbed)
-{
-        //printf ("Yelper ctor [%p]\n", this);
-}
-
-Yelper::~Yelper ()
-{
-        //printf ("Yelper dtor [%p]\n", this);
-}
-
-nsresult
-Yelper::Init ()
-{
-	if (mInitialised) return NS_OK;
-
-	nsresult rv = NS_ERROR_FAILURE;
-	gtk_moz_embed_get_nsIWebBrowser (mEmbed,
-					 getter_AddRefs (mWebBrowser));
-	NS_ENSURE_TRUE (mWebBrowser, rv);
-
-	nsCOMPtr<nsIWebBrowserSetup> setup (do_QueryInterface (mWebBrowser, &rv));
-	NS_ENSURE_SUCCESS (rv, rv);
-
-	setup->SetProperty (nsIWebBrowserSetup::SETUP_USE_GLOBAL_HISTORY, PR_FALSE);
-
-	rv = mWebBrowser->GetContentDOMWindow (getter_AddRefs (mDOMWindow));
-	NS_ENSURE_SUCCESS (rv, rv);
-
-	/* This will instantiate an about:blank doc if necessary */
-	nsCOMPtr<nsIDOMDocument> domDocument;
-	rv = mDOMWindow->GetDocument (getter_AddRefs (domDocument));
-	NS_ENSURE_SUCCESS (rv, rv);
-
-	mFinder = do_CreateInstance (NS_TYPEAHEADFIND_CONTRACTID, &rv);
-	NS_ENSURE_SUCCESS (rv, rv);
-
-	nsCOMPtr<nsIDocShell> docShell (do_GetInterface (mWebBrowser, &rv));
-	NS_ENSURE_SUCCESS (rv, rv);
-
-	rv = mFinder->Init (docShell);
-	NS_ENSURE_SUCCESS (rv, rv);
-
-#ifdef HAVE_GECKO_1_9
-//	mFinder->SetSelectionModeAndRepaint (nsISelectionController::SELECTION_ON);
-#else
-	mFinder->SetFocusLinks (PR_TRUE);
-#endif
-
-	mInitialised = PR_TRUE;
-
-	return NS_OK;
-}
-
-void
-Yelper::Destroy ()
-{
-	mEmbed = nsnull;
-	mWebBrowser = nsnull;
-	mDOMWindow = nsnull;
-	mFinder = nsnull;
-
-	mInitialised = PR_FALSE;
-}
-
-void
-Yelper::DoCommand (const char *aCommand)
-{
-	if (!mInitialised) return;
-
-	nsCOMPtr<nsICommandManager> cmdManager (do_GetInterface (mWebBrowser));
-	if (!cmdManager) return;
-
-	cmdManager->DoCommand (aCommand, nsnull, nsnull);
-}
-
-void
-Yelper::SetFindProperties (const char *aSearchString,
-			   PRBool aCaseSensitive,
-			   PRBool aWrap)
-{
-	if (!mInitialised) return;
-
-	mFinder->SetCaseSensitive (aCaseSensitive);
-	/* aWrap not supported for typeaheadfind
-	 * search string is set in ::Find for typeaheadfind
-	 */
-}
-
-PRBool
-Yelper::Find (const char *aSearchString)
-{
-	NS_ENSURE_TRUE (aSearchString, PR_FALSE);
-
-	if (!mInitialised) return PR_FALSE;
-
-	SetSelectionAttention (PR_TRUE);
-
-	nsresult rv;
-	PRUint16 found = nsITypeAheadFind::FIND_NOTFOUND;
-#ifdef HAVE_GECKO_1_9
-	rv = mFinder->Find (NS_ConvertUTF8toUTF16 (aSearchString),
-			    PR_FALSE /* links only? */,
-			    mHasFocus,
-			    &found);
-#else
-	rv = mFinder->Find (NS_ConvertUTF8toUTF16 (aSearchString),
-			    PR_FALSE /* links only? */,
-			    &found);
-#endif
-
-	return NS_SUCCEEDED (rv) && (found == nsITypeAheadFind::FIND_FOUND || found == nsITypeAheadFind::FIND_WRAPPED);
-}
-
-PRBool
-Yelper::FindAgain (PRBool aForward)
-{
-	if (!mInitialised) return PR_FALSE;
-
-	SetSelectionAttention (PR_TRUE);
-
-	nsresult rv;
-	PRUint16 found = nsITypeAheadFind::FIND_NOTFOUND;
-#ifdef HAVE_GECKO_1_9
-	rv = mFinder->FindAgain (!aForward, mHasFocus, &found);
-#else
-	if (aForward) {
-		rv = mFinder->FindNext (&found);
-	}
-	else {
-		rv = mFinder->FindPrevious (&found);
-	}
-#endif /* HAVE_GECKO_1_9 */
-
-	return NS_SUCCEEDED (rv) && (found == nsITypeAheadFind::FIND_FOUND || found == nsITypeAheadFind::FIND_WRAPPED);
-}
-
-void
-Yelper::SetSelectionAttention (PRBool aAttention)
-{
-#if 0
-	if (aAttention == mSelectionAttention) return;
-	
-	mSelectionAttention = aAttention;
-	
-	NS_ENSURE_TRUE (mFinder, );
-
-	PRInt16 display;
-	if (aAttention) {
-		display = nsISelectionController::SELECTION_ATTENTION;
-	}
-	else {
-		display = nsISelectionController::SELECTION_ON;
-	}
-
-#ifdef HAVE_GECKO_1_9
-	mFinder->SetSelectionModeAndRepaint (display);
-#else
-	nsresult rv;
-	nsCOMPtr<nsIDocShell> shell (do_GetInterface (mWebBrowser, &rv));
-	/* It's okay for this to fail, if the tab is closing, or if
-	* we weren't attached to any tab yet
-	*/
-	if (NS_FAILED (rv) || !shell) return;
-	
-	nsCOMPtr<nsISimpleEnumerator> enumerator;
-	rv = shell->GetDocShellEnumerator (nsIDocShellTreeItem::typeContent,
-					   nsIDocShell::ENUMERATE_FORWARDS,
-					   getter_AddRefs (enumerator));
-	NS_ENSURE_SUCCESS (rv, );
-
-	PRBool hasMore = PR_FALSE;
-	while (NS_SUCCEEDED (enumerator->HasMoreElements (&hasMore)) && hasMore) {
-		nsCOMPtr<nsISupports> element;
-		enumerator->GetNext (getter_AddRefs (element));
-		if (!element) continue;
-	
-		nsCOMPtr<nsISelectionDisplay> sd (do_GetInterface (element));
-		if (!sd) continue;
-	
-		nsCOMPtr<nsISelectionController> controller (do_QueryInterface (sd));
-		if (!controller) continue;
-	
-		controller->SetDisplaySelection (display);
-	}
-#endif /* HAVE_GECKO_1_9 */
-#endif /* 0 */
-}
-
-void
-Yelper::ProcessMouseEvent (void* aEvent)
-{
-	g_return_if_fail (aEvent != NULL);
-
-	nsIDOMEvent *domEvent = static_cast<nsIDOMEvent*>(aEvent);
-	nsCOMPtr<nsIDOMMouseEvent> event (do_QueryInterface (domEvent));
-	if (!event) return;
-
-	PRUint16 button = 2;
-	event->GetButton (&button);
-
-	/* Mozilla uses 2 as its right mouse button code */
-	if (button != 2) return;
-
-	nsCOMPtr<nsIDOMNSEvent> nsEvent (do_QueryInterface (event));
-	if (!nsEvent) return;
-
-	nsresult rv;
-	nsCOMPtr<nsIDOMEventTarget> originalTarget;
-	rv = nsEvent->GetOriginalTarget (getter_AddRefs (originalTarget));
-	if (NS_FAILED (rv) || !originalTarget) return;
-	
-	nsCOMPtr <nsIDOMHTMLAnchorElement> anchor (do_QueryInterface (originalTarget));
-	if (!anchor) return;
-
-	nsString href;
-	rv = anchor->GetHref (href);
-	if (NS_FAILED (rv) || !href.Length ()) return;
-
-	g_signal_emit_by_name (mEmbed, "popupmenu_requested",
-			       NS_ConvertUTF16toUTF8 (href).get());
-}
-
-#if 0
-nsresult 
-Yelper::Print (YelpPrintInfo *print_info, PRBool preview, int *prev_pages)
-{
-  nsresult rv;
-
-  nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface (mWebBrowser, &rv));
-  NS_ENSURE_SUCCESS (rv, rv);
-
-  nsCOMPtr<nsIPrintSettings> settings;
-
-  rv = print->GetGlobalPrintSettings (getter_AddRefs (settings));
-  NS_ENSURE_SUCCESS (rv, rv);
-
-  rv = PrintListener::SetPrintSettings (print_info, preview, settings);
-
-  NS_ENSURE_SUCCESS (rv, rv);
-
-  nsCOMPtr<PrintListener> listener = new PrintListener (print_info, print);
-
-  if (!preview)
-    rv = print->Print (settings, listener);
-  else {
-    rv = print->PrintPreview (settings, mDOMWindow, nsnull);
-    rv |= print->GetPrintPreviewNumPages (prev_pages);
-  }
-  return rv;
-
-}
-
-nsresult
-Yelper::PrintPreviewNavigate (int page_no)
-{
-  nsresult rv;
-  nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface (mWebBrowser, &rv));
-  NS_ENSURE_SUCCESS (rv, rv);
-
-  return print->PrintPreviewNavigate (0, page_no);
-}
-
-nsresult 
-Yelper::PrintPreviewEnd ()
-{
-  nsresult rv;
-  nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface (mWebBrowser, &rv));
-  NS_ENSURE_SUCCESS (rv, rv);
-
-  return print->ExitPrintPreview ();
-
-}
-#endif
-
Index: src/dh-webkit-utils.cpp
===================================================================
--- src/dh-webkit-utils.cpp	(révision 0)
+++ src/dh-webkit-utils.cpp	(révision 0)
@@ -0,0 +1,142 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2004 Imendio AB
+ * Copyright (C) 2004 Marco Pesenti Gritti
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include <config.h>
+#include <webkitgtkpage.h>
+#include <webkitgtkglobal.h>
+
+
+#include <stdlib.h>
+
+#include "dh-util.h"
+#include "dh-webkit-utils.h"
+
+gint
+dh_webkit_utils_get_mouse_event_button (gpointer event)
+{
+	return 0;
+}
+
+gint
+dh_webkit_utils_get_mouse_event_modifiers (gpointer event)
+{
+	return 0;
+}
+
+void
+dh_webkit_utils_copy_selection (WebKitGtkPage *webkit)
+{
+}
+
+static gboolean
+dh_util_split_font_string (const gchar *font_name, gchar **name, gint *size)
+{
+	PangoFontDescription *desc;
+	PangoFontMask         mask;
+	gboolean              retval = FALSE;
+
+	if (font_name == NULL) {
+		return FALSE;
+	}
+
+	mask = (PangoFontMask) (PANGO_FONT_MASK_FAMILY | PANGO_FONT_MASK_SIZE);
+	
+	desc = pango_font_description_from_string (font_name);
+	if (!desc) {
+		return FALSE;
+	}
+	
+	if ((pango_font_description_get_set_fields (desc) & mask) == mask) {
+		*size = PANGO_PIXELS (pango_font_description_get_size (desc));
+		*name = g_strdup (pango_font_description_get_family (desc));
+		retval = TRUE;
+	}
+
+	pango_font_description_free (desc);
+
+	return retval;
+}
+
+static gboolean
+webkit_prefs_set_bool (const gchar *key, gboolean value)
+{
+	return FALSE;
+}
+
+static gboolean
+webkit_prefs_set_string (const gchar *key, const gchar *value)
+{
+	return FALSE;
+}
+
+static gboolean
+webkit_prefs_set_int (const gchar *key, gint value)
+{
+	return FALSE;
+}
+
+extern "C" void 
+dh_webkit_utils_set_font (gint type, const gchar *fontname)
+{
+	gchar *name;
+	gint   size;
+	WebKitGtkSettings *settings;
+
+	name = NULL;
+	if (!dh_util_split_font_string (fontname, &name, &size)) {
+		g_free (name);
+		return;
+	}
+
+#if 0 /* XXX: currently undefined symbols */
+	settings = webkit_gtk_web_settings_get_global();
+	webkit_gtk_web_settings_set_font_family(settings,
+			WEBKIT_GTK_FONT_FAMILY_STANDARD, g_strdup(fontname));
+	settings->default_font_size = size;
+	webkit_gtk_web_settings_set_global(settings);
+#endif
+	
+	g_free (name);
+}		   
+
+extern "C" void
+dh_webkit_utils_init (void)
+{
+	WebKitGtkSettings *settings;
+
+	if (!g_thread_supported ()) {
+		g_thread_init (NULL);
+	}
+	webkit_gtk_init();
+
+#if 0 /* XXX: currently undefined symbols */
+	settings = webkit_gtk_web_settings_get_global();
+	/* are there settings to set ? */
+	webkit_gtk_web_settings_set_global(settings);
+#endif
+}
+
+extern "C" void
+dh_webkit_utils_shutdown (void)
+{
+}
+
Index: src/dh-webkit-html.c
===================================================================
--- src/dh-webkit-html.c	(révision 0)
+++ src/dh-webkit-html.c	(révision 0)
@@ -0,0 +1,485 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2002-2003 CodeFactory AB
+ * Copyright (C) 2001-2003 Mikael Hallendal <micke@imendio.com>
+ * Copyright (C) 2004-2005 Imendio hB
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <webkitgtkpage.h>
+#include <webkitgtkglobal.h>
+
+
+#include "dh-util.h"
+#include "dh-marshal.h"
+#include "dh-webkit-utils.h"
+#include "dh-preferences.h"
+#include "dh-html.h"
+
+#define d(x)
+
+struct _DhHtmlPriv {
+	GtkWidget *scrolled_window;
+	WebKitGtkPage *webkit;
+	char *current_title;
+};
+
+static void     html_class_init  (DhHtmlClass *klass);
+static void     html_init        (DhHtml      *html);
+static void     html_title_cb    (WebKitGtkPage *embed,
+				  const gchar* title,
+				  const gchar* url,
+				  DhHtml      *html);
+#if 0
+static void     html_location_cb (WebKitGtkPage *embed,
+				  DhHtml      *html);
+static gboolean html_open_uri_cb (WebKitGtkPage *embed,
+				  const gchar *uri,
+				  DhHtml      *html);
+#endif
+
+
+enum {
+	TITLE_CHANGED,
+	LOCATION_CHANGED,
+	OPEN_URI,
+	OPEN_NEW_TAB,
+	LAST_SIGNAL
+};
+
+static gint signals[LAST_SIGNAL] = { 0 };
+
+/* Has the value of the URL under the mouse pointer, otherwise NULL */
+#if 0
+static gchar *current_url = NULL;
+#endif
+
+GType
+dh_html_get_type (void)
+{
+        static GType type = 0;
+
+        if (!type) {
+                static const GTypeInfo info =
+                        {
+                                sizeof (DhHtmlClass),
+                                NULL,
+                                NULL,
+				(GClassInitFunc) html_class_init,
+                                NULL,
+                                NULL,
+                                sizeof (DhHtml),
+                                0,
+                                (GInstanceInitFunc) html_init,
+                        };
+
+                type = g_type_register_static (G_TYPE_OBJECT,
+					       "DhHtml",
+					       &info, 0);
+        }
+
+        return type;
+}
+
+static void
+html_class_init (DhHtmlClass *klass)
+{
+	signals[TITLE_CHANGED] =
+		g_signal_new ("title-changed",
+			      G_TYPE_FROM_CLASS (klass),
+			      G_SIGNAL_RUN_LAST,
+			      0,
+			      NULL, NULL,
+			      dh_marshal_VOID__STRING,
+			      G_TYPE_NONE,
+			      1, G_TYPE_STRING);
+
+	signals[LOCATION_CHANGED] =
+		g_signal_new ("location-changed",
+			      G_TYPE_FROM_CLASS (klass),
+			      G_SIGNAL_RUN_LAST,
+			      0,
+			      NULL, NULL,
+			      dh_marshal_VOID__STRING,
+			      G_TYPE_NONE,
+			      1, G_TYPE_STRING);
+	signals[OPEN_URI] =
+		g_signal_new ("open-uri",
+			      G_TYPE_FROM_CLASS (klass),
+			      G_SIGNAL_RUN_LAST,
+			      0,
+			      NULL, NULL,
+			      dh_marshal_BOOLEAN__STRING,
+			      G_TYPE_BOOLEAN,
+			      1, G_TYPE_STRING);
+	signals[OPEN_NEW_TAB] =
+		g_signal_new ("open-new-tab",
+			      G_TYPE_FROM_CLASS (klass),
+			      G_SIGNAL_RUN_LAST,
+			      0,
+			      NULL, NULL,
+			      dh_marshal_VOID__STRING,
+			      G_TYPE_NONE,
+			      1, G_TYPE_STRING);
+}
+
+#if 0
+static gboolean
+html_mouse_click_cb (WebKitGtkPage *widget, gpointer dom_event, DhHtml *html)
+{
+	gint button;
+	gint mask;
+
+	button = dh_webkit_utils_get_mouse_event_button (dom_event);
+	mask = dh_webkit_utils_get_mouse_event_modifiers (dom_event);
+
+	if (button == 2 || (button == 1 && mask & GDK_CONTROL_MASK)) {
+		if (current_url) {
+			g_signal_emit (html,
+				       signals[OPEN_NEW_TAB], 0,
+				       current_url);
+			return TRUE;
+		}
+	}
+
+	return FALSE;
+}
+#endif
+
+#if 0
+/* I'd like to get rid of this hack, there should be a way to get the URI that
+ * was clicked instead of tracking it like this.
+ */
+static gboolean
+html_link_message_cb (WebKitGtkPage *widget)
+{
+	if (current_url) {
+		g_free (current_url);
+	}
+	current_url = gtk_moz_embed_get_link_message (widget);
+
+	if (current_url[0] == '\0') {
+		g_free (current_url);
+		current_url = NULL;
+	}
+
+	return FALSE;
+}
+#endif
+
+static void
+html_child_grab_focus_cb (GtkWidget *widget, DhHtml *html)
+{
+        GdkEvent *event;
+
+        event = gtk_get_current_event ();
+
+        if (!event) {
+                g_signal_stop_emission_by_name (widget, "grab-focus");
+        } else {
+                gdk_event_free (event);
+        }
+}
+
+static void
+html_child_add_cb (WebKitGtkPage *embed, GtkWidget *child, DhHtml *html)
+{
+	g_signal_connect (child, "grab-focus",
+			  G_CALLBACK (html_child_grab_focus_cb),
+			  html);
+}
+
+static void
+html_child_remove_cb (WebKitGtkPage *embed, GtkWidget *child, DhHtml *html)
+{
+	g_signal_handlers_disconnect_by_func (child, html_child_grab_focus_cb, html);
+}
+
+static void
+html_init (DhHtml *html)
+{
+        DhHtmlPriv *priv;
+
+	priv = g_new0 (DhHtmlPriv, 1);
+
+	priv->scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(priv->scrolled_window),
+			GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+	priv->webkit = WEBKIT_GTK_PAGE(webkit_gtk_page_new());
+	gtk_container_add(GTK_CONTAINER(priv->scrolled_window), GTK_WIDGET(priv->webkit));
+	gtk_widget_show_all(priv->scrolled_window);
+
+	priv->current_title = NULL;
+
+	g_signal_connect (priv->webkit, "title-changed",
+			  G_CALLBACK (html_title_cb),
+			  html);
+#if 0
+	g_signal_connect (priv->webkit, "location",
+			  G_CALLBACK (html_location_cb),
+			  html);
+	g_signal_connect (priv->gecko, "open-uri",
+			  G_CALLBACK (html_open_uri_cb),
+			  html);
+	g_signal_connect (priv->gecko, "dom_mouse_click",
+			  G_CALLBACK (html_mouse_click_cb),
+			  html);
+	g_signal_connect (priv->gecko, "link_message",
+			  G_CALLBACK (html_link_message_cb),
+			  html);
+#endif
+	g_signal_connect (priv->webkit, "add",
+			  G_CALLBACK (html_child_add_cb),
+			  html);
+	g_signal_connect (priv->webkit, "remove",
+			  G_CALLBACK (html_child_remove_cb),
+			  html);
+
+	webkit_gtk_page_open(priv->webkit, "about:blank");
+
+	/*priv->yelper = dh_webkit_utils_create_yelper (priv->webkit);*/
+
+	html->priv = priv;
+}
+
+static void
+html_title_cb(WebKitGtkPage *webkit, const gchar* title, const gchar* url, DhHtml *html)
+{
+	if (html->priv->current_title) {
+		g_free(html->priv->current_title);
+	}
+	html->priv->current_title = g_strdup(title);
+	g_signal_emit (html, signals[TITLE_CHANGED], 0, title);
+}
+
+#if 0
+static void
+html_location_cb (WebKitGtkPage *embed, DhHtml *html)
+{
+	DhHtmlPriv *priv;
+	char       *location;
+
+	priv = html->priv;
+
+	location = gtk_moz_embed_get_location (embed);
+	g_signal_emit (html, signals[LOCATION_CHANGED], 0, location);
+	g_free (location);
+}
+
+static gboolean
+html_open_uri_cb (WebKitGtkPage *embed, const gchar *uri, DhHtml *html)
+{
+	DhHtmlPriv *priv;
+	gboolean   retval;
+
+	priv = html->priv;
+
+	retval = TRUE;
+
+	g_signal_emit (html, signals[OPEN_URI], 0, uri, &retval);
+
+	return retval;
+}
+#endif
+
+DhHtml *
+dh_html_new (void)
+{
+        DhHtml *html;
+
+        html = g_object_new (DH_TYPE_HTML, NULL);
+
+        return html;
+}
+
+void
+dh_html_clear (DhHtml *html)
+{
+	DhHtmlPriv        *priv;
+	static const char *data = "<html><body bgcolor=\"white\"></body></html>";
+
+	g_return_if_fail (DH_IS_HTML (html));
+
+	priv = html->priv;
+
+	webkit_gtk_page_load_html_string(priv->webkit, data, "file:///");
+}
+
+void
+dh_html_open_uri (DhHtml *html, const gchar *str_uri)
+{
+        DhHtmlPriv *priv;
+	gchar      *full_uri;
+
+	g_return_if_fail (DH_IS_HTML (html));
+	g_return_if_fail (str_uri != NULL);
+
+        priv = html->priv;
+
+	if (str_uri[0] == '/') {
+		full_uri = g_strdup_printf ("file://%s", str_uri);
+	} else {
+		full_uri = (gchar *) str_uri;
+	}
+
+	if (strchr(full_uri, '#')) strchr(full_uri, '#')[0] = '\0';
+
+	webkit_gtk_page_open(priv->webkit, full_uri);
+
+	if (full_uri != str_uri) {
+		g_free (full_uri);
+	}
+}
+
+
+GtkWidget *
+dh_html_get_widget (DhHtml *html)
+{
+	DhHtmlPriv *priv;
+
+	g_return_val_if_fail (DH_IS_HTML (html), NULL);
+
+	priv = html->priv;
+
+	return GTK_WIDGET (priv->scrolled_window);
+}
+
+gboolean
+dh_html_can_go_forward (DhHtml *html)
+{
+	DhHtmlPriv *priv;
+
+	g_return_val_if_fail (DH_IS_HTML (html), FALSE);
+
+	priv = html->priv;
+
+	return webkit_gtk_page_can_go_forward(priv->webkit);
+}
+
+gboolean
+dh_html_can_go_back (DhHtml *html)
+{
+	DhHtmlPriv *priv;
+
+	g_return_val_if_fail (DH_IS_HTML (html), FALSE);
+
+	priv = html->priv;
+
+	return webkit_gtk_page_can_go_backward(priv->webkit);
+}
+
+void
+dh_html_go_forward (DhHtml *html)
+{
+	DhHtmlPriv *priv;
+
+	g_return_if_fail (DH_IS_HTML (html));
+
+	priv = html->priv;
+
+	webkit_gtk_page_go_forward(priv->webkit);
+}
+
+void
+dh_html_go_back (DhHtml *html)
+{
+	DhHtmlPriv *priv;
+
+	g_return_if_fail (DH_IS_HTML (html));
+
+	priv = html->priv;
+
+	webkit_gtk_page_go_backward(priv->webkit);
+}
+
+gchar *
+dh_html_get_title (DhHtml *html)
+{
+	DhHtmlPriv *priv;
+
+	g_return_val_if_fail (DH_IS_HTML (html), NULL);
+
+	priv = html->priv;
+
+	return g_strdup(priv->current_title);
+}
+
+gchar *
+dh_html_get_location (DhHtml *html)
+{
+	DhHtmlPriv *priv;
+
+	g_return_val_if_fail (DH_IS_HTML (html), NULL);
+
+	priv = html->priv;
+
+	return g_strdup("about:blank"); /*gtk_moz_embed_get_location (priv->gecko); */
+}
+
+void
+dh_html_copy_selection (DhHtml *html)
+{
+	DhHtmlPriv *priv;
+
+	g_return_if_fail (DH_IS_HTML (html));
+
+	priv = html->priv;
+
+	dh_webkit_utils_copy_selection (priv->webkit);
+}
+
+void
+dh_html_search_find (DhHtml      *html,
+		     const gchar *text)
+{
+	DhHtmlPriv *priv;
+
+	g_return_if_fail (DH_IS_HTML (html));
+
+	priv = html->priv;
+
+	/*dh_webkit_utils_search_find (priv->yelper, text);*/
+}
+
+gboolean
+dh_html_search_find_again (DhHtml   *html,
+			   gboolean  backwards)
+{
+	DhHtmlPriv *priv;
+
+	g_return_val_if_fail (DH_IS_HTML (html), FALSE);
+
+	priv = html->priv;
+
+	/*return dh_webkit_utils_search_find_again (priv->yelper, backwards);*/
+	return FALSE;
+}
+
+void
+dh_html_search_set_case_sensitive (DhHtml   *html,
+				   gboolean  case_sensitive)
+{
+	DhHtmlPriv *priv;
+
+	g_return_if_fail (DH_IS_HTML (html));
+
+	priv = html->priv;
+
+	/*dh_webkit_utils_search_set_case_sensitive (priv->yelper, case_sensitive);*/
+}
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(révision 830)
+++ src/Makefile.am	(copie de travail)
@@ -25,15 +25,19 @@
         $(DEVHELP_LIBS)					\
         libdevhelp-1.la
 
-devhelp_LDFLAGS = -R$(GECKO_HOME) $(AM_LDFLAGS)
+devhelp_LDFLAGS = $(AM_LDFLAGS)
 
 # Build the C++ code in a separate library so we can use our warning
 # flags for the C code.
 noinst_LTLIBRARIES = libcppwrapper.la
 
+if WITH_GECKO_ENGINE
+
+devhelp_LDFLAGS += -R$(GECKO_HOME)
+
 libcppwrapper_la_SOURCES =				\
-	Yelper.cpp					\
-	Yelper.h					\
+	YelperGecko.cpp					\
+	YelperGecko.h					\
 	dh-gecko-utils.cpp				\
 	dh-gecko-utils.h
 
@@ -70,6 +74,26 @@
 	$(GECKO_LIBS)					\
 	$(GECKO_EXTRA_LIBS)
 
+endif
+
+if WITH_WEBKIT_ENGINE
+
+libcppwrapper_la_SOURCES =				\
+	dh-webkit-utils.cpp				\
+	dh-webkit-utils.h
+
+libcppwrapper_la_CXXFLAGS =	\
+	$(AM_CXXFLAGS)		\
+        $(WEBKIT_CFLAGS)	\
+	-DBUILDING_GDK__=1	\
+	-DBUILDING_CAIRO__=1	\
+	$(LIBDEVHELP_CFLAGS)
+
+libcppwrapper_la_LIBADD = \
+	$(WEBKIT_LIBS)
+	
+endif
+
 lib_LTLIBRARIES = libdevhelp-1.la
 
 devhelpincludedir = $(includedir)/devhelp-1.0/devhelp
@@ -94,7 +118,6 @@
 	dh-base.c					\
 	dh-book-tree.c					\
 	dh-error.c					\
-	dh-html.c					\
 	dh-keyword-model.c				\
 	dh-link.c					\
 	dh-search.c					\
@@ -106,23 +129,49 @@
 
 libdevhelp_1_la_CPPFLAGS =				\
 	$(DEFINES)					\
-	$(addprefix -I$(GECKO_INCLUDE_ROOT)/,$(gecko_include_subdirs))	\
 	$(AM_CPPFLAGS)
 
 libdevhelp_1_la_CFLAGS = 				\
 	$(WARN_CFLAGS)					\
 	$(LIBDEVHELP_CFLAGS)				\
-	$(GECKO_CFLAGS)					\
 	$(AM_CFLAGS)
 
 libdevhelp_1_la_LIBADD =				\
 	libcppwrapper.la				\
-	$(LIBDEVHELP_LIBS)				\
+	$(LIBDEVHELP_LIBS)
+
+libdevhelp_1_la_LDFLAGS = $(AM_LDFLAGS)
+
+if WITH_GECKO_ENGINE
+
+libdevhelp_1_la_SOURCES += dh-gecko-html.c
+
+libdevhelp_1_la_CPPFLAGS += \
+	$(addprefix -I$(GECKO_INCLUDE_ROOT)/,$(gecko_include_subdirs))
+
+libdevhelp_1_la_CFLAGS += \
+	$(GECKO_CFLAGS)
+
+libdevhelp_1_la_LIBADD +=				\
 	$(GECKO_LIBS)					\
 	$(GECKO_EXTRA_LIBS)
 
-libdevhelp_1_la_LDFLAGS = -R$(GECKO_HOME) $(AM_LDFLAGS)
+libdevhelp_1_la_LDFLAGS += -R$(GECKO_HOME)
+endif
 
+if WITH_WEBKIT_ENGINE
+libdevhelp_1_la_SOURCES += dh-webkit-html.c
+
+libdevhelp_1_la_CFLAGS +=	\
+        $(WEBKIT_CFLAGS)	\
+	-DBUILDING_GDK__=1	\
+	-DBUILDING_CAIRO__=1
+
+libdevhelp_1_la_LIBADD += \
+	$(WEBKIT_LIBS)
+
+endif
+
 dh-marshal.h: dh-marshal.list
 	(cd $(srcdir) && \
 	@GLIB_GENMARSHAL@ --prefix=dh_marshal dh-marshal.list --header) > xgen-gmh \
