[gnome-boxes] app-window: Autosave machines when in background



commit 746ac24d6edc611c66d8c7ad80b8ea6ee87e1b03
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Nov 12 01:32:46 2014 +0000

    app-window: Autosave machines when in background
    
    When a machine is no longer running in foreground in any window,
    schedule an autosave for it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694931

 src/app-window.vala |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/app-window.vala b/src/app-window.vala
index 949ee60..91b82f8 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -193,6 +193,7 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
                 }
 
                 machine.connecting_cancellable.cancel (); // Cancel any in-progress connections
+                machine.schedule_autosave ();
             }
 
             break;
@@ -239,6 +240,7 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
     public void connect_to (Machine machine) {
         current_item = machine;
         machine.window = this;
+        machine.unschedule_autosave ();
 
         // Track machine status in toobar
         status_bind = machine.bind_property ("status", topbar, "status", BindingFlags.SYNC_CREATE);
@@ -359,8 +361,12 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
     private bool on_delete_event () {
         return_if_fail (current_item == null || current_item is Machine);
 
-        if (current_item != null)
-            (current_item as Machine).window = null;
+        if (current_item != null) {
+            var machine = current_item as Machine;
+
+            machine.window = null;
+            machine.schedule_autosave ();
+        }
 
         return App.app.remove_window (this);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]