diff --git a/CASA/gui/CasaMain.cs b/CASA/gui/CasaMain.cs index bb98d041..b6f41202 100644 --- a/CASA/gui/CasaMain.cs +++ b/CASA/gui/CasaMain.cs @@ -115,6 +115,8 @@ namespace Novell.CASA.GUI [Glade.Widget] Gtk.MenuItem mmiNew, mmiNewKey, + mmiImportSecrets, + mmiExportSecrets, mmiView, mmiLink, mmiCopy, @@ -305,7 +307,7 @@ namespace Novell.CASA.GUI if( Common.IS_MICASA ) { Logger.DbgLog("GUI:CasaMain.new MiCasa()."); - objMiCasa = new MiCasa(); + objMiCasa = new MiCasa(config); } else (notebookStores.GetNthPage(Common.STORE_MICASA)).Visible = Common.IS_MICASA; @@ -313,7 +315,7 @@ namespace Novell.CASA.GUI if( Common.IS_FIREFOX ) { Logger.DbgLog("GUI:CasaMain.new Firefox()."); - objFirefox = new Firefox(); + objFirefox = new Firefox(config); } else (notebookStores.GetNthPage(Common.STORE_FIREFOX)).Visible = Common.IS_FIREFOX; @@ -329,7 +331,7 @@ namespace Novell.CASA.GUI if( Common.IS_KDEWALLET ) { Logger.DbgLog("GUI:CasaMain.new KdeWallet()."); - objKdeWallet = new KdeWallet(); + objKdeWallet = new KdeWallet(config); } else (notebookStores.GetNthPage(Common.STORE_KDEWALLET)).Visible = Common.IS_KDEWALLET; @@ -337,7 +339,7 @@ namespace Novell.CASA.GUI if( Common.IS_GNOMEKEYRING ) { Logger.DbgLog("GUI:CasaMain.new GnomeKeyring()."); - objGnomeKeyring = new GnomeKeyring(); + objGnomeKeyring = new GnomeKeyring(config); } else (notebookStores.GetNthPage(Common.STORE_GNOMEKEYRING)).Visible = Common.IS_GNOMEKEYRING; @@ -1264,6 +1266,9 @@ namespace Novell.CASA.GUI mmiDebug.Sensitive = false; mmiOptions.Sensitive = false; mmiEdit.Sensitive = false; + mmiImportSecrets.Sensitive = false; + mmiExportSecrets.Sensitive = false; + m_bGuiLocked = true; @@ -1280,6 +1285,10 @@ namespace Novell.CASA.GUI mmiDebug.Sensitive = true; mmiOptions.Sensitive = true; mmiEdit.Sensitive = true; + mmiImportSecrets.Sensitive = true; + mmiExportSecrets.Sensitive = true; + + m_bGuiLocked = false; //refresh secrets @@ -1707,7 +1716,7 @@ namespace Novell.CASA.GUI if(Common.IS_FIREFOX) { if( null == objFirefox ) - objFirefox = new Firefox(); + objFirefox = new Firefox(config); //objFirefox.AggregateStore(); notebookStores.GetNthPage(Common.STORE_FIREFOX).Visible = true; StorePolicyInterface.SetAggregationPolicy(Common.STORE_FIREFOX, true, storeID, 1); @@ -1739,7 +1748,7 @@ namespace Novell.CASA.GUI if(Common.IS_KDEWALLET) { if( null == objKdeWallet ) - objKdeWallet = new KdeWallet(); + objKdeWallet = new KdeWallet(config); //objKdeWallet.AggregateStore(); notebookStores.GetNthPage(Common.STORE_KDEWALLET).Visible = true; StorePolicyInterface.SetAggregationPolicy(Common.STORE_KDEWALLET, true, storeID, 1); @@ -1755,7 +1764,7 @@ namespace Novell.CASA.GUI if(Common.IS_GNOMEKEYRING) { if( null == objGnomeKeyring ) - objGnomeKeyring = new GnomeKeyring(); + objGnomeKeyring = new GnomeKeyring(config); //objGnomeKeyring.AggregateStore(); notebookStores.GetNthPage(Common.STORE_GNOMEKEYRING).Visible = true; StorePolicyInterface.SetAggregationPolicy(Common.STORE_GNOMEKEYRING, true, storeID, 1); diff --git a/CASA/gui/Firefox.cs b/CASA/gui/Firefox.cs index e902c39d..3a884fcf 100644 --- a/CASA/gui/Firefox.cs +++ b/CASA/gui/Firefox.cs @@ -41,6 +41,9 @@ public class Firefox : Store public bool IS_STORE_AGGREGATED = false; + private int m_iRememberSeconds = 5; + private String m_sRememberFor = "5"; + private Config m_config = null; #region Glade Widgets [Glade.Widget] @@ -89,6 +92,12 @@ public class Firefox : Store cmiLink, cmiCopy; + [Glade.Widget] + Gtk.Label labelRememberFor, + labelSeconds; + + [Glade.Widget] + Gtk.SpinButton spinbuttonRememberFor; #endregion ///####################################################################### @@ -96,10 +105,11 @@ public class Firefox : Store /// /// /// - public Firefox() + public Firefox(Config config) { Logger.DbgLog("GUI:Firefox.Firefox() - BEGIN"); + m_config = config; /// SecretID TreeStore tvSecretIDFirefox = (Gtk.TreeView)CasaMain.gxmlMain.GetWidget("tvSecretIDFirefox"); tsSecretIDFirefox = new TreeStore(typeof(string), typeof(string[]), typeof(string[]), typeof(string), typeof(string[]), typeof(string[])); @@ -397,9 +407,23 @@ public class Firefox : Store { TreeViewColumn tvCol; - if( tvKeyValue.Model.IterNChildren() > 0 ) - if( true == cbuttonShowPassword.Active) - { + if (tvKeyValue.Model.IterNChildren() > 0) + { + if ((true == cbuttonShowPassword.Active) + && (CommonGUI.GetRememberMPUntil().CompareTo(DateTime.Now) > 0)) + { + // set and start the timer if needed + TimeSpan ts = CommonGUI.GetRememberMPUntil().Subtract(DateTime.Now); + m_iRememberSeconds = ts.Seconds; + StartRememberTimer(); + + // display the values + tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1)); + tvCol = new TreeViewColumn("Value", cellEditable, "text", 1); + tvKeyValue.InsertColumn(tvCol, 1); + } + else if (true == cbuttonShowPassword.Active) + { Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null); gxmlTemp.Autoconnect (this); dialogLogin.TransientFor = dialogManageSecret; @@ -409,6 +433,10 @@ public class Firefox : Store entryMasterPassword3.HasFocus = true; label88.Hide(); entryMasterPassword4.Hide(); + labelRememberFor.Visible = true; + labelSeconds.Visible = true; + spinbuttonRememberFor.Visible = true; + spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor); dialogLogin.Show(); } else @@ -417,7 +445,7 @@ public class Firefox : Store tvCol = new TreeViewColumn("Value", cellEditable, "text", 2); tvKeyValue.InsertColumn(tvCol, 1); } - + } } public void okbuttonLogin_clicked(object abj, EventArgs args) @@ -431,7 +459,25 @@ public class Firefox : Store tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1)); tvCol = new TreeViewColumn("Value", cellEditable, "text", 1); tvKeyValue.InsertColumn(tvCol, 1); + // get seconds to remember + m_sRememberFor = spinbuttonRememberFor.Text; + if (m_sRememberFor != null) + { + DateTime dtNow = DateTime.Now; + m_iRememberSeconds = int.Parse(m_sRememberFor); + CommonGUI.SetRememberMPUntil(dtNow.AddSeconds(m_iRememberSeconds)); + } + + // save off remember time if user changed it + string sSaveTimed = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, "5"); + if (!sSaveTimed.Equals(m_sRememberFor)) + { + m_config.SetConfigSetting(CommonGUI.REMEMBER_SETTING,m_sRememberFor); + m_config.WriteConfig(); + } dialogLogin.Destroy(); + if (m_iRememberSeconds > 0) + StartRememberTimer(); } else { @@ -460,6 +506,35 @@ public class Firefox : Store dialogLogin.Destroy(); args.RetVal = true; } + + private bool bTimerActive = false; + public void StartRememberTimer() + { + if (!bTimerActive) + { + GLib.Timeout.Add ((uint)(m_iRememberSeconds * 1000), new GLib.TimeoutHandler (update_gui)); + bTimerActive = true; + } + } + + private bool update_gui() + { + TreeViewColumn tvCol; + try + { + tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1)); + tvCol = new TreeViewColumn("Value", cellEditable, "text", 2); + tvKeyValue.InsertColumn(tvCol, 1); + cbuttonShowPassword.Active = false; + } + catch (Exception e) + { + //Console.WriteLine(e.ToString()); + } + bTimerActive = false; + + return false; + } public void on_helpbuttonAuthentication_clicked(object obj, EventArgs args) { diff --git a/CASA/gui/GnomeKeyring.cs b/CASA/gui/GnomeKeyring.cs index 545e0937..ed655931 100644 --- a/CASA/gui/GnomeKeyring.cs +++ b/CASA/gui/GnomeKeyring.cs @@ -48,6 +48,9 @@ public class GnomeKeyring : Store string[] stringNetworkManagerServerType = new string[]{ "SSH", "FTP (with login)", "Windows share" }; + private int m_iRememberSeconds = 5; + private String m_sRememberFor = "5"; + private Config m_config = null; #region Glade Widgets @@ -107,6 +110,12 @@ public class GnomeKeyring : Store [Glade.Widget] Combo comboNetworkManager; + [Glade.Widget] + Gtk.Label labelRememberFor, + labelSeconds; + + [Glade.Widget] + Gtk.SpinButton spinbuttonRememberFor; #endregion @@ -117,7 +126,7 @@ public class GnomeKeyring : Store /// /// /// - public GnomeKeyring() + public GnomeKeyring(Config config) { Logger.DbgLog("GUI:GnomeKeyring.GnomeKeyring() - BEGIN"); @@ -138,6 +147,8 @@ public class GnomeKeyring : Store tvNativeInfoGnomeKeyring.ModifyBase(StateType.Normal,new Gdk.Color(0xff,0xff,0xe6)); /// Aggregate the store //AggregateStore(); + + m_config = config; Logger.DbgLog("GUI:GnomeKeyring.GnomeKeyring() - END"); } @@ -469,9 +480,23 @@ public class GnomeKeyring : Store { TreeViewColumn tvCol; - if( tvKeyValue.Model.IterNChildren() > 0 ) - if( true == cbuttonShowPassword.Active) - { + if (tvKeyValue.Model.IterNChildren() > 0) + { + if ((true == cbuttonShowPassword.Active) + && (CommonGUI.GetRememberMPUntil().CompareTo(DateTime.Now) > 0)) + { + // set and start the timer if needed + TimeSpan ts = CommonGUI.GetRememberMPUntil().Subtract(DateTime.Now); + m_iRememberSeconds = ts.Seconds; + StartRememberTimer(); + + // display the values + tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1)); + tvCol = new TreeViewColumn("Value", cellEditable, "text", 1); + tvKeyValue.InsertColumn(tvCol, 1); + } + else if (true == cbuttonShowPassword.Active) + { Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null); gxmlTemp.Autoconnect (this); dialogLogin.TransientFor = dialogManageSecret; @@ -481,6 +506,10 @@ public class GnomeKeyring : Store entryMasterPassword3.HasFocus = true; label88.Hide(); entryMasterPassword4.Hide(); + labelRememberFor.Visible = true; + labelSeconds.Visible = true; + spinbuttonRememberFor.Visible = true; + spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor); dialogLogin.Show(); } else @@ -489,7 +518,7 @@ public class GnomeKeyring : Store tvCol = new TreeViewColumn("Value", cellEditable, "text", 2); tvKeyValue.InsertColumn(tvCol, 1); } - + } } public void okbuttonLogin_clicked(object abj, EventArgs args) @@ -503,7 +532,25 @@ public class GnomeKeyring : Store tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1)); tvCol = new TreeViewColumn("Value", cellEditable, "text", 1); tvKeyValue.InsertColumn(tvCol, 1); + // get seconds to remember + m_sRememberFor = spinbuttonRememberFor.Text; + if (m_sRememberFor != null) + { + DateTime dtNow = DateTime.Now; + m_iRememberSeconds = int.Parse(m_sRememberFor); + CommonGUI.SetRememberMPUntil(dtNow.AddSeconds(m_iRememberSeconds)); + } + + // save off remember time if user changed it + string sSaveTimed = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, "5"); + if (!sSaveTimed.Equals(m_sRememberFor)) + { + m_config.SetConfigSetting(CommonGUI.REMEMBER_SETTING,m_sRememberFor); + m_config.WriteConfig(); + } dialogLogin.Destroy(); + if (m_iRememberSeconds > 0) + StartRememberTimer(); } else { @@ -533,6 +580,35 @@ public class GnomeKeyring : Store dialogLogin.Destroy(); args.RetVal = true; } + + private bool bTimerActive = false; + public void StartRememberTimer() + { + if (!bTimerActive) + { + GLib.Timeout.Add ((uint)(m_iRememberSeconds * 1000), new GLib.TimeoutHandler (update_gui)); + bTimerActive = true; + } + } + + private bool update_gui() + { + TreeViewColumn tvCol; + try + { + tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1)); + tvCol = new TreeViewColumn("Value", cellEditable, "text", 2); + tvKeyValue.InsertColumn(tvCol, 1); + cbuttonShowPassword.Active = false; + } + catch (Exception e) + { + //Console.WriteLine(e.ToString()); + } + bTimerActive = false; + + return false; + } public void on_entryMasterPassword3_activate(object obj, EventArgs args) { diff --git a/CASA/gui/KdeWallet.cs b/CASA/gui/KdeWallet.cs index c4e7e09c..6969ce68 100644 --- a/CASA/gui/KdeWallet.cs +++ b/CASA/gui/KdeWallet.cs @@ -53,6 +53,9 @@ public class KdeWallet : Store "Gmail (gmail.com)", "Yahoo! Mail (mail.yahoo.com)", "MSN Hotmail (hotmail.com)"}; + private int m_iRememberSeconds = 5; + private String m_sRememberFor = "5"; + private Config m_config = null; #region Glade Widgets @@ -104,6 +107,12 @@ public class KdeWallet : Store cmiView, cmiLink, cmiCopy; + [Glade.Widget] + Gtk.Label labelRememberFor, + labelSeconds; + + [Glade.Widget] + Gtk.SpinButton spinbuttonRememberFor; [Glade.Widget] Gtk.Combo comboKonquererTemplates; @@ -116,7 +125,7 @@ public class KdeWallet : Store /// /// /// - public KdeWallet() + public KdeWallet(Config config) { Logger.DbgLog("GUI:KdeWallet.KdeWallet() - BEGIN"); @@ -137,6 +146,7 @@ public class KdeWallet : Store tvNativeInfoKdeWallet.ModifyBase(StateType.Normal,new Gdk.Color(0xff,0xff,0xe6)); /// Aggregate the store //AggregateStore(); + m_config = config; Logger.DbgLog("GUI:KdeWallet.KdeWallet() - END"); } @@ -470,27 +480,45 @@ public class KdeWallet : Store { TreeViewColumn tvCol; - if( tvKeyValue.Model.IterNChildren() > 0 ) - if( true == cbuttonShowPassword.Active) + if (tvKeyValue.Model.IterNChildren() > 0) { - Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null); - gxmlTemp.Autoconnect (this); - dialogLogin.TransientFor = dialogManageSecret; + if ((true == cbuttonShowPassword.Active) + && (CommonGUI.GetRememberMPUntil().CompareTo(DateTime.Now) > 0)) + { + // set and start the timer if needed + TimeSpan ts = CommonGUI.GetRememberMPUntil().Subtract(DateTime.Now); + m_iRememberSeconds = ts.Seconds; + StartRememberTimer(); + + // display the values + tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1)); + tvCol = new TreeViewColumn("Value", cellEditable, "text", 1); + tvKeyValue.InsertColumn(tvCol, 1); + } + else if (true == cbuttonShowPassword.Active) + { + Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null); + gxmlTemp.Autoconnect (this); + dialogLogin.TransientFor = dialogManageSecret; - label86.Text = "Enter your Master Password to view passwords"; - entryMasterPassword3.Text=""; - entryMasterPassword3.HasFocus = true; - label88.Hide(); - entryMasterPassword4.Hide(); - dialogLogin.Show(); + label86.Text = "Enter your Master Password to view passwords"; + entryMasterPassword3.Text=""; + entryMasterPassword3.HasFocus = true; + label88.Hide(); + entryMasterPassword4.Hide(); + labelRememberFor.Visible = true; + labelSeconds.Visible = true; + spinbuttonRememberFor.Visible = true; + spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor); + dialogLogin.Show(); + } + else + { + tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1)); + tvCol = new TreeViewColumn("Value", cellEditable, "text", 2); + tvKeyValue.InsertColumn(tvCol, 1); + } } - else - { - tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1)); - tvCol = new TreeViewColumn("Value", cellEditable, "text", 2); - tvKeyValue.InsertColumn(tvCol, 1); - } - } public void okbuttonLogin_clicked(object abj, EventArgs args) @@ -504,7 +532,25 @@ public class KdeWallet : Store tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1)); tvCol = new TreeViewColumn("Value", cellEditable, "text", 1); tvKeyValue.InsertColumn(tvCol, 1); + // get seconds to remember + m_sRememberFor = spinbuttonRememberFor.Text; + if (m_sRememberFor != null) + { + DateTime dtNow = DateTime.Now; + m_iRememberSeconds = int.Parse(m_sRememberFor); + CommonGUI.SetRememberMPUntil(dtNow.AddSeconds(m_iRememberSeconds)); + } + + // save off remember time if user changed it + string sSaveTimed = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, "5"); + if (!sSaveTimed.Equals(m_sRememberFor)) + { + m_config.SetConfigSetting(CommonGUI.REMEMBER_SETTING,m_sRememberFor); + m_config.WriteConfig(); + } dialogLogin.Destroy(); + if (m_iRememberSeconds > 0) + StartRememberTimer(); } else { @@ -534,6 +580,35 @@ public class KdeWallet : Store dialogLogin.Destroy(); args.RetVal = true; } + + private bool bTimerActive = false; + public void StartRememberTimer() + { + if (!bTimerActive) + { + GLib.Timeout.Add ((uint)(m_iRememberSeconds * 1000), new GLib.TimeoutHandler (update_gui)); + bTimerActive = true; + } + } + + private bool update_gui() + { + TreeViewColumn tvCol; + try + { + tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1)); + tvCol = new TreeViewColumn("Value", cellEditable, "text", 2); + tvKeyValue.InsertColumn(tvCol, 1); + cbuttonShowPassword.Active = false; + } + catch (Exception e) + { + //Console.WriteLine(e.ToString()); + } + bTimerActive = false; + + return false; + } public void on_entryMasterPassword3_activate(object obj, EventArgs args) { diff --git a/CASA/gui/MiCasa.cs b/CASA/gui/MiCasa.cs index 645b786f..2e0e0f62 100644 --- a/CASA/gui/MiCasa.cs +++ b/CASA/gui/MiCasa.cs @@ -48,11 +48,12 @@ public class MiCasa : Store ArrayList arrDeletedKeys = null; private SecretStore m_store = null; - private String m_sRememberFor = "5"; - private DateTime m_dtRememberMPUntil = DateTime.Now; - private Thread m_tRememberTimer = null; - private int m_iRememberSeconds = 5; - + + private int m_iRememberSeconds = 5; + private String m_sRememberFor = "5"; + + + private Config m_config = null; #region Glade Widgets [Glade.Widget] @@ -121,10 +122,12 @@ public class MiCasa : Store /// /// /// - public MiCasa() + public MiCasa(Config config) { Logger.DbgLog("GUI:MiCasa.MiCasa() - BEGIN"); + m_config = config; + /// SecretID TreeStore tvSecretIDMiCasa = (Gtk.TreeView)CasaMain.gxmlMain.GetWidget("tvSecretIDMiCasa"); tsSecretIDMiCasa = new TreeStore(typeof(string), typeof(string[]), typeof(string[]), typeof(string), typeof(string[]), typeof(string[])); @@ -142,8 +145,7 @@ public class MiCasa : Store tvNativeInfoMiCasa.Model = tsNativeInfoMiCasa; tvNativeInfoMiCasa.ModifyBase(StateType.Normal,new Gdk.Color(0xff,0xff,0xe6)); /// Aggregate the store - AggregateStore(); - + AggregateStore(); Logger.DbgLog("GUI:MiCasa.MiCasa() - END"); } @@ -499,9 +501,15 @@ public class MiCasa : Store if (tvKeyValue.Model.IterNChildren() > 0) { + if ((true == cbuttonShowPassword.Active) + && (CommonGUI.GetRememberMPUntil().CompareTo(DateTime.Now) > 0)) + { + // set and start the timer if needed + TimeSpan ts = CommonGUI.GetRememberMPUntil().Subtract(DateTime.Now); + m_iRememberSeconds = ts.Seconds; + StartRememberTimer(); - if ((true == cbuttonShowPassword.Active) && (m_dtRememberMPUntil.CompareTo(DateTime.Now) > 0)) - { + // display the values tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1)); tvCol = new TreeViewColumn("Value", cellEditable, "text", 1); tvKeyValue.InsertColumn(tvCol, 1); @@ -523,8 +531,8 @@ public class MiCasa : Store labelRememberFor.Visible = true; labelSeconds.Visible = true; spinbuttonRememberFor.Visible = true; - spinbuttonRememberFor.Text = m_sRememberFor; - + spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor); + dialogLogin.Show(); } else @@ -548,16 +556,23 @@ public class MiCasa : Store tvCol = new TreeViewColumn("Value", cellEditable, "text", 1); tvKeyValue.InsertColumn(tvCol, 1); - // get seconds to remember - + // get seconds to remember m_sRememberFor = spinbuttonRememberFor.Text; if (m_sRememberFor != null) { DateTime dtNow = DateTime.Now; m_iRememberSeconds = int.Parse(m_sRememberFor); - m_dtRememberMPUntil = dtNow.AddSeconds(m_iRememberSeconds); + CommonGUI.SetRememberMPUntil(dtNow.AddSeconds(m_iRememberSeconds)); } - + + // save off remember time if user changed it + string sSaveTimed = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, "5"); + if (!sSaveTimed.Equals(m_sRememberFor)) + { + m_config.SetConfigSetting(CommonGUI.REMEMBER_SETTING,m_sRememberFor); + m_config.WriteConfig(); + } + dialogLogin.Destroy(); if (m_iRememberSeconds > 0) @@ -592,35 +607,35 @@ public class MiCasa : Store args.RetVal = true; } + private bool bTimerActive = false; public void StartRememberTimer() - { - // NOTE: USE A TIMER RATHER THAN A THREAD - if (m_tRememberTimer == null) - { - m_tRememberTimer = new Thread(new ThreadStart(ResetTimerThreadFn)); - m_tRememberTimer.Start(); - } - + { + if (!bTimerActive) + { + GLib.Timeout.Add ((uint)(m_iRememberSeconds * 1000), new GLib.TimeoutHandler (update_gui)); + bTimerActive = true; + } } - internal void ResetTimerThreadFn() - { - TreeViewColumn tvCol; - Thread.Sleep(m_iRememberSeconds * 1000); - if (tvKeyValue != null) - { - try - { - tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1)); - tvCol = new TreeViewColumn("Value", cellEditable, "text", 2); - tvKeyValue.InsertColumn(tvCol, 1); - cbuttonShowPassword.Active = false; - } - catch - { - - } - } - } + + private bool update_gui() + { + TreeViewColumn tvCol; + try + { + tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1)); + tvCol = new TreeViewColumn("Value", cellEditable, "text", 2); + tvKeyValue.InsertColumn(tvCol, 1); + cbuttonShowPassword.Active = false; + } + catch (Exception e) + { + //Console.WriteLine(e.ToString()); + } + bTimerActive = false; + + return false; + } + public void on_entryMasterPassword3_activate(object obj, EventArgs args) { @@ -1264,7 +1279,7 @@ public class MiCasa : Store { md.Destroy(); } - } + } } } ///################################################################## diff --git a/CASA/gui/images/casa.glade b/CASA/gui/images/casa.glade index e9125bd9..5b45180d 100644 --- a/CASA/gui/images/casa.glade +++ b/CASA/gui/images/casa.glade @@ -56,7 +56,7 @@ True - + True gtk-new 1 @@ -78,7 +78,7 @@ - + True gtk-new 1 @@ -99,7 +99,7 @@ - + True gtk-new 1 @@ -125,7 +125,7 @@ - + True gtk-refresh 1 @@ -152,7 +152,7 @@ - + True gtk-dialog-authentication 1 @@ -173,7 +173,7 @@ - + True gtk-open 1 @@ -194,7 +194,7 @@ - + True gtk-delete 1 @@ -214,14 +214,14 @@ - + True _Export Secrets True - + True gtk-floppy 1 @@ -235,14 +235,14 @@ - + True _Import Secrets True - + True gtk-open 1 @@ -270,7 +270,7 @@ - + True gtk-quit 1 @@ -306,7 +306,7 @@ - + True gtk-zoom-fit 1 @@ -327,7 +327,7 @@ - + True gtk-jump-to 1 @@ -348,7 +348,7 @@ - + True gtk-copy 1 @@ -376,7 +376,7 @@ - + True gtk-delete 1 @@ -410,7 +410,7 @@ True - + True gtk-execute 1 @@ -432,7 +432,7 @@ - + True gtk-execute 1 @@ -453,7 +453,7 @@ - + True gtk-execute 1 @@ -474,7 +474,7 @@ - + True gtk-execute 1 @@ -495,7 +495,7 @@ - + True gtk-execute 1 @@ -520,7 +520,7 @@ - + True gtk-revert-to-saved 1 @@ -547,7 +547,7 @@ - + True gtk-preferences 1 @@ -581,7 +581,7 @@ - + True gtk-add 1 @@ -602,7 +602,7 @@ - + True gtk-remove 1 @@ -653,7 +653,7 @@ - + True gtk-help 1 @@ -680,7 +680,7 @@ - + True gtk-dialog-info 1