diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 8 | ||||
-rw-r--r-- | gtk/gtkprintoperation-unix.c | 24 | ||||
-rw-r--r-- | gtk/gtkprintoperation.c | 13 | ||||
-rw-r--r-- | gtk/gtkprintoperation.h | 1 |
5 files changed, 33 insertions, 21 deletions
@@ -1,3 +1,11 @@ +2006-06-08 Matthias Clasen <mclasen@redhat.com> + + * gtk/gtkprintoperation.h (GtkPrintOperationResult): Get + rid of GTK_PRINT_OPERATION_RESULT_PREVIEW. + + * gtk/gtkprintoperation-unix.c: + * gtk/gtkprintoperation.c: Update all users. + 2006-06-08 Tor Lillqvist <tml@novell.com> * gdk/win32/gdkevents-win32.c (gdk_event_translate): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index ef2053d42e..ea0a2fe172 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +2006-06-08 Matthias Clasen <mclasen@redhat.com> + + * gtk/gtkprintoperation.h (GtkPrintOperationResult): Get + rid of GTK_PRINT_OPERATION_RESULT_PREVIEW. + + * gtk/gtkprintoperation-unix.c: + * gtk/gtkprintoperation.c: Update all users. + 2006-06-08 Tor Lillqvist <tml@novell.com> * gdk/win32/gdkevents-win32.c (gdk_event_translate): diff --git a/gtk/gtkprintoperation-unix.c b/gtk/gtkprintoperation-unix.c index e87927a806..e73964076a 100644 --- a/gtk/gtkprintoperation-unix.c +++ b/gtk/gtkprintoperation-unix.c @@ -50,7 +50,7 @@ typedef struct GMainLoop *loop; gboolean data_sent; - /* Real printing (not preview: */ + /* Real printing (not preview) */ GtkPrintJob *job; /* the job we are sending to the printer */ cairo_surface_t *surface; gulong job_status_changed_tag; @@ -353,6 +353,7 @@ typedef struct { GtkPrintOperation *op; gboolean do_print; + gboolean do_preview; GtkPrintOperationResult result; GtkPrintOperationPrintFunc print_cb; GDestroyNotify destroy; @@ -378,9 +379,6 @@ finish_print (PrintResponseData *rdata, GtkPrintOperation *op = rdata->op; GtkPrintOperationPrivate *priv = op->priv; GtkPrintJob *job; - gboolean is_preview; - - is_preview = rdata->result == GTK_PRINT_OPERATION_RESULT_PREVIEW; if (rdata->do_print) { @@ -388,7 +386,7 @@ finish_print (PrintResponseData *rdata, priv->print_context = _gtk_print_context_new (op); _gtk_print_context_set_page_setup (priv->print_context, page_setup); - if (!is_preview) + if (!rdata->do_preview) { GtkPrintOperationUnix *op_unix; cairo_t *cr; @@ -457,16 +455,18 @@ handle_print_response (GtkWidget *dialog, if (response == GTK_RESPONSE_OK) { - rdata->result = GTK_PRINT_OPERATION_RESULT_APPLY; - printer = gtk_print_unix_dialog_get_selected_printer (GTK_PRINT_UNIX_DIALOG (pd)); + + rdata->result = GTK_PRINT_OPERATION_RESULT_APPLY; + rdata->do_preview = FALSE; if (printer != NULL) rdata->do_print = TRUE; } else if (response == GTK_RESPONSE_APPLY) { /* print preview */ - rdata->result = GTK_PRINT_OPERATION_RESULT_PREVIEW; + rdata->result = GTK_PRINT_OPERATION_RESULT_APPLY; + rdata->do_preview = TRUE; rdata->do_print = TRUE; } @@ -601,15 +601,15 @@ _gtk_print_operation_platform_backend_create_preview_surface (GtkPrintOperation void _gtk_print_operation_platform_backend_preview_start_page (GtkPrintOperation *op, - cairo_surface_t *surface, - cairo_t *cr) + cairo_surface_t *surface, + cairo_t *cr) { } void _gtk_print_operation_platform_backend_preview_end_page (GtkPrintOperation *op, - cairo_surface_t *surface, - cairo_t *cr) + cairo_surface_t *surface, + cairo_t *cr) { cairo_show_page (cr); } diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c index b39ac1f94a..b42d3260a5 100644 --- a/gtk/gtkprintoperation.c +++ b/gtk/gtkprintoperation.c @@ -418,8 +418,7 @@ preview_print_idle (gpointer data) gtk_print_operation_preview_render_page (pop->preview, pop->page_nr); cr = gtk_print_context_get_cairo_context (pop->print_context); - _gtk_print_operation_platform_backend_preview_end_page (op, pop->surface, - cr); + _gtk_print_operation_platform_backend_preview_end_page (op, pop->surface, cr); /* TODO: print out sheets not pages and follow ranges */ pop->page_nr++; @@ -443,8 +442,7 @@ preview_got_page_size (GtkPrintOperationPreview *preview, _gtk_print_operation_platform_backend_resize_preview_surface (op, page_setup, pop->surface); cr = gtk_print_context_get_cairo_context (pop->print_context); - _gtk_print_operation_platform_backend_preview_start_page (op, pop->surface, - cr); + _gtk_print_operation_platform_backend_preview_start_page (op, pop->surface, cr); } @@ -2194,7 +2192,7 @@ print_pages (GtkPrintOperation *op, data = g_new0 (PrintPagesData, 1); data->op = g_object_ref (op); - data->is_preview = (result == GTK_PRINT_OPERATION_RESULT_PREVIEW); + data->is_preview = (op->priv->action == GTK_PRINT_OPERATION_ACTION_PREVIEW); if (priv->show_progress) { @@ -2386,14 +2384,13 @@ gtk_print_operation_run (GtkPrintOperation *op, } else if (action == GTK_PRINT_OPERATION_ACTION_PREVIEW) { + priv->is_sync = !priv->allow_async; priv->print_context = _gtk_print_context_new (op); page_setup = create_page_setup (op); _gtk_print_context_set_page_setup (priv->print_context, page_setup); g_object_unref (page_setup); do_print = TRUE; - result = GTK_PRINT_OPERATION_RESULT_PREVIEW; - - priv->is_sync = !priv->allow_async; + result = priv->is_sync ? GTK_PRINT_OPERATION_RESULT_APPLY : GTK_PRINT_OPERATION_RESULT_IN_PROGRESS; } #ifndef G_OS_WIN32 else if (priv->allow_async) diff --git a/gtk/gtkprintoperation.h b/gtk/gtkprintoperation.h index d524223cdf..c5df55f018 100644 --- a/gtk/gtkprintoperation.h +++ b/gtk/gtkprintoperation.h @@ -60,7 +60,6 @@ typedef enum { GTK_PRINT_OPERATION_RESULT_ERROR, GTK_PRINT_OPERATION_RESULT_APPLY, GTK_PRINT_OPERATION_RESULT_CANCEL, - GTK_PRINT_OPERATION_RESULT_PREVIEW, GTK_PRINT_OPERATION_RESULT_IN_PROGRESS } GtkPrintOperationResult; |