[smuxi: 4/5] Frontend-GNOME: implemented --new-instance parameter



commit b3e61a11c581dd061bd09f88868457bbe652075c
Author: Mirco Bauer <meebey meebey net>
Date:   Tue Jun 2 21:18:28 2015 +0200

    Frontend-GNOME: implemented --new-instance parameter

 src/Frontend-GNOME/Main.cs |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/Frontend-GNOME/Main.cs b/src/Frontend-GNOME/Main.cs
index 84781c7..d7a4310 100644
--- a/src/Frontend-GNOME/Main.cs
+++ b/src/Frontend-GNOME/Main.cs
@@ -42,6 +42,7 @@ namespace Smuxi.Frontend.Gnome
             var debug = false;
             var link = String.Empty;
             var engine = String.Empty;
+            var newInstance = false;
             var options = new OptionSet();
             options.Add(
                 "d|debug",
@@ -75,6 +76,13 @@ namespace Smuxi.Frontend.Gnome
                     link = v;
                 }
             );
+            options.Add(
+                "new-instance",
+                _("Starts a new Smuxi instance and ignores an existing one"),
+                v => {
+                    newInstance = true;
+                }
+            );
 
             try {
                 options.Parse(args);
@@ -105,7 +113,7 @@ namespace Smuxi.Frontend.Gnome
                             Console.WriteLine(msg);
 #endif
                             Instance.FirstInstance.OpenLink(link);
-                        } else {
+                        } else if (!newInstance) {
                             var msg = _("Bringing already running Smuxi instance to foreground...");
 #if LOG4NET
                             _Logger.Info(msg);
@@ -115,8 +123,10 @@ namespace Smuxi.Frontend.Gnome
                             Instance.FirstInstance.PresentMainWindow();
                         }
 
-                        // don't initialize/spawn another instance
-                        return;
+                        if (!newInstance) {
+                            // don't initialize/spawn another instance
+                            return;
+                        }
                     }
                 } catch (Exception ex) {
 #if LOG4NET


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