summaryrefslogtreecommitdiff
path: root/gtk/gtkprintoperation-unix.c
diff options
context:
space:
mode:
authorMarek Kasik <mkasik@redhat.com>2010-06-07 14:52:38 +0200
committerMarek Kasik <mkasik@redhat.com>2010-06-07 14:52:38 +0200
commitca6aacc32d8141c0d6ebbf8c1ed6152764232bae (patch)
tree61014921fed2f1221a9d8a1a3609b38c18739ce0 /gtk/gtkprintoperation-unix.c
parent42deb581f936ee847cc54ddd936902934d889e7a (diff)
downloadgtk+-ca6aacc32d8141c0d6ebbf8c1ed6152764232bae.tar.gz
Return error instead of showing an error dialog when printing
Remove message dialogs showing an error when printing. Return GTK_PRINT_OPERATION_RESULT_ERROR and set error in such a case. Also return GTK_PRINT_OPERATION_RESULT_CANCEL when cancelled. Do it for synchronous and asynchronous cases (#549127).
Diffstat (limited to 'gtk/gtkprintoperation-unix.c')
-rw-r--r--gtk/gtkprintoperation-unix.c42
1 files changed, 9 insertions, 33 deletions
diff --git a/gtk/gtkprintoperation-unix.c b/gtk/gtkprintoperation-unix.c
index dbf622846f..896871ab22 100644
--- a/gtk/gtkprintoperation-unix.c
+++ b/gtk/gtkprintoperation-unix.c
@@ -306,20 +306,10 @@ _gtk_print_operation_platform_backend_launch_preview (GtkPrintOperation *op,
out:
if (error != NULL)
{
- GtkWidget *edialog;
- edialog = gtk_message_dialog_new (parent,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("Error launching preview") /* FIXME better text */);
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (edialog),
- "%s", error->message);
- g_signal_connect (edialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
-
- gtk_window_present (GTK_WINDOW (edialog));
-
- g_error_free (error);
+ if (op->priv->error == NULL)
+ op->priv->error = error;
+ else
+ g_error_free (error);
filename_used = FALSE;
settings_used = FALSE;
@@ -341,29 +331,15 @@ _gtk_print_operation_platform_backend_launch_preview (GtkPrintOperation *op,
}
static void
-unix_finish_send (GtkPrintJob *job,
- gpointer user_data,
- GError *error)
+unix_finish_send (GtkPrintJob *job,
+ gpointer user_data,
+ const GError *error)
{
GtkPrintOperation *op = (GtkPrintOperation *) user_data;
GtkPrintOperationUnix *op_unix = op->priv->platform_data;
- if (error != NULL)
- {
- GtkWidget *edialog;
- edialog = gtk_message_dialog_new (op_unix->parent,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("Error printing") /* FIXME better text */);
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (edialog),
- "%s", error->message);
- gtk_window_set_modal (GTK_WINDOW (edialog), TRUE);
- g_signal_connect (edialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
-
- gtk_window_present (GTK_WINDOW (edialog));
- }
+ if (error != NULL && op->priv->error == NULL)
+ op->priv->error = g_error_copy (error);
op_unix->data_sent = TRUE;