Do not try to restore Route solo state after clearing all solo state
[ardour.git] / gtk2_ardour / missing_file_dialog.cc
index 54b20b547b88f41a1be6044a41ffbf737a2bee50..47e694841286f66f4702691d769d38d66e8ade16 100644 (file)
 #include "pbd/compose.h"
 #include "pbd/replace_all.h"
 #include "pbd/strsplit.h"
+#include "pbd/search_path.h"
 
 #include "ardour/session.h"
+#include "gtkmm2ext/utils.h"
 
 #include "missing_file_dialog.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace Gtk;
 using namespace std;
@@ -31,7 +33,7 @@ using namespace ARDOUR;
 using namespace PBD;
 
 MissingFileDialog::MissingFileDialog (Session* s, const std::string& path, DataType type)
-        : ArdourDialog (_("Missing File!"), true, false)
+        : ArdourDialog (_("Missing File"), true, false)
         , filetype (type)
         , chooser (_("Select a folder to search"), FILE_CHOOSER_ACTION_SELECT_FOLDER)
         , use_chosen (_("Add chosen folder to search path, and try again"))
@@ -40,7 +42,10 @@ MissingFileDialog::MissingFileDialog (Session* s, const std::string& path, DataT
         , all_missing_ok (choice_group, _("Skip all missing files"), false)
         , this_missing_ok (choice_group, _("Skip this file"), false)
 {
-        set_session (s);
+       /* This dialog is always shown programatically. Center the window.*/
+       set_position (Gtk::WIN_POS_CENTER);
+
+       set_session (s);
 
         add_button (_("Done"), RESPONSE_OK);
         set_default_response (RESPONSE_OK);
@@ -56,14 +61,18 @@ MissingFileDialog::MissingFileDialog (Session* s, const std::string& path, DataT
                 break;
         }
 
-        string dirstr;
+       vector<string> source_dirs = s->source_search_path (type);
+       vector<string>::iterator i = source_dirs.begin();
+       ostringstream oss;
+       oss << *i << endl;
 
-        dirstr = s->source_search_path (type);
-        replace_all (dirstr, ":", "\n");
+       while (++i != source_dirs.end()) {
+               oss << *i << endl;
+       }
 
-        msg.set_justify (JUSTIFY_CENTER);
+        msg.set_justify (JUSTIFY_LEFT);
         msg.set_markup (string_compose (_("%1 cannot find the %2 file\n\n<i>%3</i>\n\nin any of these folders:\n\n\
-<tt>%4</tt>\n\n"), PROGRAM_NAME, typestr, path, dirstr));
+<tt>%4</tt>\n\n"), PROGRAM_NAME, typestr, Gtkmm2ext::markup_escape_text (path), Gtkmm2ext::markup_escape_text (oss.str())));
 
         HBox* hbox = manage (new HBox);
         hbox->pack_start (msg, false, true);
@@ -128,7 +137,7 @@ MissingFileDialog::add_chosen ()
                 break;
         }
 
-        split (str, dirs, ':');
+        split (str, dirs, G_SEARCHPATH_SEPARATOR);
 
         newdir = chooser.get_filename ();
 
@@ -139,7 +148,7 @@ MissingFileDialog::add_chosen ()
         }
 
         if (!str.empty()) {
-                str += ':';
+                str += G_SEARCHPATH_SEPARATOR;
         }
 
         str += newdir;