store all error/info/etc messages in a list inside Gtkmm2ext::UI, and provide a metho...
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 29 Jun 2015 20:27:03 +0000 (16:27 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 29 Jun 2015 20:27:03 +0000 (16:27 -0400)
libs/gtkmm2ext/gtk_ui.cc
libs/gtkmm2ext/gtkmm2ext/gtk_ui.h

index b5319fbea70f26ae606138d007540416d8777ec0..c4df2b7d5cf49f0d6d070b6a2f260240a49a6f07 100644 (file)
@@ -481,9 +481,41 @@ UI::do_request (UIRequest* req)
   Error Display
   ======================================================================*/
 
+void
+UI::dump_errors (std::ostream& ostr)
+{
+       Glib::Threads::Mutex::Lock lm (error_lock);
+       ostr << endl << X_("Errors/Messages:") << endl;
+       for (list<string>::const_iterator i = error_stack.begin(); i != error_stack.end(); ++i) {
+               ostr << *i << endl;
+       }
+       ostr << endl;
+}
+
 void
 UI::receive (Transmitter::Channel chn, const char *str)
 {
+       {
+               Glib::Threads::Mutex::Lock lm (error_lock);
+               switch (chn) {
+               case Transmitter::Fatal:
+                       error_stack.push_back (string (X_("FATAL: ")) + str);
+                       break;
+               case Transmitter::Error:
+                       error_stack.push_back (string (X_("ERROR: ")) + str);
+                       break;
+               case Transmitter::Warning:
+                       error_stack.push_back (string (X_("WARNING: ")) + str);
+                       break;
+               case Transmitter::Info:
+                       error_stack.push_back (string (X_("INFO: ")) + str);
+                       break;
+               case Transmitter::Throw:
+                       error_stack.push_back (string (X_("THROW: ")) + str);
+                       break;
+               }
+       }
+
        if (caller_is_ui_thread()) {
                process_error_message (chn, str);
        } else {
index 0a66accaefe7d547501a0736cb583a23cfb3e81b..177adb00ffdf432f3ac7cbd8e73c9af7c8f17147 100644 (file)
@@ -138,6 +138,7 @@ class LIBGTKMM2EXT_API UI : public AbstractUI<UIRequest>
        void flush_pending ();
        void toggle_errors ();
        void show_errors ();
+       void dump_errors (std::ostream&);
        void touch_display (Touchable *);
        void set_tip (Gtk::Widget &w, const gchar *tip);
        void set_tip (Gtk::Widget &w, const std::string &tip);
@@ -166,7 +167,7 @@ class LIBGTKMM2EXT_API UI : public AbstractUI<UIRequest>
        sigc::signal<void> theme_changed;
 
        static bool just_hide_it (GdkEventAny *, Gtk::Window *);
-
+       
   protected:
        virtual void handle_fatal (const char *);
        virtual void display_message (const char *prefix, gint prefix_len,
@@ -195,6 +196,9 @@ class LIBGTKMM2EXT_API UI : public AbstractUI<UIRequest>
        void process_error_message (Transmitter::Channel, const char *);
        void do_quit ();
 
+       Glib::Threads::Mutex   error_lock;
+       std::list<std::string> error_stack;
+
        void color_selection_done (bool status);
        bool color_selection_deleted (GdkEventAny *);
        bool color_picked;