Finalize GUI behavior

This commit is contained in:
Jim Norman 2005-10-31 20:24:36 +00:00
parent 727b4e6edf
commit 4df26f8574
7 changed files with 263 additions and 136 deletions

View File

@ -94,11 +94,6 @@
Project = "{57CD94A2-5B4A-40C3-8189-CB760FB78357}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "Novell.CASA.miCASAWrapper"
Project = "{E21DD887-22F4-4935-9851-409715F663B0}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "atk-sharp"
AssemblyName = "atk-sharp"
@ -139,6 +134,11 @@
AssemblyName = "System.Drawing"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"
/>
<Reference
Name = "Novell.CASA.miCASAWrapper"
Project = "{E21DD887-22F4-4935-9851-409715F663B0}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
</References>
</Build>
<Files>

View File

@ -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();
}
}
}
///###########################################################################

View File

@ -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)

View File

@ -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();

View File

@ -1070,8 +1070,7 @@ public class MiCasa : Store
if (m_store == null)
m_store = SecretStore.getInstance();
return m_store;
return m_store;
}

View File

@ -52,7 +52,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image2536">
<widget class="GtkImage" id="image2646">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -74,7 +74,7 @@
<signal name="activate" handler="OnNewSecretActivated" last_modification_time="Tue, 27 Sep 2005 06:02:26 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2537">
<widget class="GtkImage" id="image2647">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -95,7 +95,7 @@
<signal name="activate" handler="OnNewKeyActivated" last_modification_time="Tue, 27 Sep 2005 06:02:36 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2538">
<widget class="GtkImage" id="image2648">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -121,7 +121,7 @@
<accelerator key="F5" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image2539">
<widget class="GtkImage" id="image2649">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@ -148,7 +148,7 @@
<signal name="activate" handler="OnLockMiCASASecrets" last_modification_time="Mon, 10 Oct 2005 19:51:54 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2540">
<widget class="GtkImage" id="image2650">
<property name="visible">True</property>
<property name="stock">gtk-dialog-authentication</property>
<property name="icon_size">1</property>
@ -169,7 +169,7 @@
<signal name="activate" handler="OnUnLockMiCASASecrets" last_modification_time="Tue, 11 Oct 2005 20:12:35 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2541">
<widget class="GtkImage" id="image2651">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
@ -190,7 +190,7 @@
<signal name="activate" handler="OnDestroyMiCASASecrets" last_modification_time="Tue, 11 Oct 2005 20:12:35 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2542">
<widget class="GtkImage" id="image2652">
<property name="visible">True</property>
<property name="stock">gtk-delete</property>
<property name="icon_size">1</property>
@ -218,7 +218,7 @@
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image2543">
<widget class="GtkImage" id="image2653">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
@ -254,7 +254,7 @@
<accelerator key="F2" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image2544">
<widget class="GtkImage" id="image2654">
<property name="visible">True</property>
<property name="stock">gtk-zoom-fit</property>
<property name="icon_size">1</property>
@ -275,7 +275,7 @@
<signal name="activate" handler="LinkKeyValue" last_modification_time="Fri, 19 Aug 2005 06:23:15 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2545">
<widget class="GtkImage" id="image2655">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
@ -296,7 +296,7 @@
<signal name="activate" handler="CopyKeyValue" last_modification_time="Fri, 19 Aug 2005 06:23:15 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2546">
<widget class="GtkImage" id="image2656">
<property name="visible">True</property>
<property name="stock">gtk-copy</property>
<property name="icon_size">1</property>
@ -324,7 +324,7 @@
<accelerator key="Delete" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image2547">
<widget class="GtkImage" id="image2657">
<property name="visible">True</property>
<property name="stock">gtk-delete</property>
<property name="icon_size">1</property>
@ -358,7 +358,7 @@
<signal name="activate" handler="PersistentStorage" last_modification_time="Fri, 19 Aug 2005 06:40:17 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2548">
<widget class="GtkImage" id="image2658">
<property name="visible">True</property>
<property name="stock">gtk-revert-to-saved</property>
<property name="icon_size">1</property>
@ -379,7 +379,7 @@
<signal name="activate" handler="Preferences" last_modification_time="Fri, 19 Aug 2005 06:40:17 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2549">
<widget class="GtkImage" id="image2659">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
@ -391,22 +391,6 @@
</child>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator6">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="mmiShowTaskIcon">
<property name="visible">True</property>
<property name="label" translatable="yes">Show Tasktray Icon</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_show_tasktray_icon1_activate" last_modification_time="Thu, 13 Oct 2005 15:10:40 GMT"/>
</widget>
</child>
</widget>
</child>
</widget>
@ -429,7 +413,7 @@
<signal name="activate" handler="on_create_sample_secrets1_activate" last_modification_time="Fri, 30 Sep 2005 12:58:41 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2550">
<widget class="GtkImage" id="image2660">
<property name="visible">True</property>
<property name="stock">gtk-file</property>
<property name="icon_size">1</property>
@ -450,7 +434,7 @@
<signal name="activate" handler="on_remove_test_secrets1_activate" last_modification_time="Fri, 30 Sep 2005 12:59:05 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2551">
<widget class="GtkImage" id="image2661">
<property name="visible">True</property>
<property name="stock">gtk-missing-image</property>
<property name="icon_size">1</property>
@ -478,27 +462,6 @@
<signal name="activate" handler="on_enable_logging1_activate" last_modification_time="Fri, 30 Sep 2005 12:59:23 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="view_log_file1">
<property name="visible">True</property>
<property name="label" translatable="yes">_View Log File</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_view_log_file1_activate" last_modification_time="Fri, 30 Sep 2005 12:59:41 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2552">
<property name="visible">True</property>
<property name="stock">gtk-zoom-fit</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
@ -521,7 +484,7 @@
<accelerator key="F1" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image2553">
<widget class="GtkImage" id="image2662">
<property name="visible">True</property>
<property name="stock">gtk-help</property>
<property name="icon_size">1</property>
@ -548,7 +511,7 @@
<signal name="activate" handler="About" last_modification_time="Thu, 01 Sep 2005 15:30:28 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2554">
<widget class="GtkImage" id="image2663">
<property name="visible">True</property>
<property name="stock">gtk-dialog-info</property>
<property name="icon_size">1</property>
@ -6351,4 +6314,83 @@ by cilcking the Close button.</property>
</child>
</widget>
<widget class="GtkDialog" id="dialogLog">
<property name="visible">True</property>
<property name="title" translatable="yes">dialog1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="default_width">300</property>
<property name="default_height">300</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">True</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox8">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area8">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="closebutton1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-7</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow64">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="tvLog">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -1,9 +1,9 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
<glade-project>
<name>Casa-1.5</name>
<program_name>casa-1.5</program_name>
<pixmaps_directory></pixmaps_directory>
<gnome_support>FALSE</gnome_support>
</glade-project>
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
<glade-project>
<name>Casa-1.5</name>
<program_name>casa-1.5</program_name>
<pixmaps_directory></pixmaps_directory>
<gnome_support>FALSE</gnome_support>
</glade-project>