diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-07-27 20:10:02 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-07-27 20:10:02 +0000 |
commit | 999867b7109f584f2fcb5fb043d4e7e5bc9bd725 (patch) | |
tree | e6b6bdbf14c68a335daab799ef0b60ae657ff00d /gtk/print_dlg.c | |
parent | d03b6c614a7a9c1b341efd5a2091410a9e7e1651 (diff) |
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
Diffstat (limited to 'gtk/print_dlg.c')
-rw-r--r-- | gtk/print_dlg.c | 41 |
1 files changed, 40 insertions, 1 deletions
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: |