src/poster/movie-poster-factory.c \
src/settings-dialog.c \
src/source-dialog.c \
- src/source-list-view.c
+ src/source-list-view.c \
+ src/source-list-window.c
cinaest_VALASOURCES = \
src/main.vala \
src/poster/movie-poster-factory.vala \
src/settings-dialog.vala \
src/source-dialog.vala \
- src/source-list-view.vala
+ src/source-list-view.vala \
+ src/source-list-window.vala
src/main.c: ${cinaest_VALASOURCES}
${VALAC} -C ${cinaest_VALASOURCES} ${cinaest_VALAFLAGS}
src/plugins/google-plugin.vala
src/settings-dialog.vala
src/source-dialog.vala
+src/source-list-window.vala
using Hildon;
public class CinaestProgram : Hildon.Program {
- MovieListWindow window;
+ SourceListWindow window;
public static List<Plugin> plugins;
construct {
Environment.set_application_name ("Cinæst");
- window = new MovieListWindow ();
+ window = new SourceListWindow ();
window.destroy.connect (Gtk.main_quit);
add_window (window);
}
public void run () {
- // FIXME - always start with the first plugin's first source for now
- if (plugins != null) {
- var plugin = plugins.first ().data;
- if (plugin != null)
- window.source = plugin.get_sources ().first ().data;
+ foreach (Plugin plugin in plugins) {
+ window.add_sources (plugin.get_sources ());
}
Gtk.main ();
}
public class SourceListView : PannableArea {
TreeView tree;
+ ListStore store;
public signal void source_activated (MovieSource source);
public SourceListView (List<MovieSource> list) {
// Source list
- var store = new ListStore (3, typeof (string), typeof (string), typeof (MovieSource));
- foreach (MovieSource source in list) {
- TreeIter iter;
- store.append (out iter);
- store.set (iter, 0, source.get_name (), 1, source.get_description (), 2, source);
- }
+ store = new ListStore (3, typeof (string), typeof (string), typeof (MovieSource));
+ add_sources (list);
// Tree View
tree = (TreeView) Hildon.gtk_tree_view_new_with_model (UIMode.NORMAL, store);
tree.row_activated.connect (on_row_activated);
}
+ public void add_sources (List<MovieSource> list) {
+ foreach (MovieSource source in list) {
+ TreeIter iter;
+ store.append (out iter);
+ store.set (iter, 0, source.get_name (), 1, source.get_description (), 2, source);
+ }
+ }
+
private void on_row_activated (TreeView tree, TreePath path_, TreeViewColumn column) {
TreePath path = path_.copy (); // FIXME - calling model.get_iter with path_ directly causes a C qualifier warning
TreeModel model = tree.model;
--- /dev/null
+/* This file is part of Cinaest.
+ *
+ * Copyright (C) 2009 Philipp Zabel
+ *
+ * Cinaest 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Cinaest 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 Cinaest. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+using Gtk;
+using Hildon;
+
+public class SourceListWindow : StackableWindow {
+ SourceListView source_list;
+
+ construct {
+ set_title ("Cinæst");
+
+ var sources = new List<MovieSource> ();
+ source_list = new SourceListView (sources);
+
+ var hbox = new HBox (true, 0);
+ hbox.pack_start (source_list, true, true, MARGIN_DOUBLE);
+ add (hbox);
+
+ source_list.source_activated.connect (on_source_activated);
+
+ show_all ();
+ }
+
+ public void add_sources (List<MovieSource> list) {
+ source_list.add_sources (list);
+ }
+
+ private void on_source_activated (MovieSource source) {
+ var window = new MovieListWindow ();
+ window.source = source;
+ }
+}