2010-12-13 21:45:41 -05:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2010-2011 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2013-2016 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2010-12-13 21:45:41 -05:00
|
|
|
|
|
|
|
#include <gtkmm/label.h>
|
2011-04-22 23:34:42 -04:00
|
|
|
#include "pbd/compose.h"
|
2010-12-13 21:45:41 -05:00
|
|
|
#include "ambiguous_file_dialog.h"
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2010-12-13 21:45:41 -05:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace Gtk;
|
|
|
|
|
|
|
|
AmbiguousFileDialog::AmbiguousFileDialog (const string& file, const vector<string>& paths)
|
|
|
|
: ArdourDialog (_("Ambiguous File"), true, false)
|
|
|
|
{
|
Fix typos in gtk2_ardour/ directory
Found via `codespell -q 3 -S *.po,./share/patchfiles,./libs -L ba,buss,busses,doubleclick,hsi,ontop,ro,seh,siz,sur,te,trough,ue`
2022-01-26 12:35:38 -05:00
|
|
|
/* This dialog is always shown programmatically. Center the window.*/
|
2015-10-22 11:14:03 -04:00
|
|
|
set_position (Gtk::WIN_POS_CENTER);
|
2010-12-13 21:45:41 -05:00
|
|
|
|
2015-10-22 11:14:03 -04:00
|
|
|
get_vbox()->set_spacing (6);
|
2010-12-13 21:45:41 -05:00
|
|
|
Label* l = manage (new Label);
|
2013-02-05 13:18:35 -05:00
|
|
|
l->set_markup (string_compose (_("%1 has found the file <i>%2</i> in the following places:\n\n"), PROGRAM_NAME, file));
|
2010-12-13 21:45:41 -05:00
|
|
|
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 ());
|
2013-03-30 10:04:50 -04:00
|
|
|
_radio_buttons.back()->signal_button_press_event().connect (sigc::mem_fun (*this, &AmbiguousFileDialog::rb_button_press), false);
|
2010-12-13 21:45:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
get_vbox()->pack_start (*manage (new Label (_("\n\nPlease select the path that you want to get the file from."))));
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-12-13 21:45:41 -05:00
|
|
|
add_button (_("Done"), RESPONSE_OK);
|
2011-11-07 17:41:15 -05:00
|
|
|
set_default_response (RESPONSE_OK);
|
2010-12-13 21:45:41 -05:00
|
|
|
|
|
|
|
show_all ();
|
|
|
|
}
|
|
|
|
|
2013-03-30 10:04:50 -04:00
|
|
|
bool
|
|
|
|
AmbiguousFileDialog::rb_button_press (GdkEventButton* ev)
|
|
|
|
{
|
|
|
|
if (ev->type == GDK_2BUTTON_PRESS) {
|
|
|
|
response (RESPONSE_OK);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-12-13 21:45:41 -05:00
|
|
|
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;
|
|
|
|
}
|