Plugins: allow returning multiple movies per callback invocation
[cinaest] / src / plugins / google-plugin.vala
index 600c407..65abc6f 100644 (file)
@@ -250,6 +250,7 @@ class GoogleSource : MovieSource {
        private void on_movies_found (DBus.Object sender, string[] movies, bool finished) {
                print ("found %d movies\n", movies.length);
                var parser = new Json.Parser ();
+               var result = new SList<Movie> ();
 
                for (int i = 0; i < movies.length; i++) {
                        var movie = new GoogleMovie ();
@@ -271,9 +272,11 @@ class GoogleSource : MovieSource {
                        else
                                movie.secondary = movie.cinema_name + " - " + movie.showtimes;
 
-                       callback (movie);
+                       result.append (movie);
                }
 
+               callback (result);
+
                if (finished) {
                        search = null;
                        Idle.add (get_movies_callback);
@@ -299,8 +302,8 @@ class GoogleSource : MovieSource {
                return description;
        }
 
-       public override bool get_editable () {
-               return false;
+       public override SourceFlags get_flags () {
+               return SourceFlags.ONLINE;
        }
 }