[gnome-boxes] Fix squished icon in properties during wizard



commit a32e31ebd1b23481476b0e8678b532c9cc27d33a
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Jan 28 14:02:16 2013 +0100

    Fix squished icon in properties during wizard
    
    The thumbnail is stretched, so center the cd icon in a properly
    sized pixbuf.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688328

 src/machine.vala |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/machine.vala b/src/machine.vala
index ac54435..18686c1 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -636,8 +636,14 @@ private class Boxes.MachineActor: Boxes.UI {
                 Gdk.Pixbuf pixbuf = null;
                 if (previous_ui_state == UIState.WIZARD) {
                     var theme = Gtk.IconTheme.get_for_screen (App.app.window.get_screen ());
+                    pixbuf = new Gdk.Pixbuf (Gdk.Colorspace.RGB, true, 8,
+                                             Machine.SCREENSHOT_WIDTH, Machine.SCREENSHOT_HEIGHT);
+                    pixbuf.fill (0x00000000); // Transparent
                     try {
-                        pixbuf = theme.load_icon ("media-optical", Machine.SCREENSHOT_HEIGHT, 0);
+                        var icon = theme.load_icon ("media-optical", Machine.SCREENSHOT_HEIGHT, 0);
+                        // Center icon in pixbuf
+                        icon.copy_area (0, 0, Machine.SCREENSHOT_HEIGHT, Machine.SCREENSHOT_HEIGHT, pixbuf,
+                                        (Machine.SCREENSHOT_WIDTH - Machine.SCREENSHOT_HEIGHT) / 2, 0);
                     } catch (GLib.Error err) {
                         warning (err.message);
                     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]