[gnome-boxes] machine: Add protected 'should_save' property



commit 03c829fa17c8a1a19dd51344d36abd856b2b7b44
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Nov 12 13:24:57 2014 +0000

    machine: Add protected 'should_save' property
    
    Allow subclasses to easily override the decision to autosave or not.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694931

 src/machine.vala |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/machine.vala b/src/machine.vala
index fe925ce..1613940 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -19,6 +19,12 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
 
     public signal void got_error (string message);
 
+    protected virtual bool should_autosave {
+        get {
+            return (can_save && autosave_timeout_id == 0);
+        }
+    }
+
     private ulong show_id;
     private ulong hide_id;
     private ulong disconnected_id;
@@ -257,7 +263,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
     }
 
     public void schedule_autosave () {
-        if (!can_save || autosave_timeout_id != 0)
+        if (!should_autosave)
             return;
 
         debug ("Scheduling autosave for '%s'", name);


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