Process commandline args one time.
This commit is contained in:
parent
137e56f7cf
commit
f4a696d991
@ -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 CasaTray mCasaTray = null;
|
||||
|
||||
public static bool m_bShowDebug = false;
|
||||
public static bool m_bshowDialogStillRunning = true;
|
||||
public static bool m_bGuiLocked = false;
|
||||
|
||||
@ -165,6 +164,7 @@ namespace Novell.CASA.GUI
|
||||
{
|
||||
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
|
||||
|
@ -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
|
||||
@ -332,19 +337,39 @@ public class Common
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsArgSet(string[] args, string argToCheck)
|
||||
{
|
||||
if (args != null)
|
||||
{
|
||||
for (int i=0; i<args.Length; i++)
|
||||
{
|
||||
if (argToCheck.Equals(args[i].ToLower()))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public static void ParseArgs(string[] args)
|
||||
{
|
||||
foreach (string arg in args)
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
switch (arg)
|
||||
{
|
||||
case Common.ARG_NO_TRAY_ICON:
|
||||
bArgShowTrayIcon = false;
|
||||
break;
|
||||
|
||||
case Common.ARG_DEBUG:
|
||||
bArgDebug = true;
|
||||
break;
|
||||
|
||||
case Common.ARG_MINIMIZE_ON_START:
|
||||
bArgStartMinimized = true;
|
||||
break;
|
||||
|
||||
case Common.ARG_HELP:
|
||||
Console.WriteLine("Usage options");
|
||||
Console.WriteLine(Common.ARG_NO_TRAY_ICON + " do not show tray icon");
|
||||
Console.WriteLine(Common.ARG_MINIMIZE_ON_START + " start minimized");
|
||||
Console.WriteLine(Common.ARG_HELP + " show help options");
|
||||
Application.Quit();
|
||||
break;
|
||||
|
||||
//default:
|
||||
Console.WriteLine("Unsupported argument {0}", arg);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetLocale()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user