[gnome-boxes] app: Hide window before doing other shutdown



commit 5ddffb5fd054e8b8bff084ea7f86787c6ed0bbc3
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Feb 24 19:39:47 2014 +0000

    app: Hide window before doing other shutdown
    
    This fixes the regression of Boxes not hiding the main window before
    suspending machines on quit.

 src/app.vala |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 9e20d73..b55d2de 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -98,7 +98,7 @@ private class Boxes.App: Gtk.Application, Boxes.UI {
         brokers = new HashTable<string,Broker> (str_hash, str_equal);
         filter = new Boxes.CollectionFilter ();
         var action = new GLib.SimpleAction ("quit", null);
-        action.activate.connect (() => { quit (); });
+        action.activate.connect (() => { quit_app (); });
         add_action (action);
 
         action = new GLib.SimpleAction ("new", null);
@@ -314,6 +314,18 @@ private class Boxes.App: Gtk.Application, Boxes.UI {
         return 0;
     }
 
+    private bool quit_app () {
+        window.hide ();
+
+        Idle.add (() => {
+            quit ();
+
+            return false;
+        });
+
+        return true;
+    }
+
     public override void shutdown () {
         base.shutdown ();
 
@@ -458,6 +470,7 @@ private class Boxes.App: Gtk.Application, Boxes.UI {
 
         window = new Gtk.ApplicationWindow (this);
         window.show_menubar = false;
+        window.delete_event.connect (() => { return quit_app (); });
 
         // restore window geometry/position
         var size = settings.get_value ("window-size");
@@ -762,11 +775,11 @@ private class Boxes.App: Gtk.Application, Boxes.UI {
                selection_mode = false;
         } else if (event.keyval == Gdk.Key.q &&
                    (event.state & default_modifiers) == Gdk.ModifierType.CONTROL_MASK) {
-            quit ();
+            quit_app ();
             return true;
         } else if (event.keyval == Gdk.Key.a &&
                    (event.state & default_modifiers) == Gdk.ModifierType.MOD1_MASK) {
-            quit ();
+            quit_app ();
             return true;
         }
 


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