1 /* This file is part of Cinaest.
3 * Copyright (C) 2009 Philipp Zabel
5 * Cinaest is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * Cinaest is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with Cinaest. If not, see <http://www.gnu.org/licenses/>.
22 class SourceDialog : Gtk.Dialog {
23 List<MovieSource> sources;
24 List<Gtk.Button> buttons;
26 public SourceDialog (Gtk.Window window) {
27 set_transient_for (window);
28 set_title (_("Select movie source"));
31 if (CinaestProgram.plugins.length () > 5) {
32 vbox = new VBox (true, 0);
34 var pannable = new PannableArea ();
35 pannable.add_with_viewport (vbox);
37 VBox area = (VBox) get_content_area ();
38 area.pack_start (pannable, true, true, 0);
39 area.set_size_request (-1, 5*70);
41 vbox = (VBox) get_content_area ();
44 sources = new List<MovieSource> ();
45 buttons = new List<Hildon.Button> ();
46 foreach (Plugin plugin in CinaestProgram.plugins) {
47 foreach (MovieSource source in plugin.get_sources ()) {
48 var button = new Hildon.Button.with_text (SizeType.FINGER_HEIGHT, ButtonArrangement.VERTICAL, source.get_name (), source.get_description ());
49 button.set_alignment(0, (float) 0.5, 0, 0);
50 vbox.pack_start (button, true, true, 0);
52 button.clicked.connect (on_source_select);
54 buttons.append (button);
55 sources.append (source);
60 public void on_source_select (Gtk.Button button) {
61 int n = buttons.index (button);
66 public new int run (ref MovieSource source) {
75 source = sources.nth_data (res);