diff --git a/configure.in b/configure.in index f0f732d42f..1614b6f3f4 100644 --- a/configure.in +++ b/configure.in @@ -1033,6 +1033,8 @@ then [Select HTML engine [default=gtkhtml]]), [],[with_html_engine="gtkhtml"]) + AC_MSG_RESULT([$with_html_engine]) + case "$with_html_engine" in gtkhtml) @@ -1056,12 +1058,24 @@ then webkit) PKG_CHECK_MODULES(WEBKIT, webkit-1.0 >= "1.0") AC_DEFINE(WANT_WEBKIT,1,[Use webkit instead of gtkhtml]) + AC_MSG_CHECKING(for webkit_web_frame_print_full) + saved_CFLAGS="${CFLAGS}" + saved_LIBS="${LIBS}" + CFLAGS="${CFLAGS} ${WEBKIT_CFLAGS}" + LIBS="${LIBS} ${WEBKIT_LIBS}" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[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_MSG_RESULT(no)]) + CFLAGS="${saved_CFLAGS}" + LIBS="${saved_LIBS}" ;; *) AC_MSG_ERROR([Invalid HTML engine: must be gtkhtml or webkit]) ;; esac - AC_MSG_RESULT([$with_html_engine]) - AM_CONDITIONAL(HTML_USING_WEBKIT, [test x${with_html_engine} = xwebkit]) AC_SUBST(WEBKIT_CFLAGS) AC_SUBST(WEBKIT_LIBS) diff --git a/src/html/gnc-html-webkit.c b/src/html/gnc-html-webkit.c index 67185b9269..b80f295cbc 100644 --- a/src/html/gnc-html-webkit.c +++ b/src/html/gnc-html-webkit.c @@ -47,6 +47,7 @@ #include "gnc-html-webkit.h" #include "gnc-html-history.h" #include "gnc-html-graph-gog-webkit.h" +#include "print-session.h" G_DEFINE_TYPE(GncHtmlWebkit, gnc_html_webkit, GNC_TYPE_HTML ) @@ -1036,13 +1037,13 @@ impl_webkit_export_to_file( GncHtml* self, const char *filepath ) static void impl_webkit_print( GncHtml* self ) { -#ifndef G_OS_WIN32 +#ifndef HAVE_WEBKIT_PRINT_FULL extern void webkit_web_frame_print( WebKitWebFrame * frame ); #endif GncHtmlWebkitPrivate* priv; WebKitWebFrame* frame; -#ifdef G_OS_WIN32 +#ifdef HAVE_WEBKIT_PRINT_FULL GtkPrintOperation* op = gtk_print_operation_new(); GError* error = NULL; #endif @@ -1050,8 +1051,11 @@ impl_webkit_print( GncHtml* self ) priv = GNC_HTML_WEBKIT_GET_PRIVATE(self); frame = webkit_web_view_get_main_frame( priv->web_view ); +#ifdef HAVE_WEBKIT_PRINT_FULL + gnc_print_operation_init( op ); #ifdef G_OS_WIN32 gtk_print_operation_set_unit( op, GTK_UNIT_POINTS ); +#endif webkit_web_frame_print_full( frame, op, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, &error ); g_object_unref( op );