diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-15 19:52:31 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-15 19:52:31 +0100 |
commit | 51e123544bff3ca0bdd8f6ba6a1c507b57071ca4 (patch) | |
tree | 0b3c68e7520dc310a49cee0b6dc1abd042143224 /interface-gtk.cpp | |
parent | 5fe8298dec3736a2169719af9f0edf8592f3f7b6 (diff) | |
download | sciteco-51e123544bff3ca0bdd8f6ba6a1c507b57071ca4.tar.gz |
support stdio for curses interface
* ./sciteco commandline help works now
* messages issued during batch-mode macro processing are written to stdout/stderr
* output can be redirected
Diffstat (limited to 'interface-gtk.cpp')
-rw-r--r-- | interface-gtk.cpp | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/interface-gtk.cpp b/interface-gtk.cpp index d049045..38100fe 100644 --- a/interface-gtk.cpp +++ b/interface-gtk.cpp @@ -73,7 +73,7 @@ InterfaceGtk::InterfaceGtk() } void -InterfaceGtk::msg(MessageType type, const gchar *fmt, ...) +InterfaceGtk::vmsg(MessageType type, const gchar *fmt, va_list ap) { static const GtkMessageType type2gtk[] = { /* [MSG_USER] = */ GTK_MESSAGE_OTHER, @@ -82,27 +82,13 @@ InterfaceGtk::msg(MessageType type, const gchar *fmt, ...) /* [MSG_ERROR] = */ GTK_MESSAGE_ERROR }; - va_list ap; + va_list aq; gchar buf[255]; - va_start(ap, fmt); - g_vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - - switch (type) { - case MSG_USER: - g_printf("%s\n", buf); - break; - case MSG_INFO: - g_printf("Info: %s\n", buf); - break; - case MSG_WARNING: - g_fprintf(stderr, "Warning: %s\n", buf); - break; - case MSG_ERROR: - g_fprintf(stderr, "Error: %s\n", buf); - break; - } + va_copy(aq, ap); + stdio_vmsg(type, fmt, ap); + g_vsnprintf(buf, sizeof(buf), fmt, aq); + va_end(aq); gtk_info_bar_set_message_type(GTK_INFO_BAR(info_widget), type2gtk[type]); |