[polari/wip/fmuellner/initial-setup-quit] initialSetup: Fix quit action



commit 24bf4290c3c6df6c4ef4e66d2d730b8f12dfb386
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Oct 21 20:14:14 2017 +0200

    initialSetup: Fix quit action
    
    We will currently always open the main application window after the
    initial setup window has been closed. This behavior is correct if
    the window was completed or dismissed, but not when the app itself
    was quit - cancel continuing to the main window in that case to
    get the expected behavior.

 src/application.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index ad9ac66..6a7352b 100644
--- a/src/application.js
+++ b/src/application.js
@@ -42,6 +42,8 @@ var Application = new Lang.Class({
         this._nickTrackData = new Map();
         this._demons = [];
 
+        this._windowRemovedId = 0;
+
         this.add_main_option('start-client', 0,
                              GLib.OptionFlags.NONE, GLib.OptionArg.NONE,
                              _("Start Telepathy client"), null);
@@ -285,8 +287,9 @@ var Application = new Lang.Class({
         if (!this.active_window) {
             if (this._needsInitialSetup()) {
                 let setupDialog = new InitialSetup.InitialSetupWindow({ application: this });
-                let id = this.connect('window-removed', () => {
-                    this.disconnect(id);
+                this._windowRemovedId = this.connect('window-removed', () => {
+                    this.disconnect(this._windowRemovedId);
+                    this._windowRemovedId = 0;
                     this.activate();
                 });
             } else {
@@ -776,6 +779,10 @@ var Application = new Lang.Class({
     },
 
     _onQuit: function() {
+        if (this._windowRemovedId)
+            this.disconnect(this._windowRemovedId);
+        this._windowRemovedId = 0;
+
         this.get_windows().reverse().forEach(w => { w.destroy(); });
         this.emit('prepare-shutdown');
     }


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