#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 "pbd/i18n.h"
using namespace Gtk;
using namespace std;
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 (FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ , chooser (_("Select a folder to search"), FILE_CHOOSER_ACTION_SELECT_FOLDER)
, use_chosen (_("Add chosen folder to search path, and try again"))
, choice_group (use_chosen.get_group())
- , use_chosen_and_no_more_questions (choice_group, _("Add chosen folder to search path, try again but don't ask me again"), false)
, stop_loading_button (choice_group, _("Stop loading this session"), false)
- , all_missing_ok (choice_group, _("This and all other missing files are OK"), false)
- , this_missing_ok (choice_group, _("This missing file is OK"), false)
+ , 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);
string typestr;
switch (type) {
case DataType::AUDIO:
- typestr = _("An audio");
+ typestr = _("audio");
break;
case DataType::MIDI:
- typestr = _("A MIDI");
+ typestr = _("MIDI");
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_markup (string_compose (_("%1 file (\"%2\") cannot be found.\n\n\
-Currently, Ardour has searched in the following folders for this file:\n\n\
-<tt>%3</tt>\n\n\
-The following options are available:"), typestr, path, dirstr));
+ 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, Gtkmm2ext::markup_escape_text (path), Gtkmm2ext::markup_escape_text (oss.str())));
+
+ HBox* hbox = manage (new HBox);
+ hbox->pack_start (msg, false, true);
+ hbox->show ();
+
+ get_vbox()->pack_start (*hbox, false, false);
VBox* button_packer_box = manage (new VBox);
button_packer_box->set_border_width (12);
button_packer_box->pack_start (use_chosen, false, false);
- button_packer_box->pack_start (use_chosen_and_no_more_questions, false, false);
button_packer_box->pack_start (this_missing_ok, false, false);
button_packer_box->pack_start (all_missing_ok, false, false);
button_packer_box->pack_start (stop_loading_button, false, false);
button_packer_box->show_all ();
-
+
get_vbox()->set_spacing (6);
- get_vbox()->set_border_width (12);
+ get_vbox()->set_border_width (25);
get_vbox()->set_homogeneous (false);
- get_vbox()->pack_start (msg, false, false);
- HBox* hbox = manage (new HBox);
+ hbox = manage (new HBox);
hbox->pack_start (*button_packer_box, false, true);
hbox->show ();
get_vbox()->pack_start (*hbox, false, false);
- get_vbox()->pack_start (chooser, true, true);
+
+ hbox = manage (new HBox);
+ Label* label = manage (new Label);
+ label->set_text (_("Click to choose an additional folder"));
+
+ hbox->set_spacing (6);
+ hbox->set_border_width (12);
+ hbox->pack_start (*label, false, false);
+ hbox->pack_start (chooser, true, true);
+ hbox->show_all ();
+
+ get_vbox()->pack_start (*hbox, true, true);
msg.show ();
- chooser.set_size_request (-1, 300);
- chooser.show ();
+
chooser.set_current_folder (Glib::get_home_dir());
chooser.set_create_folders (false);
}
break;
}
- split (str, dirs, ':');
+ split (str, dirs, G_SEARCHPATH_SEPARATOR);
newdir = chooser.get_filename ();
}
if (!str.empty()) {
- str += ':';
- }
-
+ str += G_SEARCHPATH_SEPARATOR;
+ }
+
str += newdir;
switch (filetype) {
int
MissingFileDialog::get_action ()
{
-
if (use_chosen.get_active ()) {
add_chosen ();
return 0;
}
- if (use_chosen_and_no_more_questions.get_active()) {
- add_chosen ();
- return 2;
- }
-
if (this_missing_ok.get_active()) {
return -1;
}