[gnome-boxes] machine: Add can_restart abstract property
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] machine: Add can_restart abstract property
- Date: Fri, 22 Apr 2016 13:45:03 +0000 (UTC)
commit 664ca02f408ba1efd6f6f419ca6ee7094344b2e3
Author: Visarion Alexandru <viorel visarion gmail com>
Date: Wed Apr 20 16:38:25 2016 +0300
machine: Add can_restart abstract property
Add an abstract property which symbolises the property of a machine
to be able to be restarted.
It's currently false for all the machine types except libvirt.
https://bugzilla.gnome.org/show_bug.cgi?id=745691
src/libvirt-machine.vala | 1 +
src/machine.vala | 1 +
src/ovirt-machine.vala | 2 ++
src/remote-machine.vala | 1 +
4 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index 056ac52..9d7f471 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -31,6 +31,7 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
public override bool suspend_at_exit { get { return connection == App.app.default_connection &&
!run_in_bg; } }
public override bool can_save { get { return !saving && state != MachineState.SAVED; } }
+ public override bool can_restart { get { return state == MachineState.RUNNING || state ==
MachineState.SAVED; } }
protected override bool should_autosave {
get {
return (base.should_autosave &&
diff --git a/src/machine.vala b/src/machine.vala
index ee55487..c538971 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -15,6 +15,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
public virtual bool suspend_at_exit { get { return false; } }
public virtual bool can_save { get { return false; } }
+ public abstract bool can_restart { get; }
public bool can_delete { get; protected set; default = true; }
public bool under_construction { get; protected set; default = false; }
diff --git a/src/ovirt-machine.vala b/src/ovirt-machine.vala
index eb22c32..807d1d0 100644
--- a/src/ovirt-machine.vala
+++ b/src/ovirt-machine.vala
@@ -3,6 +3,8 @@ using Ovirt;
using Gtk;
private class Boxes.OvirtMachine: Boxes.Machine {
+ public override bool can_restart { get { return false; } }
+
private Ovirt.Vm vm;
private Ovirt.Proxy proxy;
diff --git a/src/remote-machine.vala b/src/remote-machine.vala
index 4ef438f..26809f5 100644
--- a/src/remote-machine.vala
+++ b/src/remote-machine.vala
@@ -2,6 +2,7 @@
using Gtk;
private class Boxes.RemoteMachine: Boxes.Machine, Boxes.IPropertiesProvider {
+ public override bool can_restart { get { return false; } }
public RemoteMachine (CollectionSource source) throws Boxes.Error {
if (source.source_type != "spice" &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]