diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-07-06 10:55:34 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-07-06 10:55:34 +0200 |
commit | 4bb1cfb8a38250713210e1fde2e4d944e76e4712 (patch) | |
tree | 2de737316d8d4b6dac223c3332c9a489eed46726 /src | |
parent | 88f5f0e13db107989e8204bbc41161eab775b4d4 (diff) |
add print command dialog
Diffstat (limited to 'src')
-rw-r--r-- | src/flpsed.cxx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/flpsed.cxx b/src/flpsed.cxx index ce2f3e6..850d270 100644 --- a/src/flpsed.cxx +++ b/src/flpsed.cxx @@ -217,11 +217,19 @@ void print_cb() { char tmpname[256]; char buf[256]; int tmp_fd; + char *prefCommand; + const char *printCommand; + Fl_Preferences prefs(Fl_Preferences::USER, + "Johannes.HofmannATgmx.de", "flpsed"); - int r = fl_choice("Print file?", "Cancel", "Print", NULL); - if (r != 1) { + prefs.get("printCommand", prefCommand, "lpr"); + + printCommand = fl_input("Print Command", prefCommand); + if (!printCommand || printCommand[0] == '\0') return; - } + + if (strcmp(printCommand, prefCommand)) + prefs.set("printCommand", printCommand); strncpy(tmpname, "/tmp/PSEditWidgetXXXXXX", 256); tmp_fd = mkstemp(tmpname); @@ -231,7 +239,7 @@ void print_cb() { if (psed_p->save(tmpname) != 0) { fprintf(stderr, "Failed to print file\n"); } else { - snprintf(buf, 256, "lpr %s", tmpname); + snprintf(buf, 256, "%s %s", printCommand, tmpname); system(buf); } unlink(tmpname); |