diff --git a/c_gui/CASAManager.csproj b/c_gui/CASAManager.csproj index fab9f396..cf902af1 100644 --- a/c_gui/CASAManager.csproj +++ b/c_gui/CASAManager.csproj @@ -94,11 +94,6 @@ Project = "{57CD94A2-5B4A-40C3-8189-CB760FB78357}" Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> - + diff --git a/c_gui/CasaMain.cs b/c_gui/CasaMain.cs index f0e19ac0..5e9abef0 100644 --- a/c_gui/CasaMain.cs +++ b/c_gui/CasaMain.cs @@ -38,7 +38,12 @@ public class CasaMain #region Glade Widgets [Glade.Widget] - Gtk.Window windowMain; + Gtk.Window windowMain, + windowLog; + + + [Glade.Widget] + Gtk.TreeView tvLog; [Glade.Widget] Gtk.Notebook notebookStores; @@ -96,6 +101,7 @@ public class CasaMain public static CasaTray mCasaTray = null; public static bool m_bShowDebug = false; + public static bool m_bNotifyUser = true; ///####################################################################### @@ -113,37 +119,45 @@ public class CasaMain Application.Init(); - if (args.Length > 0) + try { - if (Common.IsArgSet(args, Common.ARG_DEBUG)) m_bShowDebug = true; - if (Common.IsTrayAvailable() && Common.IsArgSet(args, Common.ARG_SHOW_TRAY_ICON)) - { - mCasaTray = new CasaTray(); - } - else - { - // launch both - if (Common.IsTrayAvailable()) - mCasaTray = new CasaTray(); - new CasaMain(args); - } + // ping micasad + Ping ping = new Ping(); + ping.clientmessage = "Hello micasad"; + MiCasaRequestReply.Send(MiCasaRequestReply.VERB_PING_MICASAD,ping); + + new CasaMain(args); + Application.Run(); + } - else - { - new CasaMain(args); + catch (Exception e) + { + string message = "miCASA services are not available"; + + if (m_bShowDebug) + message = e.ToString(); + + MessageDialog md=new MessageDialog(null,Gtk.DialogFlags.Modal, + Gtk.MessageType.Error, + Gtk.ButtonsType.Close, + message); + + md.Response+=new ResponseHandler(md_ResponseCloseWindow); + md.SetPosition(Gtk.WindowPosition.CenterAlways); + md.Show(); + Application.Run(); } - - - Application.Run(); - + Logger.DbgLog("GUI:CasaMain.Main() - END"); } + + ///####################################################################### /// CONSTRUCTOR @@ -156,7 +170,17 @@ public class CasaMain if( false == Common.CheckForSingleInstance() ) { - MasterPasswordAuthentication(); + MasterPasswordAuthentication(); + + if (Common.IsTrayAvailable()) // && Common.IsArgSet(args, Common.ARG_SHOW_TRAY_ICON)) + { + try + { + if (mCasaTray == null) + mCasaTray = new CasaTray(); + } + catch{} + } } else { @@ -186,7 +210,6 @@ public class CasaMain mmiDebug.Hide(); - windowMain.DeleteEvent += new DeleteEventHandler(OnWindowMainDeleted); /// PLATFORM SPECIFIC GUI CHANGES @@ -250,10 +273,7 @@ public class CasaMain LockGUI(); else UnlockGUI(); - - if (mCasaTray != null) - mmiShowTaskIcon.Active = true; - + windowMain.Show(); Logger.DbgLog("GUI:CasaMain.InitializeGUI() - END"); @@ -1066,27 +1086,6 @@ public class CasaMain dialogPreferences.Destroy(); } - public void on_show_tasktray_icon1_activate(object obj, EventArgs args) - { - if (mmiShowTaskIcon.Active) - { - if (mCasaTray == null) - { - if (IsTraySetForStartup() == false) - PromptUserForStartup(); - - mCasaTray = new CasaTray(this); - } - } - else - { - if (mCasaTray != null) - { - mCasaTray.Destroy(); - mCasaTray = null; - } - } - } private bool IsTraySetForStartup() { @@ -1108,6 +1107,18 @@ public class CasaMain #endif } + + private static void md_ResponseCloseWindow(object o, ResponseArgs args) + { + MessageDialog md = (MessageDialog)o; + if (md != null) + { + md.Destroy(); + Application.Quit(); + } + } + + private void PromptUserForStartup() { // prompt user @@ -1140,8 +1151,6 @@ public class CasaMain #endif // TODO: Set startup script for the user - - } MessageDialog md = (MessageDialog)o; @@ -1170,16 +1179,6 @@ public class CasaMain //StoreDataInterface.RefreshAllStores(); objMiCasa.AggregateStore(); } - - public void on_view_log_file1_activate(object obj, EventArgs args) - { - - } - - public void on_enable_logging1_activate(object obj, EventArgs args) - { - - } ///####################################################################### /// ABOUT @@ -1245,6 +1244,23 @@ public class CasaMain { if (mCasaTray != null) { + if (m_bNotifyUser) + { + // prompt user + MessageDialog md=new MessageDialog(null,Gtk.DialogFlags.Modal, + Gtk.MessageType.Info, + Gtk.ButtonsType.Close, + "CASA Manager will continue to run in the task bar"); + + md.SetPosition(Gtk.WindowPosition.Center); + md.Response +=new ResponseHandler(md_Response); + md.Modal = true; + md.SetIconFromFile(Common.CASAICONS); + md.Show(); + + m_bNotifyUser = false; + } + mCasaTray.CasaManagerQuit(); return; } @@ -1252,6 +1268,8 @@ public class CasaMain Application.Quit(); } + + ///####################################################################### /// WINDOW MAIN FOCUS /// @@ -1259,6 +1277,42 @@ public class CasaMain { windowMain.Present(); } + + ///####################################################################### + /// LOGGING WINDOW operations + /// + + public void on_view_log_file1_activate(object obj, EventArgs args) + { + + } + + public void on_enable_logging1_activate(object obj, EventArgs args) + { + Gtk.CheckMenuItem miLog = (Gtk.CheckMenuItem)obj; + if (miLog.Active) + OpenLogWindow(); + else + CloseLogWindow(); + } + + internal void OpenLogWindow() + { + Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLog", null); + gxmlTemp.Autoconnect (this); + + Gtk.TreeViewColumn col1 = new Gtk.TreeViewColumn("", new Gtk.CellRendererText(), "text", 0); + tvLog.AppendColumn(col1); + Logger.ActivateLogWindow(tvLog); + } + + internal void CloseLogWindow() + { + Logger.StopLogWindow(); + dialogLogin.Dispose(); + dialogLogin.Destroy(); + } + } } ///########################################################################### diff --git a/c_gui/CasaTray.cs b/c_gui/CasaTray.cs index 88268c1c..c4cd0240 100644 --- a/c_gui/CasaTray.cs +++ b/c_gui/CasaTray.cs @@ -253,7 +253,9 @@ namespace Novell.CASA.GUI private void notifyIcon_DoubleClick(object sender, EventArgs e) { - menuLockMiCasa_Activated(sender, e); + + //menuLockMiCasa_Activated(sender, e); + menuLaunchGUI_Activated(sender, e); } private void menuDestroyMiCasa_Activated(object sender, EventArgs e) diff --git a/c_gui/Logger.cs b/c_gui/Logger.cs index 477c4eaa..ad7df952 100644 --- a/c_gui/Logger.cs +++ b/c_gui/Logger.cs @@ -16,12 +16,15 @@ namespace Novell.CASA.GUI using System.IO; using System.Threading; + using Gtk; + class Logger { private static string debugLog = null; private static Stream debugStream= null; private static Mutex dbgmutex = new Mutex(); - + + static Gtk.TreeStore tsLog; static Logger() { @@ -44,6 +47,17 @@ namespace Novell.CASA.GUI #endif } + + public static void ActivateLogWindow(Gtk.TreeView tvLog) + { + tsLog = new TreeStore(typeof(string)); + tvLog.Model = tsLog; + } + + public static void StopLogWindow() + { + tsLog = null; + } public static void logbreak() { @@ -51,14 +65,20 @@ namespace Novell.CASA.GUI Debug.WriteLine(" ") ; Debug.WriteLine("----------------------------------------------------") ; Debug.WriteLine(" ") ; - dbgmutex.ReleaseMutex(); - + dbgmutex.ReleaseMutex(); } // The log format is Time stamp :Component name: Error description public static void DbgLog(string message) - { + { + if (tsLog != null) + { + tsLog.AppendValues(DateTime.Now.ToLongTimeString() + + ":" + + message); + } + #if DEBUG dbgmutex.WaitOne(); @@ -73,6 +93,16 @@ namespace Novell.CASA.GUI public static void ExpLog(string message) { + if (tsLog != null) + { + tsLog.AppendValues(DateTime.Now.ToLongTimeString() + + ": Exception encountered - "); + tsLog.AppendValues(message); + + StackTrace st = new StackTrace(); + tsLog.AppendValues(st.ToString()); + } + #if DEBUG dbgmutex.WaitOne(); diff --git a/c_gui/MiCasa.cs b/c_gui/MiCasa.cs index b3cf6ed4..a9067016 100644 --- a/c_gui/MiCasa.cs +++ b/c_gui/MiCasa.cs @@ -1070,8 +1070,7 @@ public class MiCasa : Store if (m_store == null) m_store = SecretStore.getInstance(); - return m_store; - + return m_store; } diff --git a/c_gui/images/casa-1.5.glade b/c_gui/images/casa-1.5.glade index fa3628ea..9f6c2499 100644 --- a/c_gui/images/casa-1.5.glade +++ b/c_gui/images/casa-1.5.glade @@ -52,7 +52,7 @@ True - + True gtk-new 1 @@ -74,7 +74,7 @@ - + True gtk-new 1 @@ -95,7 +95,7 @@ - + True gtk-new 1 @@ -121,7 +121,7 @@ - + True gtk-refresh 1 @@ -148,7 +148,7 @@ - + True gtk-dialog-authentication 1 @@ -169,7 +169,7 @@ - + True gtk-open 1 @@ -190,7 +190,7 @@ - + True gtk-delete 1 @@ -218,7 +218,7 @@ - + True gtk-quit 1 @@ -254,7 +254,7 @@ - + True gtk-zoom-fit 1 @@ -275,7 +275,7 @@ - + True gtk-jump-to 1 @@ -296,7 +296,7 @@ - + True gtk-copy 1 @@ -324,7 +324,7 @@ - + True gtk-delete 1 @@ -358,7 +358,7 @@ - + True gtk-revert-to-saved 1 @@ -379,7 +379,7 @@ - + True gtk-preferences 1 @@ -391,22 +391,6 @@ - - - - True - - - - - - True - Show Tasktray Icon - True - False - - - @@ -429,7 +413,7 @@ - + True gtk-file 1 @@ -450,7 +434,7 @@ - + True gtk-missing-image 1 @@ -478,27 +462,6 @@ - - - - True - _View Log File - True - - - - - True - gtk-zoom-fit - 1 - 0.5 - 0.5 - 0 - 0 - - - - @@ -521,7 +484,7 @@ - + True gtk-help 1 @@ -548,7 +511,7 @@ - + True gtk-dialog-info 1 @@ -6351,4 +6314,83 @@ by cilcking the Close button. + + True + dialog1 + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 300 + 300 + True + True + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + True + -7 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + + + + + 0 + True + True + + + + + + diff --git a/c_gui/images/casa-1.5.gladep b/c_gui/images/casa-1.5.gladep index 878e6aa2..c88efd46 100644 --- a/c_gui/images/casa-1.5.gladep +++ b/c_gui/images/casa-1.5.gladep @@ -1,9 +1,9 @@ - - - - - Casa-1.5 - casa-1.5 - - FALSE - + + + + + Casa-1.5 + casa-1.5 + + FALSE +