summaryrefslogtreecommitdiff
path: root/gtk/print.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2011-03-15 22:02:06 +0000
committerVincent Sanders <vince@netsurf-browser.org>2011-03-15 22:02:06 +0000
commit1da7b161f8eb8e2afbb46e9e2904dc3973fc2458 (patch)
treeb8e3f8f4fdd19d316c12dc39d515f053a6723a9a /gtk/print.c
parentb69816ff79aec1a472cdb184c45452d6926cf6f7 (diff)
downloadnetsurf-1da7b161f8eb8e2afbb46e9e2904dc3973fc2458.tar.gz
netsurf-1da7b161f8eb8e2afbb46e9e2904dc3973fc2458.tar.bz2
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
Diffstat (limited to 'gtk/print.c')
-rw-r--r--gtk/print.c29
1 files changed, 17 insertions, 12 deletions
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, &gtk_printer,
- settings, &height_to_print);
+ if (print_set_up(content_to_print, &gtk_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);
+ }
}
/**