Movie list window: set title from the movie source name, not description
[cinaest] / src / movie-list-window.vala
index acc9bce..0765af1 100644 (file)
@@ -37,7 +37,7 @@ public class MovieListWindow : StackableWindow {
 
        public MovieListWindow (MovieSource source_) {
                source = source_;
-               set_title (source.get_description ());
+               set_title (source.get_name ());
 
                // View menu
                menu = new MovieListMenu (this);
@@ -118,7 +118,7 @@ public class MovieListWindow : StackableWindow {
                filter = new MovieFilter ();
                menu.filter = filter;
                filter.title = "";
-               if (SourceFlags.ONLINE in source.get_flags ()) {
+               if (SourceFlags.NOEMPTY in source.get_flags ()) {
                        no_movies.hide ();
                        search_bar_visible = true;
                        search_bar.show ();
@@ -147,10 +147,10 @@ public class MovieListWindow : StackableWindow {
                                markup.prepend ("<span fgcolor=\"%s\">".printf (color.to_string ()));
                                markup.append ("</span>");
                        }
-                       markup.prepend (source.get_description ());
+                       markup.prepend (source.get_name ());
                        set_markup (markup.str);
                } else {
-                       set_markup (source.get_description ());
+                       set_markup (source.get_name ());
                }
 
                start_search ();
@@ -161,13 +161,12 @@ public class MovieListWindow : StackableWindow {
                edit_toolbar.show ();
                movie_list.set_hildon_ui_mode (UIMode.EDIT);
 
-               var selection = movie_list.get_selection ();
-               selection.unselect_all ();
+               movie_list.unselect_all ();
        }
 
        private void on_delete_button_clicked () {
-               var selection = movie_list.get_selection ();
-               int count = selection.count_selected_rows ();
+               var movies = movie_list.get_selected_movies ();
+               int count = (int) movies.length ();
                if (count == 0) {
                        Banner.show_information (this, null, _("No movies selected"));
                        leave_edit_mode ();
@@ -178,25 +177,7 @@ public class MovieListWindow : StackableWindow {
                var res = dialog.run ();
 
                if (res == Gtk.ResponseType.OK) {
-                       weak TreeModel model;
-                       var rows = selection.get_selected_rows (out model);
-
-                       var movies = new List<Movie> ();
-
-                       // get selected movies from the store
-                       foreach (TreePath path in rows) {
-                               TreeIter iter;
-
-                               if (model.get_iter (out iter, path)) {
-                                       Movie movie;
-
-                                       model.get (iter, MovieListStore.Columns.MOVIE, out movie);
-                                       if (movie != null) {
-                                               movies.append (movie);
-                                       }
-                               }
-                       }
-                       // and remove them
+                       // Remove selected movies
                        foreach (Movie movie in movies) {
                                store.remove (movie);
                        }
@@ -295,5 +276,9 @@ public class MovieListWindow : StackableWindow {
                        no_movies.show ();
                }
        }
+
+       public unowned MovieListView get_movie_list_view () {
+               return movie_list;
+       }
 }