[gnome-boxes] selectionbar: Disable 'pause' button for saved machines



commit 8903be83d24aadbc9f5c742572c02c192d5b9160
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Sat Nov 24 17:56:11 2012 +0200

    selectionbar: Disable 'pause' button for saved machines
    
    The 'pause' button should only be enabled if any of the selected
    machines support saving and is not already in saved state.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688980

 src/selectionbar.vala |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/selectionbar.vala b/src/selectionbar.vala
index af0eee6..accadd5 100644
--- a/src/selectionbar.vala
+++ b/src/selectionbar.vala
@@ -99,6 +99,7 @@ private class Boxes.Selectionbar: GLib.Object {
             update_visible ();
             update_favorite_btn ();
             update_properties_btn ();
+            update_pause_btn ();
         });
     }
 
@@ -137,6 +138,23 @@ private class Boxes.Selectionbar: GLib.Object {
         properties_btn.sensitive = sensitive;
     }
 
+    private void update_pause_btn () {
+        var sensitive = false;
+        foreach (var item in App.app.selected_items) {
+            if (!(item is Machine))
+                continue;
+
+            var machine = item as Machine;
+            if (machine.can_save && machine.state != Machine.MachineState.SAVED) {
+                sensitive = true;
+
+                break;
+            }
+        }
+
+        pause_btn.sensitive = sensitive;
+    }
+
     private bool visible {
         set {
             fade_actor (actor, value ? 255 : 0);



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