]> Pileus Git - ~andy/gtk/commitdiff
Get rid of GTK_PRINT_OPERATION_RESULT_PREVIEW.
authorMatthias Clasen <mclasen@redhat.com>
Thu, 8 Jun 2006 16:30:51 +0000 (16:30 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Thu, 8 Jun 2006 16:30:51 +0000 (16:30 +0000)
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.

ChangeLog
ChangeLog.pre-2-10
gtk/gtkprintoperation-unix.c
gtk/gtkprintoperation.c
gtk/gtkprintoperation.h

index ef2053d42ead00c9c11eb90d288ff3ee36d4a4c6..ea0a2fe172674759a2d11aa3d4fab66b02b4ffb1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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):
index ef2053d42ead00c9c11eb90d288ff3ee36d4a4c6..ea0a2fe172674759a2d11aa3d4fab66b02b4ffb1 100644 (file)
@@ -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):
index e87927a8066480c156722f26c99bed120fa62e88..e73964076aac6e2932dd96dbd64a40584438473e 100644 (file)
@@ -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);
 }
index b39ac1f94aa242ee19f76dddfea13ecb53e399d6..b42d3260a54c23d3b4be1bd91952f889aebe1831 100644 (file)
@@ -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)
index d524223cdf1b01132fc08ea23ff86ebf38736fe3..c5df55f018818c6f9b7777e749671e9ac8bb10d1 100644 (file)
@@ -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;