[gnome-boxes] Separate methods for creation & launch of VM
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Separate methods for creation & launch of VM
- Date: Tue, 26 Jun 2012 14:35:36 +0000 (UTC)
commit 452a35ee1bd53d956eae1358ba3a94bd8dda7bd9
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Tue Jun 19 04:37:17 2012 +0300
Separate methods for creation & launch of VM
https://bugzilla.gnome.org/show_bug.cgi?id=674209
src/vm-creator.vala | 22 ++++++++++------------
src/wizard.vala | 3 ++-
2 files changed, 12 insertions(+), 13 deletions(-)
---
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index 4b06414..2fcef62 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -40,12 +40,12 @@ private class Boxes.VMCreator {
}
}
- public async void create_and_launch_vm (InstallerMedia install_media, Cancellable? cancellable) throws GLib.Error {
+ public async LibvirtMachine create_vm (InstallerMedia install_media, Cancellable? cancellable) throws GLib.Error {
if (connection == null) {
// Wait for needed libvirt connection
ulong handler = 0;
handler = App.app.notify["default-connection"].connect (() => {
- create_and_launch_vm.callback ();
+ create_vm.callback ();
App.app.disconnect (handler);
});
@@ -54,13 +54,8 @@ private class Boxes.VMCreator {
string title;
var name = yield create_domain_name_and_title_from_media (install_media, out title);
- var fullscreen = true;
- if (install_media is UnattendedInstaller) {
- var unattended = install_media as UnattendedInstaller;
-
- yield unattended.setup (name, cancellable);
- fullscreen = !unattended.express_install;
- }
+ if (install_media is UnattendedInstaller)
+ yield (install_media as UnattendedInstaller).setup (name, cancellable);
var volume = yield create_target_volume (name, install_media.resources.storage);
var caps = yield connection.get_capabilities_async (cancellable);
@@ -69,11 +64,14 @@ private class Boxes.VMCreator {
config.title = title;
var domain = connection.create_domain (config);
- domain.start (0);
- var machine = App.app.add_domain (App.app.default_source, App.app.default_connection, domain);
+ return App.app.add_domain (App.app.default_source, App.app.default_connection, domain);
+ }
+
+ public void launch_vm (LibvirtMachine machine, InstallerMedia install_media) throws GLib.Error {
+ machine.domain.start (0);
- if (machine != null && fullscreen) {
+ if (!(install_media is UnattendedInstaller) || !(install_media as UnattendedInstaller).express_install) {
ulong signal_id = 0;
signal_id = App.app.notify["ui-state"].connect (() => {
diff --git a/src/wizard.vala b/src/wizard.vala
index 8510ba0..bb143d5 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -164,7 +164,8 @@ private class Boxes.Wizard: Boxes.UI {
next_button.sensitive = false;
try {
- yield vm_creator.create_and_launch_vm (install_media, null);
+ var machine = yield vm_creator.create_vm (install_media, null);
+ vm_creator.launch_vm (machine, install_media);
} catch (IOError.CANCELLED cancel_error) { // We did this, so ignore!
} catch (GLib.Error error) {
warning (error.message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]