2 Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "lib/exceptions.h"
23 #include "dvd_title_dialog.h"
28 DVDTitleDialog::DVDTitleDialog ()
30 string const dvd = find_dvd ();
32 throw DVDError ("could not find DVD");
35 list<DVDTitle> t = dvd_titles (dvd);
37 throw DVDError ("no titles found on DVD");
40 set_title ("Choose DVD title");
41 get_vbox()->set_border_width (6);
42 get_vbox()->set_spacing (3);
44 Gtk::RadioButtonGroup g;
45 for (list<DVDTitle>::const_iterator i = t.begin(); i != t.end(); ++i) {
46 Gtk::RadioButton* b = manage (new Gtk::RadioButton);
48 #if HAVE_G_FORMAT_SIZE
49 s << "Title " << i->number << ": " << g_format_size (i->size);
51 s << "Title " << i->number << ": " << g_format_size_for_display (i->size);
53 b->set_label (s.str ());
54 if (i == t.begin ()) {
60 get_vbox()->pack_start (*b);
64 add_button ("Cancel", Gtk::RESPONSE_CANCEL);
65 add_button ("Copy Title", Gtk::RESPONSE_OK);
71 DVDTitleDialog::selected ()
73 std::map<DVDTitle, Gtk::RadioButton *>::const_iterator i = _buttons.begin ();
74 while (i != _buttons.end() && i->second->get_active() == false) {
78 assert (i != _buttons.end ());