Movie window & poster factory: change movie poster from 268x424 to 288x400
authorPhilipp Zabel <philipp.zabel@gmail.com>
Wed, 4 Aug 2010 22:23:25 +0000 (00:23 +0200)
committerPhilipp Zabel <philipp.zabel@gmail.com>
Thu, 5 Aug 2010 19:05:00 +0000 (21:05 +0200)
src/movie-window.vala
src/poster/movie-poster-factory.vala

index ecc4e9e..fefa968 100644 (file)
@@ -46,15 +46,15 @@ public class MovieWindow : StackableWindow {
                if (movie.poster != null && movie.poster.large != null) {
                        image.pixbuf = movie.poster.large;
                } else {
-                       if (movie.poster != null && movie.poster.icon != null) {
+                       if (movie.poster != null && movie.poster.small != null) {
                                // FIXME
-                               image.pixbuf = movie.poster.icon.scale_simple (268, 424, Gdk.InterpType.BILINEAR);
+                               image.pixbuf = movie.poster.small.scale_simple (288, 400, Gdk.InterpType.BILINEAR);
                        } else {
                                // FIXME
                                if (no_poster == null) try {
                                        no_poster = new Gdk.Pixbuf.from_file ("/usr/share/icons/hicolor/64x64/hildon/imageviewer_no_pic.png");
                                } catch (Error e) {
-                                       critical ("Missing general_video icon: %s\n", e.message);
+                                       critical ("Missing imageviewer_no_pic icon: %s\n", e.message);
                                }
                                image.pixbuf = no_poster;
                        }
@@ -104,7 +104,7 @@ public class MovieWindow : StackableWindow {
                } else {
                        hbox.pack_start (image, false, false, MARGIN_DOUBLE);
                        hbox.reorder_child (image, 0);
-                       plot.set_size_request (800 - 268 /* image */ - 3 * MARGIN_DOUBLE, -1);
+                       plot.set_size_request (800 - 288 /* image */ - 3 * MARGIN_DOUBLE, -1);
                        pannable.set_size_request (-1, 424);
                }
 
@@ -190,7 +190,7 @@ public class MovieWindow : StackableWindow {
                        hbox.pack_start (image, false, false, MARGIN_DOUBLE);
                        hbox.reorder_child (image, 0);
                        pannable.set_size_request (-1, 424);
-                       plot.set_size_request (800 - 268 /* image */ - 3 * MARGIN_DOUBLE, -1);
+                       plot.set_size_request (800 - 288 /* image */ - 3 * MARGIN_DOUBLE, -1);
                }
        }
 }
index b979cd2..df8f1c3 100644 (file)
@@ -65,9 +65,13 @@ namespace MoviePoster {
                public int queue (Movie movie, RequestCallback callback) throws Error {
                        string path = get_path (movie);
 
+                       foreach (Request request in requests)
+                               if (request.movie == movie)
+                                       return 0;
+
                        if (FileUtils.test (path, FileTest.IS_REGULAR)) {
                                // TODO: make this async?
-                               var pixbuf = new Gdk.Pixbuf.from_file_at_size (path, 268, 424);
+                               var pixbuf = new Gdk.Pixbuf.from_file_at_scale (path, 288, 400, true);
                                callback (pixbuf, movie);
                        } else if (server != null && download_posters) {
                                var request = new Request ();
@@ -75,8 +79,8 @@ namespace MoviePoster {
                                request.handle = server.Fetch (movie.title, movie.year.to_string (), "movie");
                                request.movie = movie;
                                request.callback = callback;
-                               request.width = 268;
-                               request.height = 424;
+                               request.width = 288;
+                               request.height = 400;
                                requests.append (request);
                        }
                        return 0;