[gnome-boxes] libvirt-machine: Smarter 'can-save' implementation



commit 5b3b6d588a647a331bf0dc4b7ffed59987259f3b
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Oct 24 13:28:05 2014 +0100

    libvirt-machine: Smarter 'can-save' implementation
    
    This property shoudl check the state of the machine rather than its user
    having to do that in addition to checking the value of this property.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=730793

 src/libvirt-machine.vala |    2 +-
 src/selectionbar.vala    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index e12a681..8f48162 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -29,7 +29,7 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
         set { source.set_boolean ("source", "save-on-quit", value); }
     }
 
-    public override bool can_save { get { return true; } }
+    public override bool can_save { get { return state != MachineState.SAVED; } }
 
     public override void disconnect_display () {
         stay_on_display = false;
diff --git a/src/selectionbar.vala b/src/selectionbar.vala
index 0187ab9..583b84d 100644
--- a/src/selectionbar.vala
+++ b/src/selectionbar.vala
@@ -121,7 +121,7 @@ private class Boxes.Selectionbar: Gtk.Revealer {
                 continue;
 
             var machine = item as Machine;
-            if (machine.can_save && machine.state != Machine.MachineState.SAVED) {
+            if (machine.can_save) {
                 sensitive = true;
 
                 break;


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