diff options
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | gtk/gtkprintoperation.c | 13 | ||||
-rw-r--r-- | tests/print-editor.c | 12 |
3 files changed, 31 insertions, 9 deletions
@@ -1,5 +1,20 @@ 2007-04-29 Matthias Clasen <mclasen@redhat.com> + Make the emission of ::end-print and ::done consistent + for previews. (#347567, Yevgen Muntyan) + + * gtk/gtkprintoperation.c (preview_iface_end_preview): Set + the finished status here. + (preview_end_run): ...and not here. + (print_pages_idle_done): Emit ::done for a cancelled preview. + (print_pages_idle): If a preview has been cancelled, don't + emit ::ready, but emit ::end-print. + + tests/print-editor.c: Use ::end-print to undo allocations + from ::begin-print. + +2007-04-29 Matthias Clasen <mclasen@redhat.com> + * gtk/gtkpapersize.c (gtk_paper_size_new): Mark paper sizes in the PWG "custom" namespace as custom. Add a link to the spec in the docs. (#426416, Andreas Guelzow) diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c index 77362b4302..ff6a879ca3 100644 --- a/gtk/gtkprintoperation.c +++ b/gtk/gtkprintoperation.c @@ -190,8 +190,9 @@ preview_iface_end_preview (GtkPrintOperationPreview *preview) if (op->priv->end_run) op->priv->end_run (op, op->priv->is_sync, TRUE); - g_signal_emit (op, signals[DONE], 0, - GTK_PRINT_OPERATION_RESULT_APPLY); + _gtk_print_operation_set_status (op, GTK_PRINT_STATUS_FINISHED, NULL); + + g_signal_emit (op, signals[DONE], 0, GTK_PRINT_OPERATION_RESULT_APPLY); } static gboolean @@ -252,8 +253,6 @@ preview_end_run (GtkPrintOperation *op, { g_free (op->priv->page_ranges); op->priv->page_ranges = NULL; - - _gtk_print_operation_set_status (op, GTK_PRINT_STATUS_FINISHED, NULL); } @@ -1929,7 +1928,7 @@ print_pages_idle_done (gpointer user_data) if (priv->rloop && !data->is_preview) g_main_loop_quit (priv->rloop); - if (!data->is_preview) + if (!data->is_preview || priv->cancelled) g_signal_emit (data->op, signals[DONE], 0, priv->cancelled ? GTK_PRINT_OPERATION_RESULT_CANCEL : @@ -2126,7 +2125,7 @@ print_pages_idle (gpointer user_data) } } - if (data->is_preview) + if (data->is_preview && !priv->cancelled) { done = TRUE; @@ -2147,7 +2146,7 @@ print_pages_idle (gpointer user_data) done = TRUE; } - if (done && !data->is_preview) + if (done && (!data->is_preview || priv->cancelled)) { g_signal_emit (data->op, signals[END_PRINT], 0, priv->print_context); priv->end_run (data->op, priv->is_sync, priv->cancelled); diff --git a/tests/print-editor.c b/tests/print-editor.c index 3999acf065..8e11e4bbb7 100644 --- a/tests/print-editor.c +++ b/tests/print-editor.c @@ -634,8 +634,6 @@ print_done (GtkPrintOperation *op, g_free (print_data->text); g_free (print_data->font); - g_list_free (print_data->page_breaks); - g_object_unref (print_data->layout); g_free (print_data); if (!gtk_print_operation_is_finished (op)) @@ -651,6 +649,15 @@ print_done (GtkPrintOperation *op, } static void +end_print (GtkPrintOperation *op, GtkPrintContext *context, PrintData *print_data) +{ + g_list_free (print_data->page_breaks); + print_data->page_breaks = NULL; + g_object_unref (print_data->layout); + print_data->layout = NULL; +} + +static void do_print_or_preview (GtkAction *action, GtkPrintOperationAction print_action) { GtkPrintOperation *print; @@ -672,6 +679,7 @@ do_print_or_preview (GtkAction *action, GtkPrintOperationAction print_action) gtk_print_operation_set_default_page_setup (print, page_setup); g_signal_connect (print, "begin_print", G_CALLBACK (begin_print), print_data); + g_signal_connect (print, "end-print", G_CALLBACK (end_print), print_data); g_signal_connect (print, "draw_page", G_CALLBACK (draw_page), print_data); g_signal_connect (print, "create_custom_widget", G_CALLBACK (create_custom_widget), print_data); g_signal_connect (print, "custom_widget_apply", G_CALLBACK (custom_widget_apply), print_data); |