From 1da7b161f8eb8e2afbb46e9e2904dc3973fc2458 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 15 Mar 2011 22:02:06 +0000 Subject: Stop gtk printing from exploding if its unable to initialise the job add interface to clone a high level cache handle make generic printing core call new hlcache interface svn path=/trunk/netsurf/; revision=12068 --- gtk/print.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'gtk/print.c') diff --git a/gtk/print.c b/gtk/print.c index 667c554ee..ecd9a93f3 100644 --- a/gtk/print.c +++ b/gtk/print.c @@ -497,24 +497,29 @@ void gtk_print_signal_begin_print (GtkPrintOperation *operation, settings->scale = 0.7;/*at 0.7 the pages look the best*/ settings->font_func = &nsfont; - print_set_up(content_to_print, >k_printer, - settings, &height_to_print); + if (print_set_up(content_to_print, >k_printer, + settings, &height_to_print) == false) { + gtk_print_operation_cancel(operation); + + } else { - LOG(("page_width: %f ;page_height: %f; content height: %lf", - settings->page_width, settings->page_height, height_to_print)); + LOG(("page_width: %f ;page_height: %f; content height: %lf", + settings->page_width, settings->page_height, + height_to_print)); - height_on_page = settings->page_height; - height_on_page = height_on_page - + height_on_page = settings->page_height; + height_on_page = height_on_page - FIXTOFLT(FSUB(settings->margins[MARGINTOP], - settings->margins[MARGINBOTTOM])); - height_to_print *= settings->scale; + settings->margins[MARGINBOTTOM])); + height_to_print *= settings->scale; - page_number = height_to_print / height_on_page; + page_number = height_to_print / height_on_page; - if (height_to_print - page_number * height_on_page > 0) - page_number += 1; + if (height_to_print - page_number * height_on_page > 0) + page_number += 1; - gtk_print_operation_set_n_pages(operation, page_number); + gtk_print_operation_set_n_pages(operation, page_number); + } } /** -- cgit v1.2.3