r19027 - gnucash/trunk - Check for webkit_web_view_load_uri() function, and if not available, fall back to webkit_web_view_load_html_string().
Phil Longstaff
plongstaff at code.gnucash.org
Sat Apr 17 12:52:20 EDT 2010
Author: plongstaff
Date: 2010-04-17 12:52:20 -0400 (Sat, 17 Apr 2010)
New Revision: 19027
Trac: http://svn.gnucash.org/trac/changeset/19027
Modified:
gnucash/trunk/configure.in
gnucash/trunk/src/html/gnc-html-webkit.c
Log:
Check for webkit_web_view_load_uri() function, and if not available, fall back to webkit_web_view_load_html_string().
This change also changes the config #define name from HAVE_WEBKIT_PRINT_FULL to HAVE_WEBKIT_WEB_FRAME_PRINT_FULL to be a bit more descriptive.
Modified: gnucash/trunk/configure.in
===================================================================
--- gnucash/trunk/configure.in 2010-04-17 16:17:55 UTC (rev 19026)
+++ gnucash/trunk/configure.in 2010-04-17 16:52:20 UTC (rev 19027)
@@ -1058,6 +1058,10 @@
webkit)
PKG_CHECK_MODULES(WEBKIT, webkit-1.0 >= "1.0")
AC_DEFINE(WANT_WEBKIT,1,[Use webkit instead of gtkhtml])
+ oLIBS="$LIBS"
+ LIBS="$LIBS -lwebkit-1.0"
+ AC_CHECK_FUNCS(webkit_web_view_load_uri)
+ LIBS="$oLIBS"
AC_MSG_CHECKING(for webkit_web_frame_print_full)
saved_CFLAGS="${CFLAGS}"
saved_LIBS="${LIBS}"
@@ -1068,7 +1072,7 @@
[[#include <webkit/webkit.h>]],
[[webkit_web_frame_print_full( 0, 0, 0, 0 );]])],
[AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_WEBKIT_PRINT_FULL,1,[webkit_web_frame_print_full exists])],
+ AC_DEFINE(HAVE_WEBKIT_WEB_FRAME_PRINT_FULL,1,[webkit_web_frame_print_full exists])],
[AC_MSG_RESULT(no)])
CFLAGS="${saved_CFLAGS}"
LIBS="${saved_LIBS}"
Modified: gnucash/trunk/src/html/gnc-html-webkit.c
===================================================================
--- gnucash/trunk/src/html/gnc-html-webkit.c 2010-04-17 16:17:55 UTC (rev 19026)
+++ gnucash/trunk/src/html/gnc-html-webkit.c 2010-04-17 16:52:20 UTC (rev 19027)
@@ -24,6 +24,7 @@
********************************************************************/
#include "config.h"
+#include "platform.h"
#include <gtk/gtk.h>
#include <glib/gi18n.h>
@@ -676,10 +677,12 @@
impl_webkit_show_data( GncHtml* self, const gchar* data, int datalen )
{
GncHtmlWebkitPrivate* priv;
+#if HAVE(WEBKIT_WEB_VIEW_LOAD_URI)
#define TEMPLATE_REPORT_FILE_NAME "gnc-report-XXXXXX.html"
int fd;
gchar* uri;
gchar *filename;
+#endif
g_return_if_fail( self != NULL );
g_return_if_fail( GNC_IS_HTML_WEBKIT(self) );
@@ -688,6 +691,7 @@
priv = GNC_HTML_WEBKIT_GET_PRIVATE(self);
+#if HAVE(WEBKIT_WEB_VIEW_LOAD_URI)
/* Export the HTML to a file and load the file URI. On Linux, this seems to get around some
security problems (otherwise, it can complain that embedded images aren't permitted to be
viewed because they are local resources). On Windows, this allows the embedded images to
@@ -702,6 +706,9 @@
DEBUG("Loading uri '%s'", uri);
webkit_web_view_load_uri( priv->web_view, uri );
g_free( uri );
+#else
+ webkit_web_view_load_html_string( priv->web_view, data, BASE_URI_NAME );
+#endif
LEAVE("");
}
@@ -1037,13 +1044,13 @@
static void
impl_webkit_print( GncHtml* self )
{
-#ifndef HAVE_WEBKIT_PRINT_FULL
+#if HAVE(WEBKIT_WEB_FRAME_PRINT_FULL)
extern void webkit_web_frame_print( WebKitWebFrame * frame );
#endif
GncHtmlWebkitPrivate* priv;
WebKitWebFrame* frame;
-#ifdef HAVE_WEBKIT_PRINT_FULL
+#if HAVE(WEBKIT_WEB_FRAME_PRINT_FULL)
GtkPrintOperation* op = gtk_print_operation_new();
GError* error = NULL;
#endif
@@ -1051,7 +1058,7 @@
priv = GNC_HTML_WEBKIT_GET_PRIVATE(self);
frame = webkit_web_view_get_main_frame( priv->web_view );
-#ifdef HAVE_WEBKIT_PRINT_FULL
+#if HAVE(WEBKIT_WEB_FRAME_PRINT_FULL)
gnc_print_operation_init( op );
#ifdef G_OS_WIN32
gtk_print_operation_set_unit( op, GTK_UNIT_POINTS );
More information about the gnucash-changes
mailing list