From f4a696d99165d4354dc6f96436cf4bb8b3112bda Mon Sep 17 00:00:00 2001 From: Jim Norman Date: Fri, 30 Mar 2007 21:00:57 +0000 Subject: [PATCH] Process commandline args one time. --- CASA/gui/CasaMain.cs | 30 ++++++++++++---------- CASA/gui/Common.cs | 61 +++++++++++++++++++++++++++++++------------- 2 files changed, 60 insertions(+), 31 deletions(-) diff --git a/CASA/gui/CasaMain.cs b/CASA/gui/CasaMain.cs index 3dd36117..aafb221f 100644 --- a/CASA/gui/CasaMain.cs +++ b/CASA/gui/CasaMain.cs @@ -46,9 +46,8 @@ namespace Novell.CASA.GUI public GnomeKeyring objGnomeKeyring = null; public static Glade.XML gxmlMain = null; - public static CasaTray mCasaTray = null; - - public static bool m_bShowDebug = false; + public static CasaTray mCasaTray = null; + public static bool m_bshowDialogStillRunning = true; public static bool m_bGuiLocked = false; @@ -163,8 +162,9 @@ namespace Novell.CASA.GUI [STAThread] public static void Main(string[] args) { - Logger.DbgLog("GUI:CasaMain.Main() - BEGIN"); - + Logger.DbgLog("GUI:CasaMain.Main() - BEGIN"); + + Common.ParseArgs(args); Common.ReadPlatform(); #if W32 @@ -176,8 +176,7 @@ namespace Novell.CASA.GUI try { - if (Common.IsArgSet(args, Common.ARG_DEBUG)) - m_bShowDebug = true; + // ping micasad Ping ping = new Ping(); @@ -194,7 +193,7 @@ namespace Novell.CASA.GUI string message; Gtk.ButtonsType buttonType = Gtk.ButtonsType.Close; - if (m_bShowDebug) + if (Common.bArgDebug) { message = e.ToString(); Console.WriteLine(e.StackTrace); @@ -252,12 +251,17 @@ namespace Novell.CASA.GUI { try { - if (!Common.IsArgSet(args, Common.ARG_NO_TRAY_ICON)) + if (Common.bArgShowTrayIcon) { if (config.GetConfigSetting(Common.CONFIG_RUN_IN_TRAY, true)) - { - if (mCasaTray == null) - mCasaTray = new CasaTray(this, config); + { + if (mCasaTray == null) + { + mCasaTray = new CasaTray(this, config); + if (Common.bArgStartMinimized) + mCasaTray.CasaManagerQuit(); + + } } } } @@ -297,7 +301,7 @@ namespace Novell.CASA.GUI windowMain.DeleteEvent += new DeleteEventHandler(OnWindowMainDeleted); // DEBUG - if (!m_bShowDebug) + if (!Common.bArgDebug) mmiDebug.Hide(); /// PLATFORM SPECIFIC GUI CHANGES diff --git a/CASA/gui/Common.cs b/CASA/gui/Common.cs index 322a3e9b..eaeb08b0 100644 --- a/CASA/gui/Common.cs +++ b/CASA/gui/Common.cs @@ -137,9 +137,14 @@ public class Common ///############################################################## /// ARG CONSTANTS /// - public static string ARG_NO_TRAY_ICON = "-notray"; - public static string ARG_SHOW_TRAY_ICON = "-tray"; - public static string ARG_DEBUG = "-debug"; + public const string ARG_NO_TRAY_ICON = "-notray"; + public const string ARG_DEBUG = "-debug"; + public const string ARG_MINIMIZE_ON_START = "-min"; + public const string ARG_HELP = "-help"; + + public static bool bArgShowTrayIcon = true; + public static bool bArgDebug = false; + public static bool bArgStartMinimized = false; // config settings // NOTE: some of these are used in micasad @@ -330,21 +335,41 @@ public class Common return true; else return false; - } - - public static bool IsArgSet(string[] args, string argToCheck) - { - if (args != null) - { - for (int i=0; i