[gnome-boxes] machine-thumbnailer: Diff. thumb for under construct box



commit 4752a3807e80bceabef774b4596f345f3335865b
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Wed Jul 1 16:31:49 2015 +0200

    machine-thumbnailer: Diff. thumb for under construct box
    
    This is needed to avoid conflict between the spinner showing that the
    machine is under construction and the 'system-shutdown' emblem showing
    that the machine is stopped, which happens in case of imports where
    machine remains in stopped state during the import.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751668

 src/machine-thumbnailer.vala |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/src/machine-thumbnailer.vala b/src/machine-thumbnailer.vala
index 852e16b..cea4e3c 100644
--- a/src/machine-thumbnailer.vala
+++ b/src/machine-thumbnailer.vala
@@ -27,6 +27,10 @@ private class Boxes.MachineThumbnailer: Object {
             update_thumbnail ();
         });
 
+        machine.notify["under-construction"].connect (() => {
+            update_thumbnail ();
+        });
+
         machine.config.notify["categories"].connect (() => {
             update_thumbnail ();
         });
@@ -35,7 +39,13 @@ private class Boxes.MachineThumbnailer: Object {
     }
 
     private void update_thumbnail () {
-        var new_thumbnail = machine.is_stopped ? get_stopped_thumbnail () : machine.pixbuf;
+        Gdk.Pixbuf new_thumbnail;
+
+        if (machine.is_stopped)
+            new_thumbnail = machine.under_construction ? get_under_construction_thumbnail () :
+                                                         get_stopped_thumbnail ();
+        else
+            new_thumbnail = machine.pixbuf;
 
         // Use the default thumbnail if no thumbnail have been chosen
         if (new_thumbnail == null)
@@ -80,6 +90,11 @@ private class Boxes.MachineThumbnailer: Object {
         return stopped_thumbnail;
     }
 
+    private static Gdk.Pixbuf get_under_construction_thumbnail () {
+        // If the machine is being constructed, it will draw a spinner itself, so we only need to draw an 
empty frame.
+        return get_empty_thumbnail ();
+    }
+
     private static Gdk.Pixbuf add_centered_emblem_icon (Gdk.Pixbuf pixbuf, string icon_name, int size) {
         Gdk.Pixbuf? emblem = null;
 


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