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



commit 9d43a76ae652d97104ec3d7cd792d037aa89ab11
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 |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index cf1faa8..4e98621 100644
--- a/src/application.js
+++ b/src/application.js
@@ -258,11 +258,6 @@ const Application = new Lang.Class({
 
         if (!this.active_window) {
             let window = new MainWindow.MainWindow({ application: this });
-            window.connect('destroy', () => {
-                if (this._settings.get_boolean('run-in-background'))
-                    return;
-                this.emit('prepare-shutdown');
-            });
             window.connect('notify::active-room',
                            () => { this.emit('room-focus-changed'); });
             window.connect('notify::is-active',
@@ -286,6 +281,14 @@ const Application = new Lang.Class({
         this._updateUserListAction();
     },
 
+    vfunc_window_removed: function(window) {
+        this.parent(window);
+
+        if (this._settings.get_boolean('run-in-background'))
+            return;
+        this.emit('prepare-shutdown');
+    },
+
     vfunc_open: function(files) {
         this.activate();
 


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