Don't invalidate AU preset on load
[ardour.git] / gtk2_ardour / interthread_progress_window.cc
index 96a9b810eb4c433f753e9c27c191f53d02661cb2..eb32d3e8faac27f6a144fcf7bf322090c3b033fe 100644 (file)
 
 #include <glibmm/main.h>
 #include <gtkmm/stock.h>
+#include "gtkmm2ext/utils.h"
 #include "ardour/import_status.h"
 #include "interthread_progress_window.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace Gtk;
@@ -34,6 +35,8 @@ InterthreadProgressWindow::InterthreadProgressWindow (ARDOUR::InterThreadInfo* i
        : ArdourDialog (t, true)
        , _interthread_info (i)
 {
+       _interthread_info->cancel = false;
+
        _bar.set_orientation (Gtk::PROGRESS_LEFT_TO_RIGHT);
 
        set_border_width (12);
@@ -49,11 +52,19 @@ InterthreadProgressWindow::InterthreadProgressWindow (ARDOUR::InterThreadInfo* i
 
        set_default_size (200, 100);
        show_all ();
-        hide ();
 
        Glib::signal_timeout().connect (sigc::mem_fun (*this, &InterthreadProgressWindow::update), 100);
 }
 
+void
+InterthreadProgressWindow::on_hide ()
+{
+       if (_interthread_info && !_interthread_info->done) {
+               //catch user pressing 'esc' or WM close
+               _interthread_info->cancel = true;
+       }
+}
+
 void
 InterthreadProgressWindow::cancel_clicked ()
 {
@@ -87,8 +98,7 @@ bool
 ImportProgressWindow::update ()
 {
        _cancel_button.set_sensitive (!_import_status->freeze);
-       std::string op = Glib::Markup::escape_text(_import_status->doing_what);
-       _label.set_markup ("<i>" + op + "</i>");
+       _label.set_markup ("<i>" + Gtkmm2ext::markup_escape_text (_import_status->doing_what) + "</i>");
 
        /* use overall progress for the bar, rather than that for individual files */
        _bar.set_fraction ((_import_status->current - 1 + _import_status->progress) / _import_status->total);