[gnome-boxes] machine: Make 'can-save' a virtual property



commit ebb7ebe68d46360428ac7df509985814ff1fd41e
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Oct 24 13:20:59 2014 +0100

    machine: Make 'can-save' a virtual property
    
    Instead of subclasses overriding the value of 'can-save' property,
    let them override the property getter itself so they can implement
    smarter (more dynamic) getters for it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=730793

 src/libvirt-machine.vala |    3 ++-
 src/machine.vala         |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index b86a7da..e12a681 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -29,6 +29,8 @@ 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 void disconnect_display () {
         stay_on_display = false;
 
@@ -80,7 +82,6 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
     construct {
         stats = new MachineStat[STATS_SIZE];
         stats_cancellable = new Cancellable ();
-        can_save = true;
     }
 
     public void update_domain_config () {
diff --git a/src/machine.vala b/src/machine.vala
index 76bcedc..e419ca0 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -11,7 +11,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
     public string? status { get; set; }
     public bool suspend_at_exit;
 
-    public bool can_save { get; protected set; default = false; }
+    public virtual bool can_save { get { return false; } }
     public bool can_delete { get; protected set; default = true; }
     public bool under_construction { get; protected set; default = false; }
 


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