Commit f429270ffcc1b76e5024dd2ea57d5c53be85534d
1 parent
b3926a49
Exists in
master
and in
5 other branches
Using the new standard error popup for print errors.
Showing
1 changed file
with
29 additions
and
18 deletions
Show diff stats
src/pw3270/print.c
... | ... | @@ -30,6 +30,7 @@ |
30 | 30 | #include "private.h" |
31 | 31 | #include <v3270.h> |
32 | 32 | #include <v3270/print.h> |
33 | + #include <v3270/dialogs.h> | |
33 | 34 | #include <lib3270/selection.h> |
34 | 35 | #include <lib3270/trace.h> |
35 | 36 | |
... | ... | @@ -38,22 +39,24 @@ |
38 | 39 | |
39 | 40 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
40 | 41 | |
42 | +/* | |
41 | 43 | static void show_print_error(GtkWidget *widget, GError *err) |
42 | 44 | { |
45 | + g_warning("Print operation has failed: %s",err->message); | |
46 | + | |
43 | 47 | GtkWidget *dialog = gtk_message_dialog_new_with_markup( GTK_WINDOW(gtk_widget_get_toplevel(widget)), |
44 | 48 | GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, |
45 | 49 | GTK_MESSAGE_ERROR,GTK_BUTTONS_CLOSE, |
46 | - "%s",_( "Print operation failed" )); | |
50 | + "%s",_( "Unable to complete print job" )); | |
47 | 51 | |
48 | - g_warning("%s",err->message); | |
49 | - | |
50 | - gtk_window_set_title(GTK_WINDOW(dialog),_("Error")); | |
52 | + gtk_window_set_title(GTK_WINDOW(dialog),_("Operation has failed")); | |
51 | 53 | |
52 | 54 | gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog),"%s",err->message); |
53 | 55 | |
54 | 56 | gtk_dialog_run(GTK_DIALOG(dialog)); |
55 | 57 | gtk_widget_destroy(dialog); |
56 | 58 | } |
59 | +*/ | |
57 | 60 | |
58 | 61 | /* |
59 | 62 | static void done(GtkPrintOperation *prt, GtkPrintOperationResult result, PRINT_INFO *info) |
... | ... | @@ -197,22 +200,14 @@ |
197 | 200 | |
198 | 201 | if(err) |
199 | 202 | { |
200 | - GtkWidget *popup = gtk_message_dialog_new_with_markup( | |
201 | - GTK_WINDOW(gtk_widget_get_toplevel(widget)), | |
202 | - GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, | |
203 | - GTK_MESSAGE_ERROR,GTK_BUTTONS_CLOSE, | |
204 | - _("Can't print") | |
203 | + v3270_error_popup( | |
204 | + widget, | |
205 | + _("Operation has failed"), | |
206 | + _( "Unable to complete print job" ), | |
207 | + err->message | |
205 | 208 | ); |
206 | 209 | |
207 | - gtk_window_set_title(GTK_WINDOW(popup),_("Operation has failed")); | |
208 | - | |
209 | - gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(popup),"%s",err->message); | |
210 | - | |
211 | - gtk_dialog_run(GTK_DIALOG(popup)); | |
212 | - gtk_widget_destroy(popup); | |
213 | - | |
214 | 210 | g_error_free(err); |
215 | - | |
216 | 211 | rc = -1; |
217 | 212 | } |
218 | 213 | else |
... | ... | @@ -220,7 +215,23 @@ |
220 | 215 | switch(result) |
221 | 216 | { |
222 | 217 | case GTK_PRINT_OPERATION_RESULT_ERROR: // An error has occurred. |
223 | - g_message("Print operation has failed"); | |
218 | + { | |
219 | + // Get error code | |
220 | + GError * err = NULL; | |
221 | + | |
222 | + gtk_print_operation_get_error(operation,&err); | |
223 | + | |
224 | + v3270_error_popup( | |
225 | + widget, | |
226 | + _("Operation has failed"), | |
227 | + _( "Unable to complete print job" ), | |
228 | + err->message | |
229 | + ); | |
230 | + | |
231 | + g_error_free(err); | |
232 | + rc = -1; | |
233 | + | |
234 | + } | |
224 | 235 | break; |
225 | 236 | |
226 | 237 | case GTK_PRINT_OPERATION_RESULT_APPLY: // The print settings should be stored. | ... | ... |