[gnome-boxes] machine: Machine itself handles 'suspend_at_exit'
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] machine: Machine itself handles 'suspend_at_exit'
- Date: Thu, 9 Jul 2015 19:28:34 +0000 (UTC)
commit c627d229cca94de2d15e9bb510a22ab9db54c370
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Thu Jul 9 20:00:23 2015 +0100
machine: Machine itself handles 'suspend_at_exit'
Instead of having this as field of Machine that broker sets, let's make
it a virtual property so subclasses can override it as per their need.
https://bugzilla.gnome.org/show_bug.cgi?id=746754
src/libvirt-broker.vala | 1 -
src/libvirt-machine.vala | 1 +
src/machine.vala | 2 +-
3 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/libvirt-broker.vala b/src/libvirt-broker.vala
index 62c02cd..a7180db 100644
--- a/src/libvirt-broker.vala
+++ b/src/libvirt-broker.vala
@@ -51,7 +51,6 @@ private class Boxes.LibvirtBroker : Boxes.Broker {
machine = yield new LibvirtMachine (source, connection, domain);
pending_domains.remove (domain);
- machine.suspend_at_exit = (connection == App.app.default_connection);
domain.set_data<LibvirtMachine> ("machine", machine);
App.app.collection.add_item (machine);
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index 246c044..45ec7d8 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -29,6 +29,7 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
set { source.set_boolean ("source", "save-on-quit", value); }
}
+ public override bool suspend_at_exit { get { return connection == App.app.default_connection; } }
public override bool can_save { get { return !saving && state != MachineState.SAVED; } }
protected override bool should_autosave {
get {
diff --git a/src/machine.vala b/src/machine.vala
index f6c3bf2..7fa64de 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -12,7 +12,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
public bool stay_on_display;
public string? info { get; protected set; }
public string status { get; set; }
- public bool suspend_at_exit;
+ public virtual bool suspend_at_exit { get { return false; } }
public virtual bool can_save { get { return false; } }
public bool can_delete { get; protected set; default = true; }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]