yelp r3152 - in branches/webkit: . src
- From: dscorgie svn gnome org
- To: svn-commits-list gnome org
- Subject: yelp r3152 - in branches/webkit: . src
- Date: Wed, 9 Jul 2008 09:44:00 +0000 (UTC)
Author: dscorgie
Date: Wed Jul 9 09:43:59 2008
New Revision: 3152
URL: http://svn.gnome.org/viewvc/yelp?rev=3152&view=rev
Log:
* configure.in:
* src/yelp-html.cpp:
* src/yelp-html.h:
* src/yelp-io-channel.c:
* src/yelp-search-parser.c:
* src/yelp-window.c:
* src/yelp-main.c:
* src/Makefile.am:
Initial port to webkit, dropping gecko
This will be broken
Various things still need implemented:
- copy / paste, select all
Modified:
branches/webkit/ChangeLog
branches/webkit/configure.in
branches/webkit/src/Makefile.am
branches/webkit/src/yelp-html.cpp
branches/webkit/src/yelp-html.h
branches/webkit/src/yelp-io-channel.c
branches/webkit/src/yelp-main.c
branches/webkit/src/yelp-search-parser.c
branches/webkit/src/yelp-window.c
Modified: branches/webkit/configure.in
==============================================================================
--- branches/webkit/configure.in (original)
+++ branches/webkit/configure.in Wed Jul 9 09:43:59 2008
@@ -37,14 +37,6 @@
MOZILLA_WARN_CXXFLAGS="-Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
fi
-if test "x$enable_maintainer_mode" = "xyes"; then
- AC_DEFINE([MAINTAINER_MODE],[1],[Define to enable 'maintainer-only' behaviour])
-# DEPRECATION_FLAGS="-DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGCONF_DISABLE_DEPRECATED -DGNOME_VFS_DISABLE_DEPRECATED -DBONOBO_UI_DISABLE_DEPRECATED -DBONOBO_DISABLE_DEPRECATED -DLIBGLADE_DISABLE_DEPRECATED -DPANGO_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED"
- if test "x$GCC" = "xyes"; then
- MOZILLA_WARN_CXXFLAGS="-Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth $MOZILLA_WARN_CXXFLAGS"
- fi
-fi
-
if test "x$enable_debug" = "xyes"; then
AC_DEFINE([YELP_DEBUG],[1],[Enable Yelp debugging])
AM_CFLAGS="$AM_CFLAGS -pedantic -ansi"
@@ -221,41 +213,23 @@
dnl =>
AC_SUBST(BZ_LIBS)
-
# *****
-# Gecko
+# Webkit
# *****
+ PKG_CHECK_MODULES(YELP_WEBKIT, "webkit-1.0")
+ AC_SUBST(YELP_WEBKIT_CFLAGS)
+ AC_SUBST(YELP_WEBKIT_LIBS)
+ AC_DEFINE(WEBKIT_BACKEND, 1, [Webkit Backend])
-GECKO_INIT([MOZILLA])
-GECKO_DEFINES
-
-AC_SUBST([MOZILLA])
-AC_SUBST([MOZILLA_FLAVOUR])
-AC_SUBST([MOZILLA_INCLUDE_ROOT])
-AC_SUBST([MOZILLA_HOME])
-AC_SUBST([MOZILLA_PREFIX])
-AC_SUBST([MOZILLA_EXTRA_LIBS])
-AC_SUBST([MOZILLA_GLUE_LIBS])
-
-case "$MOZILLA" in
-xulrunner) gecko_min_version=1.8 ;;
-libxul*) gecko_min_version=1.9 ;;
-*firefox) gecko_min_version=1.5 ;;
-*) AC_MSG_ERROR([$gecko_cv_gecko is not supported])
-esac
+### Gecko does demand a lot of things here, doesn't it?
-if test $MOZILLA = libxul-embedding; then
- PKG_CHECK_MODULES([MOZILLA_COMPONENT],[libxul-embedding $gecko_cv_extra_pkg_dependencies])
- MOZILLA_COMPONENT_CFLAGS="$MOZILLA_COMPONENT_CFLAGS `$PKG_CONFIG --cflags ${gecko_cv_gecko}` `$PKG_CONFIG --define-variable=includetype=unstable --cflags ${gecko_cv_gecko}`"
-else
- PKG_CHECK_MODULES([MOZILLA_COMPONENT],[${gecko_cv_gecko}-xpcom >= $gecko_min_version $gecko_cv_extra_pkg_dependencies])
-fi
-# Set flags
+# More flags
AM_CPPFLAGS="$AM_CPPFLAGS $DEPRECATION_FLAGS"
AM_CFLAGS="$AM_CFLAGS $WARN_CFLAGS $MORE_WARN_FLAGS"
-AM_CXXFLAGS="$AM_CXXFLAGS $WARN_CXXFLAGS $MOZILLA_WARN_CXXFLAGS"
+
+
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_CXXFLAGS])
@@ -286,5 +260,4 @@
Debug enabled: ${enable_debug}
Search backend: ${search_backend}
- Mozilla version: ${MOZILLA}
"
Modified: branches/webkit/src/Makefile.am
==============================================================================
--- branches/webkit/src/Makefile.am (original)
+++ branches/webkit/src/Makefile.am Wed Jul 9 09:43:59 2008
@@ -1,12 +1,10 @@
bin_PROGRAMS = yelp
yelp_SOURCES = \
- Yelper.cpp Yelper.h \
yelp-base.c yelp-base.h \
yelp-bookmarks.c yelp-bookmarks.h \
yelp-debug.c yelp-debug.h \
yelp-error.c yelp-error.h \
- yelp-gecko-utils.cpp yelp-gecko-utils.h \
yelp-html.cpp yelp-html.h \
yelp-io-channel.c yelp-io-channel.h \
yelp-settings.c yelp-settings.h \
@@ -14,10 +12,8 @@
yelp-window.c yelp-window.h \
yelp-marshal.c yelp-marshal.h \
yelp-main.c \
- yelp-print.c yelp-print.h \
yelp-page.c yelp-page.h \
yelp-transform.c yelp-transform.h \
- yelp-gecko-services.h yelp-gecko-services.cpp \
yelp-document.h yelp-document.c \
yelp-toc.h yelp-toc.c \
yelp-docbook.h yelp-docbook.c \
@@ -30,6 +26,7 @@
yelp-search.c yelp-search.h \
yelp-search-parser.c yelp-search-parser.h
+
YELP_DEFINES = \
-DG_LOG_DOMAIN=\"Yelp\" \
-DPREFIX=\""$(prefix)"\" \
@@ -40,46 +37,18 @@
-DSERVERDIR=\"$(libexecdir)\" \
-DBINDIR=\""$(bindir)"\" \
-DSHAREDIR=\""$(pkgdatadir)"\" \
- -DMOZILLA_HOME=\""$(MOZILLA_HOME)\"" \
-DGDU_ICON_PATH=\"$(GDU_ICON_PATH)\"
-mozilla_include_subdirs = \
- . \
- commandhandler \
- content \
- docshell \
- dom \
- fastfind \
- find \
- gtkembedmoz \
- gfx \
- layout \
- necko \
- pref \
- string \
- uriloader \
- webbrwsr \
- webshell \
- widget
-
-yelp_CPPFLAGS = \
- -I$(top_srcdir) \
- -I$(top_builddir)/src \
- $(YELP_DEFINES) \
- $(AM_CPPFLAGS)
-
-yelp_CPPFLAGS += $(MOZILLA_COMPONENT_CFLAGS)
-yelp_CPPFLAGS += $(addprefix -I$(MOZILLA_INCLUDE_ROOT)/,$(mozilla_include_subdirs))
-
yelp_CFLAGS = \
$(YELP_CFLAGS) \
$(YELP_SEARCH_CFLAGS) \
- $(AM_CFLAGS)
+ $(AM_CFLAGS) \
+ $(YELP_WEBKIT_CFLAGS)
yelp_CXXFLAGS = \
$(YELP_CFLAGS) \
$(YELP_SEARCH_CFLAGS) \
- $(MOZILLA_COMPONENT_CFLAGS) \
+ $(YELP_WEBKIT_CFLAGS) \
$(AM_CXXFLAGS)
yelp_LDADD = \
@@ -89,17 +58,11 @@
$(Z_LIBS) \
$(BZ_LIBS) \
$(LZMADEC_LIBS) \
- $(X_LIBS) \
- $(MOZILLA_COMPONENT_LIBS) \
- $(MOZILLA_EXTRA_LIBS) \
- $(MOZILLA_GLUE_LIBS)
+ $(YELP_WEBKIT_LIBS) \
+ $(X_LIBS)
yelp_LDFLAGS = $(AM_LDFLAGS)
-if !HAVE_GECKO_XPCOM_GLUE
-yelp_LDFLAGS += -R$(MOZILLA_HOME)
-endif
-
#check_PROGRAMS = \
# test-document \
# test-man-parser \
Modified: branches/webkit/src/yelp-html.cpp
==============================================================================
--- branches/webkit/src/yelp-html.cpp (original)
+++ branches/webkit/src/yelp-html.cpp Wed Jul 9 09:43:59 2008
@@ -21,15 +21,15 @@
* Author: Marco Pesenti Gritti <marco gnome org>
*/
-#include <mozilla-config.h>
#include <config.h>
-
-#include "yelp-gecko-services.h"
-#include "yelp-gecko-utils.h"
#include "yelp-marshal.h"
#include "yelp-settings.h"
-#include "Yelper.h"
+#include <string.h>
+#include <webkit/webkitwebframe.h>
+#include <webkit/webkitnetworkrequest.h>
+#include <webkit/webkitwebview.h>
+#include <webkit/webkitwebsettings.h>
#include "yelp-html.h"
#include "yelp-debug.h"
@@ -38,16 +38,19 @@
#define YELP_HTML_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), YELP_TYPE_HTML, YelpHtmlPriv))
struct _YelpHtmlPriv {
- Yelper *yelper;
+ gchar *content;
+ gchar *mime;
+ gchar *find_string;
+ gboolean initialised;
gchar *base_uri;
gchar *anchor;
gboolean frames_enabled;
guint timeout;
};
-static void html_set_fonts (void);
-static void html_set_colors (void);
-static void html_set_a11y (void);
+static void html_set_fonts (YelpHtml *html);
+static void html_set_colors (YelpHtml *html);
+static void html_set_a11y (YelpHtml *html);
enum {
URI_SELECTED,
@@ -61,49 +64,45 @@
static GObjectClass *parent_class = NULL;
-static void
-html_title (GtkMozEmbed *embed)
-{
- YelpHtml *html = YELP_HTML (embed);
- char *new_title;
-
- new_title = gtk_moz_embed_get_title (embed);
-
- if (new_title && *new_title != '\0')
- {
- g_signal_emit (html, signals[TITLE_CHANGED], 0, new_title);
- g_free (new_title);
- }
-}
-
-static gint
-html_dom_mouse_down (GtkMozEmbed *embed, gpointer dom_event)
+static WebKitNavigationResponse
+html_open_uri (WebKitWebView *view, WebKitWebFrame *frame, WebKitNetworkRequest* req)
{
- YelpHtml *html = YELP_HTML (embed);
-
- html->priv->yelper->ProcessMouseEvent (dom_event);
-
- return FALSE;
-}
-
-static gint
-html_open_uri (GtkMozEmbed *embed, const gchar *uri)
-{
- YelpHtml *html = YELP_HTML (embed);
+
+ const gchar *uri = webkit_network_request_get_uri (req);
+ WebKitNavigationResponse resp = WEBKIT_NAVIGATION_RESPONSE_ACCEPT;
+ YelpHtml *html = YELP_HTML (view);
gboolean block_load;
-
- g_return_val_if_fail (uri != NULL, FALSE);
+ gchar *real_uri;
debug_print (DB_FUNCTION, "entering\n");
debug_print (DB_ARG, " uri = \"%s\"\n", uri);
+
+
+ if (uri[0] == '#') {
+ gchar *hash = g_strrstr (html->priv->base_uri, "#");
+ if (hash) {
+ gchar *tmp = g_strndup (html->priv->base_uri,
+ (hash - html->priv->base_uri));
+ real_uri = g_strdup_printf ("%s%s", tmp, uri);
+
+ g_free (tmp);
+ } else {
+ real_uri = g_strdup_printf ("%s%s", html->priv->base_uri, uri);
+ }
+ } else {
+ real_uri = g_strdup (uri);
+ }
+
if (!html->priv->frames_enabled) {
- g_signal_emit (html, signals[URI_SELECTED], 0, uri, FALSE);
- block_load = TRUE;
+ g_signal_emit (html, signals[URI_SELECTED], 0, real_uri, FALSE);
+ resp = WEBKIT_NAVIGATION_RESPONSE_IGNORE;
} else {
- g_signal_emit (html, signals[FRAME_SELECTED], 0, uri, FALSE, &block_load);
+ g_signal_emit (html, signals[FRAME_SELECTED], 0, real_uri, FALSE, &block_load);
}
- return block_load;
+
+ g_free (real_uri);
+ return resp;
}
static void
@@ -113,12 +112,6 @@
GTK_WIDGET_CLASS (parent_class)->realize (widget);
- nsresult rv;
- rv = html->priv->yelper->Init ();
-
- if (NS_FAILED (rv)) {
- g_warning ("Yelper initialization failed for %p\n", (void*) html);
- }
}
static void
@@ -132,29 +125,31 @@
priv->base_uri = NULL;
priv->anchor = NULL;
priv->timeout = 0;
+ priv->content = NULL;
+ priv->mime = NULL;
+ priv->initialised = FALSE;
- priv->yelper = new Yelper (GTK_MOZ_EMBED (html));
klass = YELP_HTML_GET_CLASS (html);
if (!klass->font_handler) {
klass->font_handler =
yelp_settings_notify_add (YELP_SETTINGS_INFO_FONTS,
(GHookFunc) html_set_fonts,
- NULL);
- html_set_fonts ();
+ html);
+ html_set_fonts (html);
}
if (!klass->color_handler) {
klass->color_handler =
yelp_settings_notify_add (YELP_SETTINGS_INFO_COLOR,
(GHookFunc) html_set_colors,
- NULL);
- html_set_colors ();
+ html);
+ html_set_colors (html);
}
if (!klass->a11y_handler) {
klass->a11y_handler =
yelp_settings_notify_add (YELP_SETTINGS_INFO_A11Y,
(GHookFunc) html_set_a11y,
- NULL);
- html_set_a11y ();
+ html);
+ html_set_a11y (html);
}
}
@@ -163,8 +158,6 @@
{
YelpHtml *html = YELP_HTML (object);
- html->priv->yelper->Destroy ();
-
parent_class->dispose (object);
}
@@ -174,7 +167,6 @@
YelpHtml *html = YELP_HTML (object);
YelpHtmlPriv *priv = html->priv;
- delete priv->yelper;
if (priv->timeout)
g_source_remove (priv->timeout);
@@ -189,7 +181,7 @@
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- GtkMozEmbedClass *moz_embed_class = GTK_MOZ_EMBED_CLASS (klass);
+ WebKitWebViewClass* wc_class = WEBKIT_WEB_VIEW_CLASS (klass);
parent_class = (GObjectClass *) g_type_class_peek_parent (klass);
@@ -198,9 +190,8 @@
widget_class->realize = html_realize;
- moz_embed_class->title = html_title;
- moz_embed_class->dom_mouse_down = html_dom_mouse_down;
- moz_embed_class->open_uri = html_open_uri;
+
+ wc_class->navigation_requested = html_open_uri;
klass->font_handler = 0;
klass->color_handler = 0;
@@ -228,16 +219,6 @@
G_TYPE_BOOLEAN,
2, G_TYPE_POINTER, G_TYPE_BOOLEAN);
- signals[TITLE_CHANGED] =
- g_signal_new ("title_changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (YelpHtmlClass,
- title_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE,
- 1, G_TYPE_STRING);
signals[POPUPMENU_REQUESTED] =
g_signal_new ("popupmenu_requested",
@@ -271,7 +252,7 @@
(GInstanceInitFunc) html_init,
};
- type = g_type_register_static (GTK_TYPE_MOZ_EMBED,
+ type = g_type_register_static (WEBKIT_TYPE_WEB_VIEW,
"YelpHtml",
&info, (GTypeFlags) 0);
}
@@ -313,22 +294,30 @@
debug_print (DB_FUNCTION, "entering\n");
html->priv->frames_enabled = FALSE;
- gtk_moz_embed_open_stream (GTK_MOZ_EMBED (html),
- html->priv->base_uri,
- mime);
+ g_free (html->priv->content);
+ html->priv->content = NULL;
+ g_free (html->priv->mime);
+ html->priv->mime = g_strdup(mime);
}
void
yelp_html_write (YelpHtml *html, const gchar *data, gint len)
{
- if (len == -1) len = strlen (data);
+ gchar *tmp = NULL;
+
+ if (len == -1) len = strlen (data);
debug_print (DB_FUNCTION, "entering\n");
debug_print (DB_ARG, " data = %i bytes\n", strlen (data));
debug_print (DB_ARG, " len = %i\n", len);
- gtk_moz_embed_append_data (GTK_MOZ_EMBED (html),
- data, len);
+ if (html->priv->content) {
+ tmp = g_strjoin (NULL, html->priv->content, data, NULL);
+ g_free (html->priv->content);
+ html->priv->content = tmp;
+ } else {
+ html->priv->content = g_strdup (data);
+ }
}
void
@@ -356,42 +345,53 @@
g_free (string);
}
-/* Fire "children_changed::add" event to refresh "UI-Grab" window of GOK,
- * this event is not fired when using gtk_moz_embed_xxx_stream,
- * see Mozilla bug #293670. Done in a timeout to allow mozilla to
- * actually draw to the screen */
-
-static gboolean
-timeout_update_gok (YelpHtml *html)
-{
- g_signal_emit_by_name (gtk_widget_get_accessible (GTK_WIDGET (html)),
- "children_changed::add", -1, NULL, NULL);
- html->priv->timeout = 0;
- return FALSE;
-}
void
yelp_html_close (YelpHtml *html)
{
debug_print (DB_FUNCTION, "entering\n");
- gtk_moz_embed_close_stream (GTK_MOZ_EMBED (html));
- html->priv->timeout = g_timeout_add (2000,
- (GSourceFunc) timeout_update_gok,
- html);
+
+ if (!html->priv->initialised) {
+ html->priv->initialised = TRUE;
+ html_set_fonts (html);
+ html_set_colors (html);
+ html_set_a11y (html);
+ webkit_web_view_set_maintains_back_forward_list (WEBKIT_WEB_VIEW (html), FALSE);
+ }
+
+ /* TODO: Broken navigation requests: */
+ /* See https://bugs.webkit.org/show_bug.cgi?id=19360 */
+ webkit_web_view_load_string (WEBKIT_WEB_VIEW (html),
+ html->priv->content,
+ html->priv->mime,
+ NULL,
+ "foo");
+ g_free (html->priv->content);
+ html->priv->content = NULL;
+ g_free (html->priv->mime);
+ html->priv->mime = NULL;
}
gboolean
yelp_html_find (YelpHtml *html,
const gchar *find_string)
{
- return html->priv->yelper->Find (find_string);
+ if (html->priv->find_string)
+ g_free(html->priv->find_string);
+ html->priv->find_string = g_strdup (find_string);
+ return webkit_web_view_search_text (WEBKIT_WEB_VIEW (html),
+ find_string, FALSE,
+ TRUE, TRUE);
}
gboolean
yelp_html_find_again (YelpHtml *html,
gboolean forward)
{
- return html->priv->yelper->FindAgain ((PRBool) forward);
+ return webkit_web_view_search_text (WEBKIT_WEB_VIEW (html),
+ html->priv->find_string,
+ FALSE,
+ forward, TRUE);
}
void
@@ -400,7 +400,7 @@
gboolean match_case,
gboolean wrap)
{
- html->priv->yelper->SetFindProperties (str, (PRBool) match_case, (PRBool) wrap);
+ /* Empty */
}
void
@@ -420,79 +420,117 @@
void
yelp_html_copy_selection (YelpHtml *html)
{
- html->priv->yelper->DoCommand ("cmd_copy");
+ /* Empty TODO */
}
void
yelp_html_select_all (YelpHtml *html)
{
- html->priv->yelper->DoCommand ("cmd_selectAll");
-}
-
-void
-yelp_html_print (YelpHtml *html, YelpPrintInfo *info, gboolean preview, gint *npages)
-{
- html->priv->yelper->Print (info, preview, npages);
-}
-
-void
-yelp_html_preview_navigate (YelpHtml *html, gint page_no)
-{
- html->priv->yelper->PrintPreviewNavigate (page_no);
+ /* Empty TODO */
}
void
-yelp_html_preview_end (YelpHtml *html)
+yelp_html_print (YelpHtml *html)
{
- html->priv->yelper->PrintPreviewEnd ();
+ webkit_web_view_execute_script (WEBKIT_WEB_VIEW (html), "print();");
}
static void
-html_set_fonts (void)
+html_set_fonts (YelpHtml *html)
{
gchar *font;
+ WebKitWebSettings *settings;
+ GValue *name, *size;
+ gchar *str_name;
+ gint i_size;
+ gchar *tmp;
+
+ settings = webkit_web_view_get_settings (WEBKIT_WEB_VIEW (html));
font = yelp_settings_get_font (YELP_FONT_VARIABLE);
- yelp_gecko_set_font (YELP_FONT_VARIABLE, font);
+
+ /* We have to separate the string into name and size and then
+ * assign to the 2 gvalues */
+ tmp = g_strrstr (font, " ");
+ if (!tmp) {
+ g_warning ("Cannot decode font pattern %s", font);
+ g_free (font);
+ return;
+ }
+
+ name = g_new0 (GValue, 1);
+ size = g_new0 (GValue, 1);
+
+ name = g_value_init (name, G_TYPE_STRING);
+ size = g_value_init (size, G_TYPE_INT);
+
+ str_name = g_strndup (font, tmp - font);
+
+ i_size = g_strtod (tmp, NULL);
+
+ g_value_set_string (name, str_name);
+ g_value_set_int (size, i_size);
+
+ g_object_set_property (G_OBJECT (settings), "default-font-family",
+ name);
+ g_object_set_property (G_OBJECT (settings), "default-font-size",
+ size);
+
g_free (font);
font = yelp_settings_get_font (YELP_FONT_FIXED);
- yelp_gecko_set_font (YELP_FONT_FIXED, font);
+
+ tmp = g_strrstr (font, " ");
+ if (!tmp) {
+ g_warning ("Cannot decode monospace font pattern %s", font);
+ g_free (font);
+ return;
+ }
+
+ name = g_value_reset (name);
+ size = g_value_reset (size);
+
+ str_name = g_strndup (font, tmp - font);
+
+ i_size = g_strtod (tmp, NULL);
+
+ g_value_set_string (name, str_name);
+ g_value_set_int (size, i_size);
+
+
+ g_object_set_property (G_OBJECT (settings), "monospace-font-family",
+ name);
+ g_object_set_property (G_OBJECT (settings), "default-monospace-font-size",
+ size);
+
g_free (font);
}
static void
-html_set_colors (void)
+html_set_colors (YelpHtml *html)
{
- const gchar *color;
-
- color = yelp_settings_get_color (YELP_COLOR_FG);
- yelp_gecko_set_color (YELP_COLOR_FG, color);
+ /* TODO: No Webkit equivalent ... */
+ /* See https://bugs.webkit.org/show_bug.cgi?id=19486 */
- color = yelp_settings_get_color (YELP_COLOR_BG);
- yelp_gecko_set_color (YELP_COLOR_BG, color);
-
- color = yelp_settings_get_color (YELP_COLOR_ANCHOR);
- yelp_gecko_set_color (YELP_COLOR_ANCHOR, color);
}
static void
-html_set_a11y (void)
+html_set_a11y (YelpHtml *html)
{
gboolean caret;
caret = yelp_settings_get_caret ();
- yelp_gecko_set_caret (caret);
+ /* TODO Webkit version */
}
gboolean
yelp_html_initialize (void)
{
- return yelp_gecko_init ();
+ return TRUE;
}
void
yelp_html_shutdown (void)
{
- yelp_gecko_shutdown ();
+ /* Empty */
}
Modified: branches/webkit/src/yelp-html.h
==============================================================================
--- branches/webkit/src/yelp-html.h (original)
+++ branches/webkit/src/yelp-html.h Wed Jul 9 09:43:59 2008
@@ -23,7 +23,8 @@
#ifndef __YELP_HTML_H__
#define __YELP_HTML_H__
-#include <gtkmozembed.h>
+#include <config.h>
+#include <webkit/webkit.h>
#include "yelp-print.h"
@@ -41,14 +42,12 @@
typedef struct _YelpHtmlPriv YelpHtmlPriv;
struct _YelpHtml {
- GtkMozEmbed parent;
-
+ WebKitWebView parent;
YelpHtmlPriv *priv;
};
struct _YelpHtmlClass {
- GtkMozEmbedClass parent_class;
-
+ WebKitWebViewClass parent;
guint font_handler;
guint color_handler;
guint a11y_handler;
@@ -103,13 +102,7 @@
void yelp_html_select_all (YelpHtml *html);
-void yelp_html_print (YelpHtml *html,
- YelpPrintInfo *info,
- gboolean preview,
- gint *npages);
-void yelp_html_preview_end (YelpHtml *html);
-void yelp_html_preview_navigate (YelpHtml *html,
- gint page_no);
+void yelp_html_print (YelpHtml *html);
gboolean yelp_html_initialize (void);
void yelp_html_shutdown (void);
Modified: branches/webkit/src/yelp-io-channel.c
==============================================================================
--- branches/webkit/src/yelp-io-channel.c (original)
+++ branches/webkit/src/yelp-io-channel.c Wed Jul 9 09:43:59 2008
@@ -24,13 +24,6 @@
#include <config.h>
#endif
-#ifdef HAVE_GECKO_1_9
-/* This is needed to stop gecko's version of libz
- * interfering and making gzopen et. al. crazy defines.
- */
-#define MOZZCONF_H
-#endif
-
#include <stdio.h>
#include <glib.h>
Modified: branches/webkit/src/yelp-main.c
==============================================================================
--- branches/webkit/src/yelp-main.c (original)
+++ branches/webkit/src/yelp-main.c Wed Jul 9 09:43:59 2008
@@ -34,6 +34,7 @@
#include <dbus/dbus-glib-bindings.h>
#include <string.h>
#include <stdlib.h>
+#include <libxslt/xslt.h>
#include "client-bindings.h"
#include "yelp-window.h"
@@ -345,6 +346,8 @@
bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE);
+ xsltInit ();
+ g_thread_init (NULL);
local_id = (gchar *) g_getenv ("DESKTOP_STARTUP_ID");
@@ -367,7 +370,6 @@
GNOME_PROGRAM_STANDARD_PROPERTIES,
GNOME_PARAM_GOPTION_CONTEXT, context,
GNOME_PARAM_NONE);
- dbus_g_thread_init();
if (!startup_id) {
Time tmp;
@@ -386,7 +388,7 @@
}
if (!yelp_html_initialize ()) {
- g_printerr ("Could not initialize gecko!\n");
+ g_printerr ("Could not initialize HTML component\n");
exit (1);
}
@@ -409,16 +411,7 @@
if (private || !main_is_running ()) {
const gchar *env;
- /* workaround for bug #329461 */
- env = g_getenv ("MOZ_ENABLE_PANGO");
-
- if (env == NULL ||
- *env == '\0' ||
- g_str_equal(env, "0"))
- {
- g_setenv ("MOZ_DISABLE_PANGO", "1", TRUE);
- }
-
+ xsltInit ();
if (session_started) {
main_restore_session ();
} else {
Modified: branches/webkit/src/yelp-search-parser.c
==============================================================================
--- branches/webkit/src/yelp-search-parser.c (original)
+++ branches/webkit/src/yelp-search-parser.c Wed Jul 9 09:43:59 2008
@@ -840,9 +840,9 @@
gchar *ret;
if (suffix) {
- ret = g_strconcat (current, ":", new, suffix, NULL);
+ ret = g_strconcat (current, "\n", new, suffix, NULL);
} else {
- ret = g_strconcat (current, ":", new, NULL);
+ ret = g_strconcat (current, "\n", new, NULL);
}
g_free (current);
return ret;
@@ -910,7 +910,7 @@
suffixes = NULL;
}
- search_terms = g_strdelimit (search_terms, ":", ' ');
+/* search_terms = g_strdelimit (search_terms, ":", ' '); */
list_copy = g_strsplit (g_utf8_casefold (g_strstrip (
search_terms), -1),
" ", -1);
@@ -981,11 +981,11 @@
}
}
g_strfreev (list_copy);
- *terms = g_strsplit (term_str, ":", -1);
+ *terms = g_strsplit (term_str, "\n", -1);
n_terms = g_strv_length (*terms);
(*dups) = g_new0 (gint, n_terms);
(*stops) = g_new0 (gboolean, n_terms);
- list_copy = g_strsplit (dup_str, ":", -1);
+ list_copy = g_strsplit (dup_str, "\n", -1);
if (n_terms == 0)
goto done;
Modified: branches/webkit/src/yelp-window.c
==============================================================================
--- branches/webkit/src/yelp-window.c (original)
+++ branches/webkit/src/yelp-window.c Wed Jul 9 09:43:59 2008
@@ -126,11 +126,9 @@
gboolean handled,
gpointer user_data);
static void html_title_changed_cb (YelpHtml *html,
+ gpointer webframe,
gchar *title,
gpointer user_data);
-static void html_popupmenu_requested_cb (YelpHtml *html,
- gchar *uri,
- gpointer user_data);
static gboolean window_key_event_cb (GtkWidget *widget,
GdkEventKey *event,
YelpWindow *window);
@@ -244,6 +242,8 @@
YelpHtml *html_view;
GtkWidget *side_sw;
GtkWidget *search_action;
+ GtkWidget *html_sw;
+
/* Find in Page */
GtkToolItem *find_prev;
@@ -1036,7 +1036,7 @@
doc = yelp_info_new (real_uri);
break;
case YELP_RRN_TYPE_DOC:
- priv->base_uri = g_filename_to_uri (real_uri, NULL, NULL);
+ priv->base_uri = g_strdup(real_uri);
doc = yelp_docbook_new (real_uri);
break;
case YELP_RRN_TYPE_SEARCH:
@@ -1367,7 +1367,15 @@
gtk_paned_add1 (GTK_PANED (priv->pane), priv->side_sw);
priv->html_pane = gtk_vbox_new (FALSE, 0);
-
+ /* Webkit don't like showing scrollbars, so we have to add our
+ own */
+ priv->html_sw = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->html_sw),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->html_sw),
+ GTK_SHADOW_IN);
+
priv->find_bar = gtk_toolbar_new ();
gtk_toolbar_set_style (GTK_TOOLBAR (priv->find_bar), GTK_TOOLBAR_BOTH_HORIZ);
gtk_toolbar_set_icon_size (GTK_TOOLBAR (priv->find_bar), GTK_ICON_SIZE_MENU);
@@ -1389,21 +1397,20 @@
"title_changed",
G_CALLBACK (html_title_changed_cb),
window);
- g_signal_connect (priv->html_view,
- "popupmenu_requested",
- G_CALLBACK (html_popupmenu_requested_cb),
- window);
/* Connect to look for /'s */
g_signal_connect (window,
"key-press-event",
G_CALLBACK (window_key_event_cb),
window);
+ gtk_container_add (GTK_CONTAINER (priv->html_sw),
+ GTK_WIDGET (priv->html_view));
gtk_box_pack_end (GTK_BOX (priv->html_pane),
- GTK_WIDGET (priv->html_view),
+ GTK_WIDGET (priv->html_sw),
TRUE, TRUE, 0);
-
+ gtk_widget_show (priv->html_sw);
gtk_paned_add2 (GTK_PANED (priv->pane),
priv->html_pane);
+
gtk_box_pack_start (GTK_BOX (priv->main_box),
priv->pane,
TRUE, TRUE, 0);
@@ -1780,41 +1787,17 @@
return TRUE;
}
-static void
-html_title_changed_cb (YelpHtml *html,
- gchar *title,
- gpointer user_data)
-{
- gtk_window_set_title (GTK_WINDOW (user_data), title);
-}
-static void
-html_popupmenu_requested_cb (YelpHtml *html,
- gchar *uri,
- gpointer user_data)
+static void html_title_changed_cb (YelpHtml *html,
+ gpointer webframe,
+ gchar *title,
+ gpointer user_data)
{
- YelpWindow *window = YELP_WINDOW (user_data);
-
- gtk_ui_manager_remove_ui (window->priv->ui_manager,
- window->priv->merge_id);
-
- if (g_str_has_prefix(uri, "mailto:")) {
- gtk_ui_manager_add_ui (window->priv->ui_manager,
- window->priv->merge_id,
- "/ui/main_popup",
- "CpMail",
- "CopyMail",
- GTK_UI_MANAGER_MENUITEM,
- FALSE);
-
- }
- g_free (window->priv->uri);
- window->priv->uri = g_strdup (uri);
- gtk_menu_popup (GTK_MENU (window->priv->popup),
- NULL, NULL, NULL, NULL, 3, gtk_get_current_event_time());
+ gtk_window_set_title (GTK_WINDOW (user_data), title);
}
+
/** GtkTreeView Callbacks *****************************************************/
static void
@@ -1946,7 +1929,7 @@
yelp_page_free ((YelpPage *) func_data);
- yelp_print_run (print->window, print->html, print->gtk_win, print->vbox);
+ yelp_html_print (print->html);
break;
case YELP_DOCUMENT_SIGNAL_TITLE:
g_free (func_data);
@@ -2053,17 +2036,17 @@
gsize n;
gchar buffer[BUFFER_SIZE];
- file = g_file_new_for_uri (priv->uri);
- stream = g_file_read (file, NULL, NULL);
+ file = g_file_new_for_uri (priv->uri);
+ stream = g_file_read (file, NULL, NULL);
if (stream == NULL) {
/*GError *error = NULL;
- g_set_error (&error, YELP_ERROR, YELP_ERROR_IO,
- _("The file â%sâ could not be read. This file might "
- "be missing, or you might not have permissions to "
- "read it."),
- uri);
- window_error (window, error, TRUE);*/
+ g_set_error (&error, YELP_ERROR, YELP_ERROR_IO,
+ _("The file â%sâ could not be read. This file might "
+ "be missing, or you might not have permissions to "
+ "read it."),
+ uri);
+ window_error (window, error, TRUE);*/
/* TODO: Proper errors */
if (file)
@@ -2088,19 +2071,20 @@
}
while ((g_input_stream_read_all
- ((GInputStream *)stream, buffer, BUFFER_SIZE, &n, NULL, NULL))) {
+ ((GInputStream *)stream, buffer, BUFFER_SIZE, &n, NULL, NULL))) {
yelp_html_write (html, buffer, n);
}
- if (file)
- g_object_unref (file);
- if (stream)
- g_object_unref (stream);
+
+ yelp_html_print (html);
+
+ if (file)
+ g_object_unref (file);
+ if (stream)
+ g_object_unref (stream);
yelp_html_close (html);
- yelp_print_run (window, html, gtk_win, vbox);
-
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]