When printing WebKit based reports respect the Page Setup settings.

If webkit_web_frame_print_full exists in the version of WebKit being used then 
use it with a GtkPrintOperation which has been initialized from the Page
Setup data.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19025 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Mike Alexander 2010-04-16 05:26:25 +00:00
parent 18caf227a6
commit 33798cd3d3
2 changed files with 22 additions and 4 deletions

View File

@ -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/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_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)

View File

@ -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 );