r17909 - gnucash/branches/2.2 - [17883] Bug #462148: Fix multi-page printing on Win32 by using gtk_html_print_operation_run().

Andreas Köhler andi5 at cvs.gnucash.org
Sat Feb 14 16:11:59 EST 2009


Author: andi5
Date: 2009-02-14 16:11:59 -0500 (Sat, 14 Feb 2009)
New Revision: 17909
Trac: http://svn.gnucash.org/trac/changeset/17909

Modified:
   gnucash/branches/2.2/configure.in
   gnucash/branches/2.2/src/gnome-utils/gnc-html.c
Log:
[17883] Bug #462148: Fix multi-page printing on Win32 by using gtk_html_print_operation_run().

Modified: gnucash/branches/2.2/configure.in
===================================================================
--- gnucash/branches/2.2/configure.in	2009-02-14 21:11:51 UTC (rev 17908)
+++ gnucash/branches/2.2/configure.in	2009-02-14 21:11:59 UTC (rev 17909)
@@ -1203,6 +1203,18 @@
       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

Modified: gnucash/branches/2.2/src/gnome-utils/gnc-html.c
===================================================================
--- gnucash/branches/2.2/src/gnome-utils/gnc-html.c	2009-02-14 21:11:51 UTC (rev 17908)
+++ gnucash/branches/2.2/src/gnome-utils/gnc-html.c	2009-02-14 21:11:59 UTC (rev 17909)
@@ -1231,6 +1231,7 @@
 }
 
 #ifdef GTKHTML_USES_GTKPRINT
+#ifndef HAVE_GTKHTML_3_16
 static void
 draw_page_cb(GtkPrintOperation *operation, GtkPrintContext *context,
              gint page_nr, gpointer user_data)
@@ -1239,6 +1240,7 @@
 
     gtk_html_print_page((GtkHTML*) html->html, context);
 }
+#endif
 
 void
 gnc_html_print(gnc_html *html)
@@ -1255,11 +1257,18 @@
 
     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) {
         G_LOCK(print_settings);



More information about the gnucash-changes mailing list