Bug #462148: Fix multi-page printing on Win32 by using gtk_html_print_operation_run().

BP


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17883 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Andreas Köhler 2009-02-08 14:06:28 +00:00
parent 3db749b2e9
commit 0f1d97b4b6
2 changed files with 22 additions and 1 deletions

View File

@ -1163,6 +1163,18 @@ then
AC_MSG_ERROR([Goffice uses Cairo/GtkPrint but didn't find GtkHTML with GtkPrint support])
fi
# check for gtkhtml >= 3.16 (includes gtk_html_print_operation_run())
if test x$gtkhtml = x1; then
AC_MSG_CHECKING(for GtkHTML - version >= 3.16.0)
if $PKG_CONFIG 'libgtkhtml-3.14 >= 3.16.0'; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GTKHTML_3_16,1,[System has gtkhtml 3.16.0 or better])
HAVE_GTKHTML_3_16=1
else
AC_MSG_RESULT(no)
fi
fi
# fallback to older gtkhtml versions and gnomeprint
if test x$gtkhtml = x0
then

View File

@ -1226,6 +1226,7 @@ gnc_html_get_top_html (GtkHTML *html)
}
#ifdef GTKHTML_USES_GTKPRINT
#ifndef HAVE_GTKHTML_3_16
static void
draw_page_cb(GtkPrintOperation *operation, GtkPrintContext *context,
gint page_nr, gpointer user_data)
@ -1234,6 +1235,7 @@ draw_page_cb(GtkPrintOperation *operation, GtkPrintContext *context,
gtk_html_print_page((GtkHTML*) html->html, context);
}
#endif
void
gnc_html_print(gnc_html *html)
@ -1246,11 +1248,18 @@ gnc_html_print(gnc_html *html)
gnc_print_operation_init(print);
gtk_print_operation_set_use_full_page(print, FALSE);
gtk_print_operation_set_unit(print, GTK_UNIT_POINTS);
#ifdef HAVE_GTKHTML_3_16
res = gtk_html_print_operation_run((GtkHTML*) html->html, print,
GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
GTK_WINDOW(html->window), NULL, NULL,
NULL, NULL, NULL, NULL);
#else
gtk_print_operation_set_n_pages(print, 1);
g_signal_connect(print, "draw_page", G_CALLBACK(draw_page_cb), html);
res = gtk_print_operation_run(print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
GTK_WINDOW(html->window), NULL);
#endif
if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
gnc_print_operation_save_print_settings(print);