class SourceDialog : Gtk.Dialog {
List<MovieSource> sources;
- List<Gtk.Button> buttons;
public SourceDialog (Gtk.Window window) {
set_transient_for (window);
set_title (_("Select movie source"));
- VBox vbox;
- if (CinaestProgram.plugins.length () > 5) {
- vbox = new VBox (true, 0);
-
- var pannable = new PannableArea ();
- pannable.add_with_viewport (vbox);
-
- VBox area = (VBox) get_content_area ();
- area.pack_start (pannable, true, true, 0);
- area.set_size_request (-1, 5*70);
- } else {
- vbox = (VBox) get_content_area ();
- }
+ var content = (VBox) get_content_area ();
+ content.set_size_request (-1, 5*70);
sources = new List<MovieSource> ();
- buttons = new List<Hildon.Button> ();
foreach (Plugin plugin in CinaestProgram.plugins) {
foreach (MovieSource source in plugin.get_sources ()) {
- var button = new Hildon.Button.with_text (SizeType.FINGER_HEIGHT, ButtonArrangement.VERTICAL, source.get_name (), source.get_description ());
- button.set_alignment(0, (float) 0.5, 0, 0);
- vbox.pack_start (button, true, true, 0);
-
- button.clicked.connect (on_source_select);
-
- buttons.append (button);
sources.append (source);
}
}
+
+ var source_list = new SourceListView (sources, true);
+ content.pack_start (source_list, true, true, 0);
+
+ source_list.source_activated.connect (on_source_activated);
}
- public void on_source_select (Gtk.Button button) {
- int n = buttons.index (button);
+ public void on_source_activated (MovieSource source) {
+ int n = sources.index (source);
response (n);
}