diff options
author | Zeeshan Ali (Khattak) <zeeshanak@gnome.org> | 2013-03-28 00:25:34 +0200 |
---|---|---|
committer | Zeeshan Ali (Khattak) <zeeshanak@gnome.org> | 2013-04-05 19:20:55 +0300 |
commit | 426b2d11df5ec007e35fdb725f589a78ae39c094 (patch) | |
tree | edd25451a473c59de078a9766a70ab18214ff355 | |
parent | 521c2b42693d62c3ac2cd3a4f2bd6b6991dd473d (diff) |
libvirt-machine: Make start() method cancellable
https://bugzilla.gnome.org/show_bug.cgi?id=683465
-rw-r--r-- | src/libvirt-machine-properties.vala | 4 | ||||
-rw-r--r-- | 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"); |