[gnome-boxes] machine: Asynchronously launch machines
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] machine: Asynchronously launch machines
- Date: Tue, 7 Aug 2012 17:09:25 +0000 (UTC)
commit 27c02d8e6df477c966658233a0df50e7b043e05b
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Tue Jul 31 11:57:56 2012 +0200
machine: Asynchronously launch machines
W/o this patch, user doesn't see any activity for at least a few
seconds (actual time varies but can easily be up to several seconds for
local VMs) after clicking on a box.
https://bugzilla.gnome.org/show_bug.cgi?id=680851
configure.ac | 2 +-
src/app.vala | 2 +-
src/libvirt-machine.vala | 14 +++++++-------
src/machine.vala | 4 ++--
src/remote-machine.vala | 2 +-
5 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2111805..78d9349 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,7 +46,7 @@ GLIB_MIN_VERSION=2.29.90
GOBJECT_INTROSPECTION_MIN_VERSION=0.9.6
GTK_MIN_VERSION=3.5.5
GTK_VNC_MIN_VERSION=0.4.4
-LIBVIRT_GLIB_MIN_VERSION=0.1.1
+LIBVIRT_GLIB_MIN_VERSION=0.1.2
LIBVIRT_GCONFIG_MIN_VERSION=0.1.0
LIBXML2_MIN_VERSION=2.7.8
SPICE_GTK_MIN_VERSION=0.12.101
diff --git a/src/app.vala b/src/app.vala
index e4b9f4b..8ee1337 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -619,7 +619,7 @@ private class Boxes.App: Boxes.UI {
if (current_item is Machine) {
var machine = current_item as Machine;
- machine.connect_display ();
+ machine.connect_display.begin ();
ui_state = UIState.CREDS;
} else
warning ("unknown item, fix your code");
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index ee9de02..1589b78 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -23,12 +23,12 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
_connect_display = false;
}
- public override void connect_display () {
+ public override async void connect_display () {
if (_connect_display)
return;
_connect_display = true;
- start ();
+ yield start ();
update_display ();
display.connect_it ();
@@ -76,7 +76,7 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
return;
disconnect_display ();
- connect_display ();
+ connect_display.begin ();
}
public LibvirtMachine (CollectionSource source,
@@ -521,15 +521,15 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
});
}
- public void start () {
+ public async void start () {
if (state == MachineState.RUNNING)
return;
try {
if (state == MachineState.PAUSED)
- domain.resume ();
+ yield domain.resume_async (null);
else
- domain.start (0);
+ yield domain.start_async (0, null);
} catch (GLib.Error error) {
warning ("Failed to start '%s': %s", domain.get_name (), error.message);
}
@@ -542,7 +542,7 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
ulong state_id = 0;
state_id = this.notify["state"].connect (() => {
if (state == MachineState.STOPPED) {
- start ();
+ start.begin ();
this.disconnect (state_id);
}
});
diff --git a/src/machine.vala b/src/machine.vala
index dd44ebe..7a0ccb0 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -189,7 +189,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
public abstract string get_screenshot_prefix ();
- public abstract void connect_display ();
+ public abstract async void connect_display ();
public virtual void disconnect_display () {
if (display == null)
@@ -399,7 +399,7 @@ private class Boxes.MachineActor: Boxes.UI {
if (event.keyval == Gdk.Key.KP_Enter ||
event.keyval == Gdk.Key.ISO_Enter ||
event.keyval == Gdk.Key.Return) {
- machine.connect_display ();
+ machine.connect_display.begin ();
return true;
}
diff --git a/src/remote-machine.vala b/src/remote-machine.vala
index 0d9ab23..84e02a2 100644
--- a/src/remote-machine.vala
+++ b/src/remote-machine.vala
@@ -15,7 +15,7 @@ private class Boxes.RemoteMachine: Boxes.Machine, Boxes.IPropertiesProvider {
load_screenshot ();
}
- public override void connect_display () {
+ public override async void connect_display () {
if (display != null)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]