[gnome-boxes] machine: Constructor init display config
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] machine: Constructor init display config
- Date: Tue, 7 Jul 2015 21:43:10 +0000 (UTC)
commit 906afc2f5edf277d97134526b63cafd51b329abc
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu Jul 2 16:11:02 2015 +0200
machine: Constructor init display config
Move the call to create_display_config() from subclasses' constructors
to Machine's constructor.
This is needed to ensure that Machine.config is set in Machine's
constructor and subclasses will assume config to be initalized after
base constructor returns in the following patches.
https://bugzilla.gnome.org/show_bug.cgi?id=730258
src/libvirt-machine.vala | 3 +--
src/machine.vala | 6 ++++--
src/ovirt-machine.vala | 3 +--
src/remote-machine.vala | 1 -
4 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index d6aa843..3dbbdb3 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -140,10 +140,9 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
GVir.Domain domain) throws GLib.Error {
var config = domain.get_config (GVir.DomainXMLFlags.INACTIVE);
var item_name = config.get_title () ?? domain.get_name ();
- base (source, item_name);
+ base (source, item_name, domain.get_uuid ());
debug ("new libvirt machine: " + domain.get_name ());
- create_display_config (domain.get_uuid ());
this.connection = connection;
this.domain = domain;
this.properties = new LibvirtMachineProperties (this);
diff --git a/src/machine.vala b/src/machine.vala
index e0e8186..53ef20e 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -221,7 +221,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
cr.fill ();
}
- public Machine (Boxes.CollectionSource source, string name) {
+ public Machine (Boxes.CollectionSource source, string name, string? uuid = null) {
this.name = name;
this.source = source;
this.connecting_cancellable = new Cancellable ();
@@ -240,6 +240,8 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
notify["name"].connect (() => {
status = this.name;
});
+
+ create_display_config (uuid);
}
protected void load_screenshot () {
@@ -364,7 +366,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
window = null;
}
- protected void create_display_config (string? uuid = null)
+ private void create_display_config (string? uuid = null)
requires (this.config == null)
ensures (this.config != null) {
diff --git a/src/ovirt-machine.vala b/src/ovirt-machine.vala
index 730b990..87f8dc4 100644
--- a/src/ovirt-machine.vala
+++ b/src/ovirt-machine.vala
@@ -9,10 +9,9 @@ private class Boxes.OvirtMachine: Boxes.Machine {
public OvirtMachine (CollectionSource source,
Ovirt.Proxy proxy,
Ovirt.Vm vm) throws GLib.Error {
- base (source, vm.name);
+ base (source, vm.name, vm.guid);
debug ("new ovirt machine: " + name);
- create_display_config (vm.guid);
this.proxy = proxy;
this.vm = vm;
diff --git a/src/remote-machine.vala b/src/remote-machine.vala
index ecf7ba4..c437843 100644
--- a/src/remote-machine.vala
+++ b/src/remote-machine.vala
@@ -13,7 +13,6 @@ private class Boxes.RemoteMachine: Boxes.Machine, Boxes.IPropertiesProvider {
// assume the remote is running for now
state = MachineState.RUNNING;
- create_display_config ();
source.bind_property ("name", this, "name", BindingFlags.BIDIRECTIONAL);
config.access_last_time = get_real_time ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]