[geary/wip/geary-inspector: 17/21] Ensure there is only ever one Inspector open at a time



commit 993f7cc65d2299e1e728c3a216a5c4d020715495
Author: Michael Gratton <mike vee net>
Date:   Sun Apr 7 17:59:45 2019 +1000

    Ensure there is only ever one Inspector open at a time

 src/client/application/geary-application.vala | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala
index d205a3c3..6d04b1cd 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -138,6 +138,7 @@ public class GearyApplication : Gtk.Application {
     private bool exiting_fired = false;
     private int exitcode = 0;
     private bool is_destroyed = false;
+    private Components.Inspector? inspector = null;
 
 
     /**
@@ -566,8 +567,15 @@ public class GearyApplication : Gtk.Application {
     }
 
     private void on_activate_inspect() {
-        Components.Inspector inspector = new Components.Inspector(this);
-        inspector.show();
+        if (this.inspector == null) {
+            this.inspector = new Components.Inspector(this);
+            this.inspector.destroy.connect(() => {
+                    this.inspector = null;
+                });
+            this.inspector.show();
+        } else {
+            this.inspector.present();
+        }
     }
 
     private void on_activate_mailto(SimpleAction action, Variant? param) {


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