From 999867b7109f584f2fcb5fb043d4e7e5bc9bd725 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 27 Jul 2004 20:10:02 +0000 Subject: Move the code to open the printer/print file from "print_packets()" to "print_ok_cb()", and have "print_packets()" just work on a "print_stream_t" handed to it, so that different platforms can open the printer/print file in different ways (opening the file is probably not going to be platform-dependent, but opening the printer will be). svn path=/trunk/; revision=11544 --- gtk/print_dlg.c | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'gtk/print_dlg.c') diff --git a/gtk/print_dlg.c b/gtk/print_dlg.c index bd111dc078..aa8531c7de 100644 --- a/gtk/print_dlg.c +++ b/gtk/print_dlg.c @@ -826,8 +826,47 @@ print_ok_cb(GtkWidget *ok_bt, gpointer parent_w) status = write_pdml_packets(&cfile, args); else if (export_as_psml) status = write_psml_packets(&cfile, args); - else + else { + switch (args->format) { + + case PR_FMT_TEXT: + if (args->to_file) { + args->stream = print_stream_text_new(TRUE, args->file); + if (args->stream == NULL) { + open_failure_alert_box(args->file, errno, TRUE); + return; + } + } else { + args->stream = print_stream_text_new(FALSE, args->cmd); + if (args->stream == NULL) { + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, + "Couldn't run print command %s.", args->cmd); + } + } + break; + + case PR_FMT_PS: + if (args->to_file) { + args->stream = print_stream_ps_new(TRUE, args->file); + if (args->stream == NULL) { + open_failure_alert_box(args->file, errno, TRUE); + return; + } + } else { + args->stream = print_stream_ps_new(FALSE, args->cmd); + if (args->stream == NULL) { + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, + "Couldn't run print command %s.", args->cmd); + } + } + break; + + default: + g_assert_not_reached(); + return; + } status = print_packets(&cfile, args); + } switch (status) { case PP_OK: -- cgit v1.2.3