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 ();
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);
}
no_movies.show ();
}
}
+
+ public unowned MovieListView get_movie_list_view () {
+ return movie_list;
+ }
}