Commit 49e88d89 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Get rid of GTK_PRINT_OPERATION_RESULT_PREVIEW.

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.
parent 52a7a65c
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):
......
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):
......
......@@ -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);
}
......
......@@ -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)
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment