[gnome-sound-recorder/ebassi/experiments: 7/8] Do not overwrite the existing window on activation




commit f5ef0460cfb4ab6344bd498c7a82ce31ca6ff261
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Aug 15 18:15:50 2022 +0100

    Do not overwrite the existing window on activation
    
    Sound Recorder only has one window per instance, so if there is an
    application window open already, we don't need to do anything other than
    presenting it to the user.

 src/application.js | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 83125c6..e01b8b4 100644
--- a/src/application.js
+++ b/src/application.js
@@ -102,9 +102,11 @@ var Application = GObject.registerClass(class Application extends Adw.Applicatio
     }
 
     vfunc_activate() {
-        this.window = new Window({ application: this });
-        if (pkg.name.endsWith('Devel'))
-            this.window.add_css_class('devel');
+        if (!this.window) {
+            this.window = new Window({ application: this });
+            if (pkg.name.endsWith('Devel'))
+                this.window.add_css_class('devel');
+        }
         this.window.show();
     }
 


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