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 GnomeKeyring objGnomeKeyring = null;
|
||||||
|
|
||||||
public static Glade.XML gxmlMain = 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_bshowDialogStillRunning = true;
|
||||||
public static bool m_bGuiLocked = false;
|
public static bool m_bGuiLocked = false;
|
||||||
|
|
||||||
@ -163,8 +162,9 @@ namespace Novell.CASA.GUI
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:CasaMain.Main() - BEGIN");
|
Logger.DbgLog("GUI:CasaMain.Main() - BEGIN");
|
||||||
|
|
||||||
|
Common.ParseArgs(args);
|
||||||
Common.ReadPlatform();
|
Common.ReadPlatform();
|
||||||
|
|
||||||
#if W32
|
#if W32
|
||||||
@ -176,8 +176,7 @@ namespace Novell.CASA.GUI
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Common.IsArgSet(args, Common.ARG_DEBUG))
|
|
||||||
m_bShowDebug = true;
|
|
||||||
|
|
||||||
// ping micasad
|
// ping micasad
|
||||||
Ping ping = new Ping();
|
Ping ping = new Ping();
|
||||||
@ -194,7 +193,7 @@ namespace Novell.CASA.GUI
|
|||||||
string message;
|
string message;
|
||||||
Gtk.ButtonsType buttonType = Gtk.ButtonsType.Close;
|
Gtk.ButtonsType buttonType = Gtk.ButtonsType.Close;
|
||||||
|
|
||||||
if (m_bShowDebug)
|
if (Common.bArgDebug)
|
||||||
{
|
{
|
||||||
message = e.ToString();
|
message = e.ToString();
|
||||||
Console.WriteLine(e.StackTrace);
|
Console.WriteLine(e.StackTrace);
|
||||||
@ -252,12 +251,17 @@ namespace Novell.CASA.GUI
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!Common.IsArgSet(args, Common.ARG_NO_TRAY_ICON))
|
if (Common.bArgShowTrayIcon)
|
||||||
{
|
{
|
||||||
if (config.GetConfigSetting(Common.CONFIG_RUN_IN_TRAY, true))
|
if (config.GetConfigSetting(Common.CONFIG_RUN_IN_TRAY, true))
|
||||||
{
|
{
|
||||||
if (mCasaTray == null)
|
if (mCasaTray == null)
|
||||||
mCasaTray = new CasaTray(this, config);
|
{
|
||||||
|
mCasaTray = new CasaTray(this, config);
|
||||||
|
if (Common.bArgStartMinimized)
|
||||||
|
mCasaTray.CasaManagerQuit();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,7 +301,7 @@ namespace Novell.CASA.GUI
|
|||||||
windowMain.DeleteEvent += new DeleteEventHandler(OnWindowMainDeleted);
|
windowMain.DeleteEvent += new DeleteEventHandler(OnWindowMainDeleted);
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
if (!m_bShowDebug)
|
if (!Common.bArgDebug)
|
||||||
mmiDebug.Hide();
|
mmiDebug.Hide();
|
||||||
|
|
||||||
/// PLATFORM SPECIFIC GUI CHANGES
|
/// PLATFORM SPECIFIC GUI CHANGES
|
||||||
|
@ -137,9 +137,14 @@ public class Common
|
|||||||
///##############################################################
|
///##############################################################
|
||||||
/// ARG CONSTANTS
|
/// ARG CONSTANTS
|
||||||
///
|
///
|
||||||
public static string ARG_NO_TRAY_ICON = "-notray";
|
public const string ARG_NO_TRAY_ICON = "-notray";
|
||||||
public static string ARG_SHOW_TRAY_ICON = "-tray";
|
public const string ARG_DEBUG = "-debug";
|
||||||
public static 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
|
// config settings
|
||||||
// NOTE: some of these are used in micasad
|
// NOTE: some of these are used in micasad
|
||||||
@ -330,21 +335,41 @@ public class Common
|
|||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsArgSet(string[] args, string argToCheck)
|
public static void ParseArgs(string[] args)
|
||||||
{
|
{
|
||||||
if (args != null)
|
foreach (string arg in args)
|
||||||
{
|
{
|
||||||
for (int i=0; i<args.Length; i++)
|
|
||||||
{
|
switch (arg)
|
||||||
if (argToCheck.Equals(args[i].ToLower()))
|
{
|
||||||
return true;
|
case Common.ARG_NO_TRAY_ICON:
|
||||||
}
|
bArgShowTrayIcon = false;
|
||||||
}
|
break;
|
||||||
|
|
||||||
return false;
|
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()
|
private static string GetLocale()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user