X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fmovie-list-store.vala;h=7a9d208d3e8d732b8e02c21098c21baaa241a8fc;hb=2a3a8c37306be1a642658341252757d52566ea9a;hp=68f72dcc7e4e3fef42529edabd276fb71b17b504;hpb=587ab43844888fcba8b687afc862e8a0e3ef2c3b;p=cinaest diff --git a/src/movie-list-store.vala b/src/movie-list-store.vala index 68f72dc..7a9d208 100644 --- a/src/movie-list-store.vala +++ b/src/movie-list-store.vala @@ -39,11 +39,22 @@ public class MovieListStore : ListStore, TreeModel { }; private Gdk.Pixbuf no_poster; private MoviePoster.Factory poster_factory; - public MovieSource source; private MovieFilter filter; public bool update_running { get; set; } private Cancellable cancellable; + public signal void search_finished (int movies); + + private MovieSource _source; + public MovieSource source { + get { + return _source; + } + set { + _source = value; + } + } + construct { set_column_types (base_type); no_poster = null; @@ -64,6 +75,23 @@ public class MovieListStore : ListStore, TreeModel { iter = iter1; } + public new bool remove (Movie movie) { + TreeIter iter; + + if (get_iter_from_movie (out iter, movie)) { + movie.notify.disconnect (this.on_movie_changed); + base.remove (iter); + + if (SourceFlags.EDITABLE in source.get_flags ()) { + source.delete_movie (movie); + } + + return true; + } + + return false; + } + private void on_movie_changed (GLib.Object source, GLib.ParamSpec spec) { var movie = (Movie) source; @@ -75,7 +103,7 @@ public class MovieListStore : ListStore, TreeModel { } public bool get_editable () { - return source.get_editable (); + return (SourceFlags.EDITABLE in source.get_flags ()); } public bool get_iter_from_movie (out TreeIter iter, Movie movie_a) { @@ -113,9 +141,11 @@ public class MovieListStore : ListStore, TreeModel { clear (); - if (source != null) + if (source != null) { // FIXME - arbitrary limit - yield source.get_movies (filter, receive_movie, 100, cancellable); + int n = yield source.get_movies (filter, receive_movie, 100, cancellable); + search_finished (n); + } update_running = false; if (cancellable.is_cancelled ()) {