[gnome-boxes] libvirt-machine: Make start() method cancellable
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] libvirt-machine: Make start() method cancellable
- Date: Fri, 5 Apr 2013 16:28:05 +0000 (UTC)
commit 426b2d11df5ec007e35fdb725f589a78ae39c094
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Thu Mar 28 00:25:34 2013 +0200
libvirt-machine: Make start() method cancellable
https://bugzilla.gnome.org/show_bug.cgi?id=683465
src/libvirt-machine-properties.vala | 4 ++--
src/libvirt-machine.vala | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/libvirt-machine-properties.vala b/src/libvirt-machine-properties.vala
index 1480fc0..82d0a87 100644
--- a/src/libvirt-machine-properties.vala
+++ b/src/libvirt-machine-properties.vala
@@ -463,7 +463,7 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
private void reboot () {
if (machine.state == Machine.MachineState.SAVED) {
debug ("'%s' is in saved state. Resuming it..", machine.name);
- machine.start.begin (Machine.ConnectFlags.NONE, (obj, res) => {
+ machine.start.begin (Machine.ConnectFlags.NONE, null, (obj, res) => {
try {
machine.start.end (res);
reboot ();
@@ -484,7 +484,7 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
if (machine.state == Machine.MachineState.STOPPED ||
machine.state == Machine.MachineState.FORCE_STOPPED) {
debug ("'%s' stopped.", machine.name);
- machine.start.begin (Machine.ConnectFlags.NONE, (obj, res) => {
+ machine.start.begin (Machine.ConnectFlags.NONE, null, (obj, res) => {
try {
machine.start.end (res);
} catch (GLib.Error error) {
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index 5e64b97..ef7929d 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -495,14 +495,14 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
return gvir_flags;
}
- public async void start (Machine.ConnectFlags flags) throws GLib.Error {
+ public async void start (Machine.ConnectFlags flags, Cancellable? cancellable = null) throws GLib.Error {
if (state == MachineState.RUNNING)
return;
if (state == MachineState.PAUSED)
- yield domain.resume_async (null);
+ yield domain.resume_async (cancellable);
else if (state == MachineState.SLEEPING) {
- yield domain.wakeup_async (0, null);
+ yield domain.wakeup_async (0, cancellable);
} else {
var restore = domain.get_saved () &&
!(Machine.ConnectFlags.IGNORE_SAVED_STATE in flags);
@@ -513,7 +513,7 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
// Translators: The %s will be expanded with the name of the vm
status = _("Starting %s").printf (name);
try {
- yield domain.start_async (connect_flags_to_gvir (flags), null);
+ yield domain.start_async (connect_flags_to_gvir (flags), cancellable);
} catch (GLib.Error error) {
if (restore)
throw new Boxes.Error.RESTORE_FAILED ("Restore failed");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]