[polari/wip/fmuellner/window-experiments: 9/29] app: Use window-removed vfunc for shutdown preparation



commit 3a0a139346afa2b483d8b22682989bf60a32b32b
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jul 14 18:06:48 2016 +0200

    app: Use window-removed vfunc for shutdown preparation
    
    It's nicer to not mix this with the mostly unrelated window creation,
    and the vfunc will be a lot easier to adapt when we allow multiple
    windows.

 src/application.js |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index bd1a089..64dc106 100644
--- a/src/application.js
+++ b/src/application.js
@@ -146,12 +146,6 @@ const Application = new Lang.Class({
     vfunc_activate: function() {
         if (!this._window) {
             this._window = new MainWindow.MainWindow({ application: this });
-            this._window.connect('destroy', Lang.bind(this,
-                function() {
-                    for (let id in this._pendingRequests)
-                        this._pendingRequests[id].cancellable.cancel();
-                    this.emit('prepare-shutdown');
-            }));
             if (!this._startHidden)
                 this._window.present();
 
@@ -161,6 +155,14 @@ const Application = new Lang.Class({
         }
     },
 
+    vfunc_window_removed: function(window) {
+        this.parent(window);
+
+        for (let id in this._pendingRequests)
+            this._pendingRequests[id].cancellable.cancel();
+        this.emit('prepare-shutdown');
+    },
+
     vfunc_open: function(files) {
         this.activate();
 


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