diff options
author | Carl Hetherington <carl@carlh.net> | 2010-12-14 02:45:41 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-12-14 02:45:41 +0000 |
commit | eb5870781a5173b1cbfc2dd4e975be29e5d00a99 (patch) | |
tree | f0d68992e35c6ff7c93c12f176b6695d85d1233d /gtk2_ardour/ambiguous_file_dialog.cc | |
parent | 1238f09478e8def7f4e2bc8df9951ed78ca3ccd1 (diff) |
Add dialogue to ask user about ambiguous source files. Fixes #3603.
git-svn-id: svn://localhost/ardour2/branches/3.0@8265 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/ambiguous_file_dialog.cc')
-rw-r--r-- | gtk2_ardour/ambiguous_file_dialog.cc | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/gtk2_ardour/ambiguous_file_dialog.cc b/gtk2_ardour/ambiguous_file_dialog.cc new file mode 100644 index 0000000000..e14d33540e --- /dev/null +++ b/gtk2_ardour/ambiguous_file_dialog.cc @@ -0,0 +1,63 @@ +/* + Copyright (C) 2010 Paul Davis + Author: Carl Hetherington <cth@carlh.net> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <gtkmm/label.h> +#include "ambiguous_file_dialog.h" + +using namespace std; +using namespace ARDOUR; +using namespace Gtk; + +AmbiguousFileDialog::AmbiguousFileDialog (const string& file, const vector<string>& paths) + : ArdourDialog (_("Ambiguous File"), true, false) +{ + get_vbox()->set_spacing (6); + + Label* l = manage (new Label); + l->set_markup (string_compose (_("Ardour has found the file <i>%1</i> in the following places:\n\n"), file)); + get_vbox()->pack_start (*l); + + for (vector<string>::const_iterator i = paths.begin(); i != paths.end(); ++i) { + _radio_buttons.push_back (manage (new RadioButton (_group, *i))); + get_vbox()->pack_start (*_radio_buttons.back ()); + } + + get_vbox()->pack_start (*manage (new Label (_("\n\nPlease select the path that you want to get the file from.")))); + + add_button (_("Done"), RESPONSE_OK); + + show_all (); +} + +int +AmbiguousFileDialog::get_which () const +{ + int i = 0; + vector<RadioButton*>::const_iterator j = _radio_buttons.begin (); + while (j != _radio_buttons.end() && !(*j)->get_active ()) { + ++i; + ++j; + } + + if (j == _radio_buttons.end()) { + return 0; + } + + return i; +} |