[gnome-sound-recorder/ebassi/experiments: 1/2] Do not overwrite the existing window on activation
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sound-recorder/ebassi/experiments: 1/2] Do not overwrite the existing window on activation
- Date: Wed, 7 Sep 2022 16:16:51 +0000 (UTC)
commit 7568e10297d3bf1f2bc5ca87e15fa6e322a77b92
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 | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 83125c6..a8cd231 100644
--- a/src/application.js
+++ b/src/application.js
@@ -102,10 +102,12 @@ 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');
- this.window.show();
+ if (!this.window) {
+ this.window = new Window({ application: this });
+ if (pkg.name.endsWith('Devel'))
+ this.window.add_css_class('devel');
+ }
+ this.window.present();
}
_showAbout() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]