X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fmovie-list-window.vala;h=133451af25666424926a9b437ba3cf385fc4d1f5;hb=aa6cf09a74f2683008653d134988c13ba903a659;hp=acc9bce375aeb87ad923e31decd38829fc87e2f7;hpb=a0bcf1e4d6b7f4cbba2cd7d16be74c5499194f01;p=cinaest diff --git a/src/movie-list-window.vala b/src/movie-list-window.vala index acc9bce..133451a 100644 --- a/src/movie-list-window.vala +++ b/src/movie-list-window.vala @@ -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 (); - - // 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; + } }