diff options
author | Marek Kasik <mkasik@redhat.com> | 2009-08-10 11:37:32 +0200 |
---|---|---|
committer | Marek Kasik <mkasik@redhat.com> | 2009-08-10 11:37:32 +0200 |
commit | d878dc8e1ad82bbdf5838ffab804d05c93e48352 (patch) | |
tree | 3fea93e71d37766d5edd042b9f4562906dd33180 /gtk | |
parent | ec7c24d227fc1a480dec1975f4dc6c383f941070 (diff) | |
download | gtk+-d878dc8e1ad82bbdf5838ffab804d05c93e48352.tar.gz |
Increment page sequence before print of the page, not after
When printing, increment page sequence before rendering of the page,
not after (#590084).
In opposite case it runs "end_page" function with wrong parameters when
drawing a page in another thread.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkprintoperation.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c index 93751ba5e0..e9b5bb8eca 100644 --- a/gtk/gtkprintoperation.c +++ b/gtk/gtkprintoperation.c @@ -2097,6 +2097,12 @@ increment_page_sequence (PrintPagesData *data) GtkPrintOperationPrivate *priv = data->op->priv; gint inc; + if (data->total == -1) + { + data->total = 0; + return; + } + /* check whether we reached last position */ if (priv->page_position == data->last_position && !(data->collated_copies > 1 && data->collated < (data->collated_copies - 1))) @@ -2230,7 +2236,7 @@ update_progress (PrintPagesData *data) text = g_strdup (_("Preparing")); } else if (priv->status == GTK_PRINT_STATUS_GENERATING_DATA) - text = g_strdup_printf (_("Printing %d"), data->total - 1); + text = g_strdup_printf (_("Printing %d"), data->total); if (text) { @@ -2660,7 +2666,7 @@ prepare_data (PrintPagesData *data) counter++; } - data->total = 0; + data->total = -1; data->collated = 0; data->uncollated = 0; @@ -2758,11 +2764,10 @@ print_pages_idle (gpointer user_data) goto out; } + increment_page_sequence (data); + if (!data->done) - { - common_render_page (data->op, data->page); - increment_page_sequence (data); - } + common_render_page (data->op, data->page); else done = priv->page_drawing_state == GTK_PAGE_DRAWING_STATE_READY; |