[gnome-boxes/gnome-3-14] snapshot-list-row: Start machine on revert	if prev state was DISPLAY
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gnome-boxes/gnome-3-14] snapshot-list-row: Start machine on revert	if prev state was DISPLAY
 
- Date: Mon, 27 Oct 2014 18:39:22 +0000 (UTC)
 
commit 053823880e23a805d72f4567578969db587cf4c1
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Oct 23 00:39:49 2014 +0100
    snapshot-list-row: Start machine on revert if prev state was DISPLAY
    
    Its wrong to always override the state of the machine to running after
    reverting to a snapshot. This was only done for the case of user
    entering snapshots view from display so lets ensure that indeed is the
    case before overriding the state of machine.
    
    With this change, libvirt should ensure that after getting reverted to a
    snapshot, machine is back in the state that it was when the snapshot in
    question was taken.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735688
 src/snapshot-list-row.vala |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/snapshot-list-row.vala b/src/snapshot-list-row.vala
index fa98d8a..2bf579f 100644
--- a/src/snapshot-list-row.vala
+++ b/src/snapshot-list-row.vala
@@ -146,7 +146,9 @@ private class Boxes.SnapshotListRow : Gtk.ListBoxRow {
         if (show_activity)
             activity_message = _("Reverting to %s…").printf (snapshot_name);
 
-        if (snapshot_state == GVirConfig.DomainSnapshotDomainState.SHUTOFF) {
+        if (machine.window.previous_ui_state == UIState.DISPLAY &&
+            snapshot_state == GVirConfig.DomainSnapshotDomainState.SHUTOFF) {
+            // Previous UI state being DISPLAY implies that machine is running
             ulong restart_id = 0;
             restart_id = machine.domain.stopped.connect (() => {
                 machine.start.begin (Machine.ConnectFlags.NONE, null);
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]