[gnumeric] set the total number of pages to be set before using gtk_print_operation_preview_is_selected (why do



commit f746a8168a8fde40430e593a0361fbe4d296a568
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Wed Oct 19 12:02:40 2011 -0600

    set the total number of pages to be set before using gtk_print_operation_preview_is_selected (why does it work if a range is specified if the total number of pages is still 0?)
    
    2011-10-19 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/print.c (gnm_paginate_cb): set the total number of pages
    	to be set before using gtk_print_operation_preview_is_selected

 ChangeLog   |    5 +++++
 src/print.c |   12 ++++--------
 2 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a28a15f..4ca3724 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-10-19 Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* src/print.c (gnm_paginate_cb): set the total number of pages
+	to be set before using gtk_print_operation_preview_is_selected
+
+2011-10-19 Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* src/print.c (PrintingInstance): new field
 	(gnm_paginate_cb): check for too many previewed pages
 	(gnm_ready_preview_cb): new
diff --git a/src/print.c b/src/print.c
index dcb56c0..1a87bf2 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1175,9 +1175,11 @@ gnm_paginate_cb (GtkPrintOperation *operation,
 				n_pages += spi->pages;
 			}
 
-			if (pi->preview) {
+			if (pi->preview && n_pages > 1000) {
 				int i, count = 0;
 
+				gtk_print_operation_set_n_pages 
+					(operation, n_pages == 0 ? 1 : n_pages);
 				for (i = 0; i < n_pages; i++) {
 					if (gtk_print_operation_preview_is_selected
 					    (GTK_PRINT_OPERATION_PREVIEW (operation),
@@ -1186,18 +1188,12 @@ gnm_paginate_cb (GtkPrintOperation *operation,
 					if (count > 1000)
 						break;
 				}
-				/* Note that gtk_print_operation_preview_is_selected always */
-				/* returns FALSE if "all pages" where selected! This is a gtk bug! */
-				if ((count > 1000 || (count == 0 && n_pages > 1000)) && !go_gtk_query_yes_no 
+				if (count > 1000 && !go_gtk_query_yes_no 
 				    (pi->progress != NULL ? 
 				     GTK_WINDOW (pi->progress) : wbcg_toplevel (WBC_GTK (pi->wbc)), 
 				     FALSE, "%s",
-				     (count > 1000) ?
 				     _("You have chosen more than 1000 pages to preview. "
 				       "This may take a long time. "
-				       "Do you really want to proceed?") :
-				     _("You may have chosen more than 1000 pages to preview. "
-				       "This would take a long time. "
 				       "Do you really want to proceed?")))
 					n_pages = 0;
 			}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]