Add movie edit dialog
[cinaest] / src / movie-list-store.vala
index cd26e0e..b7c85e2 100644 (file)
@@ -181,15 +181,8 @@ public class MovieListStore : ListStore, TreeModel {
                if (cancellable.is_cancelled ())
                        return;
 
-               foreach (Movie movie in movies) {
+               foreach (Movie movie in movies)
                        add (movie, out iter);
-                       try {
-                               poster_factory.queue_thumbnail (movie, Poster.ICON_WIDTH, Poster.ICON_HEIGHT, false, receive_poster_icon);
-                               poster_factory.queue_thumbnail (movie, Poster.SMALL_WIDTH, Poster.SMALL_HEIGHT, false, receive_poster_small);
-                       } catch (Error e) {
-                               warning ("Failed to queue poster request: %s\n", e.message);
-                       }
-               }
        }
 
        private void receive_poster_icon (Gdk.Pixbuf pixbuf, Movie movie) {
@@ -220,13 +213,6 @@ public class MovieListStore : ListStore, TreeModel {
        public virtual void get_value (TreeIter iter, int column, out GLib.Value value) {
                Movie movie;
 
-               // FIXME
-               if (no_poster == null) try {
-                       no_poster = new Gdk.Pixbuf.from_file ("/usr/share/icons/hicolor/64x64/hildon/general_video.png");
-               } catch (Error e) {
-                       critical ("Missing general_video icon: %s\n", e.message);
-               }
-
                return_if_fail (column >= 0 && column < Columns.N_COLUMNS);
 
                // Get the Movie from our parent's storage
@@ -258,17 +244,30 @@ public class MovieListStore : ListStore, TreeModel {
                        break;
 
                case Columns.POSTER:
-                       if ((movie.poster != null) && (movie.poster.small != null))
+                       if ((movie.poster != null) && (movie.poster.small != null)) {
                                value.set_object (movie.poster.small);
-                       else
+                       } else {
+                               // FIXME
+                               if (no_poster == null) try {
+                               //      var no_pic = new Gdk.Pixbuf.from_file ("/usr/share/icons/hicolor/64x64/hildon/imageviewer_no_pic.png");
+                                       var no_pic = new Gdk.Pixbuf.from_file ("/usr/share/icons/hicolor/64x64/hildon/general_no_thumbnail.png");
+                                       no_poster = new Gdk.Pixbuf (Gdk.Colorspace.RGB, true, 8, Poster.SMALL_WIDTH, Poster.SMALL_HEIGHT);
+                                       no_poster.fill (0);
+                                       no_pic.copy_area (0, 0, no_pic.width, no_pic.height, no_poster,
+                                                         (Poster.SMALL_WIDTH - no_pic.width) / 2, (Poster.SMALL_HEIGHT - no_pic.height) / 2);
+                               } catch (Error e) {
+                                       critical ("Missing general_video icon: %s\n", e.message);
+                               }
                                value.set_object (no_poster);
+                       }
                        break;
 
                case Columns.ICON:
-                       if ((movie.poster != null) && (movie.poster.icon != null))
+                       if ((movie.poster != null) && (movie.poster.icon != null)) {
                                value.set_object (movie.poster.icon);
-                       else
-                               value.set_object (no_poster);
+                       } else {
+                               value.set_object (null);
+                       }
                        break;
 
                case Columns.MOVIE: