GtkPrintContext *context,
PsppireOutputWindow *window)
{
- if ( window->print_item < window->n_items )
+ if (window->paginated)
+ {
+ /* Sometimes GTK+ emits this signal again even after pagination is
+ complete. Don't let that screw up printing. */
+ return TRUE;
+ }
+ else if ( window->print_item < window->n_items )
{
xr_driver_output_item (window->print_xrd, window->items[window->print_item++]);
while (xr_driver_need_new_page (window->print_xrd))
else
{
gtk_print_operation_set_n_pages (operation, window->print_n_pages);
- window->print_item = 0;
+
+ /* Re-create the driver to do the real printing. */
+ xr_driver_destroy (window->print_xrd);
create_xr_print_driver (context, window);
+ window->print_item = 0;
+ window->paginated = TRUE;
+
return TRUE;
}
}
window->print_item = 0;
window->print_n_pages = 1;
+ window->paginated = FALSE;
}
static void
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2008, 2009, 2010 Free Software Foundation
+ Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
struct xr_driver *print_xrd;
int print_item;
int print_n_pages;
+ gboolean paginated;
};
struct _PsppireOutputWindowClass