From 22c4b384b827d0cb1c33b693a35414da9e37b0e6 Mon Sep 17 00:00:00 2001 From: Jim Norman Date: Mon, 9 Jan 2006 18:55:50 +0000 Subject: [PATCH] Bug 141924. Refresh secrets after unlock. Additional GUI behavior fixes. --- c_adlib/AD_Facade.cs | 8 ++++ c_gui/CasaMain.cs | 98 +++++++++++++++++++++++++++++--------------- c_gui/CasaTray.cs | 16 +++++++- 3 files changed, 87 insertions(+), 35 deletions(-) diff --git a/c_adlib/AD_Facade.cs b/c_adlib/AD_Facade.cs index 6933e0f2..4f9aef2e 100644 --- a/c_adlib/AD_Facade.cs +++ b/c_adlib/AD_Facade.cs @@ -27,8 +27,10 @@ namespace Novell.CASA.DataEngines { // Always Aggregate miCASA. micasaengine = new miCASAEngine(); +#if LINUX kwEngine = new KWalletEngine(); gkEngine = new GKEngine(); +#endif /* // Reading Policy to see what else needs to be Aggregated. @@ -191,10 +193,12 @@ namespace Novell.CASA.DataEngines { if (StoreID == ConstStrings.CASA_STORE_MICASA) return micasaengine.SetSecret(secret, opnType); +#if LINUX if (StoreID == ConstStrings.CASA_STORE_KWALLET) return kwEngine.SetSecret(secret, opnType); if (StoreID == ConstStrings.CASA_STORE_GK) return gkEngine.SetSecret(secret, opnType); +#endif else { #if LINUX @@ -238,10 +242,12 @@ namespace Novell.CASA.DataEngines { if (StoreID == ConstStrings.CASA_STORE_MICASA) return micasaengine.SetSecret(secret); +#if LINUX if (StoreID == ConstStrings.CASA_STORE_KWALLET) return kwEngine.SetSecret(secret); if (StoreID == ConstStrings.CASA_STORE_GK) return gkEngine.SetSecret(secret); +#endif else { #if LINUX @@ -297,10 +303,12 @@ namespace Novell.CASA.DataEngines if (StoreID == ConstStrings.CASA_STORE_MICASA) return micasaengine.Remove(secret); +#if LINUX if (StoreID == ConstStrings.CASA_STORE_KWALLET) return kwEngine.Remove(secret); if (StoreID == ConstStrings.CASA_STORE_GK) return gkEngine.Remove(secret); +#endif return -1; } diff --git a/c_gui/CasaMain.cs b/c_gui/CasaMain.cs index fc9b728d..4038c528 100644 --- a/c_gui/CasaMain.cs +++ b/c_gui/CasaMain.cs @@ -49,24 +49,24 @@ namespace Novell.CASA.GUI [Glade.Widget] Gtk.Dialog dialogPersistentStorage, - dialogPreferences, - dialogAbout, - dialogLogin, - dialogLoginContinue, - dialogConfirmRefresh, - dialogSingleInstance, - dialogLoginReprompt, - dialogShortPassword, - dialogResetMP; + dialogPreferences, + dialogAbout, + dialogLogin, + dialogLoginContinue, + dialogConfirmRefresh, + dialogSingleInstance, + dialogLoginReprompt, + dialogShortPassword, + dialogResetMP; [Glade.Widget] Gtk.Entry entryMasterPassword1, - entryMasterPassword2, - entryMasterPassword3, - entryMasterPassword4, - entryOldMP, - entryNewMP1, - entryNewMP2; + entryMasterPassword2, + entryMasterPassword3, + entryMasterPassword4, + entryOldMP, + entryNewMP1, + entryNewMP2; [Glade.Widget] Gtk.CheckButton checkbuttonFirefox, @@ -99,7 +99,7 @@ namespace Novell.CASA.GUI [Glade.Widget] - #endregion + #endregion public static CasaTray mCasaTray = null; @@ -181,7 +181,7 @@ namespace Novell.CASA.GUI try { if (mCasaTray == null) - mCasaTray = new CasaTray(); + mCasaTray = new CasaTray(this); } catch{} } @@ -672,20 +672,7 @@ namespace Novell.CASA.GUI { Logger.DbgLog("GUI:CasaMain.on_buttonRefreshYes_clicked() - BEGIN"); - if( Common.IS_MICASA ) - objMiCasa.AggregateStore(); - - if( Common.IS_FIREFOX ) - objFirefox.AggregateStore(); - - if( Common.IS_MOZILLA ) - objMozilla.AggregateStore(); - - if( Common.IS_KDEWALLET ) - objKdeWallet.AggregateStore(); - - if( Common.IS_GNOMEKEYRING ) - objGnomeKeyring.AggregateStore(); + RefreshStores(); dialogConfirmRefresh.Destroy(); @@ -713,7 +700,7 @@ namespace Novell.CASA.GUI { Logger.DbgLog("GUI:CasaMain.QuitApplication() - BEGIN"); - windowMain.Destroy(); + //windowMain.Destroy(); HandleQuit(); Logger.DbgLog("GUI:CasaMain.QuitApplication() - END"); @@ -828,6 +815,8 @@ namespace Novell.CASA.GUI mmiUnlockSecrets.Sensitive = true; mmiDestroySecrets.Sensitive = false; notebookStores.Sensitive = false; + + mmiNew.Sensitive = false; mmiRefresh.Sensitive = false; mmiDebug.Sensitive = false; @@ -840,11 +829,16 @@ namespace Novell.CASA.GUI mmiLockSecrets.Sensitive = true; mmiUnlockSecrets.Sensitive = false; mmiDestroySecrets.Sensitive = true; - notebookStores.Sensitive = true; + notebookStores.Sensitive = true; + mmiRefresh.Sensitive = true; mmiDebug.Sensitive = true; mmiOptions.Sensitive = true; mmiEdit.Sensitive = true; + + //refresh secrets + RefreshStores(); + } @@ -1353,8 +1347,9 @@ namespace Novell.CASA.GUI { Logger.DbgLog("GUI:CasaMain.OnWindowMainDeleted() - BEGIN"); - windowMain.Destroy(); + //windowMain.Destroy(); HandleQuit(); + //Gtk.Application.Quit (); args.RetVal = true; @@ -1399,6 +1394,41 @@ namespace Novell.CASA.GUI windowMain.Present(); } + internal void Hide() + { + windowMain.Visible = false; + } + + internal void Show() + { + RefreshStores(); + windowMain.Visible = true; + } + + internal void Dispose() + { + windowMain.Destroy(); + } + + internal void RefreshStores() + { + if( Common.IS_MICASA ) + objMiCasa.AggregateStore(); + + if( Common.IS_FIREFOX ) + objFirefox.AggregateStore(); + + if( Common.IS_MOZILLA ) + objMozilla.AggregateStore(); + + if( Common.IS_KDEWALLET ) + objKdeWallet.AggregateStore(); + + if( Common.IS_GNOMEKEYRING ) + objGnomeKeyring.AggregateStore(); + + } + ///####################################################################### /// LOGGING WINDOW operations /// diff --git a/c_gui/CasaTray.cs b/c_gui/CasaTray.cs index 5394ed41..07fe3304 100644 --- a/c_gui/CasaTray.cs +++ b/c_gui/CasaTray.cs @@ -201,6 +201,10 @@ namespace Novell.CASA.GUI { ShowContextMenu(); } + if (args.Event.Button == 1) + { + menuLaunchGUI_Activated(null, null); + } } private void OnPopupClick(object o, EventArgs args) { @@ -221,7 +225,9 @@ namespace Novell.CASA.GUI public void CasaManagerQuit() { - mCasaMain = null; + //mCasaMain = null; + if (mCasaMain != null) + mCasaMain.Hide(); } private void menuLaunchGUI_Activated(object sender, EventArgs e) @@ -230,7 +236,10 @@ namespace Novell.CASA.GUI if (mCasaMain == null) mCasaMain = new CasaMain(null); else + { + mCasaMain.Show(); mCasaMain.Focus(); + } } private void menuLockMiCasa_Activated(object sender, EventArgs e) @@ -297,6 +306,10 @@ namespace Novell.CASA.GUI internal void Destroy() { + + if (mCasaMain != null) + mCasaMain.Dispose(); + #if W32 notifyIcon.Dispose(); #endif @@ -304,6 +317,7 @@ namespace Novell.CASA.GUI // Does not work icon.Dispose(); #endif + Application.Quit(); } }