From 466357aa0e4dc9a07351269cd413f4ac6b8c0a80 Mon Sep 17 00:00:00 2001 From: Jim Norman Date: Wed, 20 Sep 2006 22:58:27 +0000 Subject: [PATCH] Add 'Do not show again' on 2 dialogs. (Refresh and delete dialogs) --- CASA/gui/CasaMain.cs | 22 ++++++++++++++--- CASA/gui/Common.cs | 2 ++ CASA/gui/MiCasa.cs | 41 +++++++++++++++++++++++++------ CASA/gui/images/casa.glade | 37 ++++++++++++++++++++++++++++ CASA/micasad/cache/SecretStore.cs | 11 ++++++--- 5 files changed, 98 insertions(+), 15 deletions(-) diff --git a/CASA/gui/CasaMain.cs b/CASA/gui/CasaMain.cs index cc8b254a..8b4c70c2 100644 --- a/CASA/gui/CasaMain.cs +++ b/CASA/gui/CasaMain.cs @@ -103,7 +103,8 @@ namespace Novell.CASA.GUI checkbuttonKdeWallet, checkbuttonCloseMessage, checkbuttonRunInTray, - checkbuttonSaveSecrets; + checkbuttonSaveSecrets, + checkbuttonShowRefreshDialog; [Glade.Widget] @@ -1076,15 +1077,28 @@ namespace Novell.CASA.GUI /// public void RefreshAllStores(object obj, EventArgs args) { - Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogConfirmRefresh", null); - gxmlTemp.Autoconnect (this); - dialogConfirmRefresh.TransientFor = windowMain; + if (config.GetConfigSetting(Common.CONFIG_SHOW_REFRESH_DIALOG, true)) + { + Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogConfirmRefresh", null); + gxmlTemp.Autoconnect (this); + dialogConfirmRefresh.TransientFor = windowMain; + } + else + { + RefreshStores(); + } } public void on_buttonRefreshYes_clicked(object abj, EventArgs args) { Logger.DbgLog("GUI:CasaMain.on_buttonRefreshYes_clicked() - BEGIN"); + if ((checkbuttonShowRefreshDialog != null) && (checkbuttonShowRefreshDialog.Active)) + { + config.SetConfigSetting(Common.CONFIG_SHOW_REFRESH_DIALOG, false); + config.WriteConfig(); + } + RefreshStores(); dialogConfirmRefresh.Destroy(); diff --git a/CASA/gui/Common.cs b/CASA/gui/Common.cs index aae1b6bb..d0d94b28 100644 --- a/CASA/gui/Common.cs +++ b/CASA/gui/Common.cs @@ -144,6 +144,8 @@ public class Common public static string CONFIG_DISPLAY_CASA_MANAGER = "DisplayCasaManagerOnClick"; public static string CONFIG_PERSISTENT_DIRECTORY = "PersistentDirectory"; public static string CONFIG_PERSIST_SECRETS = "PersistSecrets"; + public static string CONFIG_SHOW_REFRESH_DIALOG = "ShowRefreshDialog"; + public static string CONFIG_SHOW_DELETE_DIALOG = "ShowDeleteDialog"; ///############################################################# diff --git a/CASA/gui/MiCasa.cs b/CASA/gui/MiCasa.cs index 2e0e0f62..897190bb 100644 --- a/CASA/gui/MiCasa.cs +++ b/CASA/gui/MiCasa.cs @@ -90,7 +90,8 @@ public class MiCasa : Store entryMasterPassword4; [Glade.Widget] - Gtk.CheckButton cbuttonShowPassword; + Gtk.CheckButton cbuttonShowPassword, + checkbuttonShowDeleteDialog; [Glade.Widget] Gtk.MenuItem cmiNewKey, @@ -977,19 +978,39 @@ public class MiCasa : Store if( 0 != tvSecretIDMiCasa.Selection.CountSelectedRows() ) { - Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogConfirmDelete", null); - gxmlTemp.Autoconnect (this); - dialogConfirmDelete.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain"); - dialogConfirmDelete.Title = "miCASA - Delete Secret"; - - TreeModel model; + + TreeModel model; TreeIter iter; string selected = null; if( tvSecretIDMiCasa.Selection.GetSelected (out model, out iter) ) { selected = (string) model.GetValue (iter, 0); + } + + if (m_config.GetConfigSetting(Common.CONFIG_SHOW_DELETE_DIALOG, true)) + { + + Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogConfirmDelete", null); + gxmlTemp.Autoconnect (this); + dialogConfirmDelete.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain"); + dialogConfirmDelete.Title = "miCASA - Delete Secret"; + checkbuttonShowDeleteDialog.Visible = true; + if( (null != selected) && (selected.Length > 0) ) entryDeleteSecretID.Text = selected; + + } + else + { + if( (null != selected) && (selected.Length > 0) ) + { + if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_MICASA, Common.OPERATION_DELETE_SECRET, "", "", ref model, ref iter) ) + { + tsSecretIDMiCasa.Remove(ref iter); + tvSecretIDMiCasa.ColumnsAutosize(); + tsNativeInfoMiCasa.Clear(); + } + } } } @@ -1025,6 +1046,12 @@ public class MiCasa : Store Logger.DbgLog("GUI:MiCasa.on_buttonYes_clicked() - EXCEPTION:" + exp.ToString()); } + if ((checkbuttonShowDeleteDialog != null) && (checkbuttonShowDeleteDialog.Active)) + { + m_config.SetConfigSetting(Common.CONFIG_SHOW_DELETE_DIALOG, false); + m_config.WriteConfig(); + } + Logger.DbgLog("GUI:MiCasa.on_buttonYes_clicked() - END"); } diff --git a/CASA/gui/images/casa.glade b/CASA/gui/images/casa.glade index c06c764f..20bc3a82 100644 --- a/CASA/gui/images/casa.glade +++ b/CASA/gui/images/casa.glade @@ -1784,6 +1784,25 @@ their backend stores. False + + + + True + True + Do not show this in the future + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + 0 @@ -3787,6 +3806,24 @@ their backend stores. False + + + + True + Do not show this in the future + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + 0 diff --git a/CASA/micasad/cache/SecretStore.cs b/CASA/micasad/cache/SecretStore.cs index ef779670..bafbb146 100644 --- a/CASA/micasad/cache/SecretStore.cs +++ b/CASA/micasad/cache/SecretStore.cs @@ -797,11 +797,14 @@ namespace sscs.cache // the user might have set a different one // load the policy file and check. UIPol uiPolicy = (UIPol)ICASAPol.GetPolicy(CASAPolType.UI_POL, GetUserHomeDirectory()); - string sDir = uiPolicy.GetConfigSetting(ConstStrings.CONFIG_PERSISTENT_DIRECTORY); - if ((sDir != null) && (sDir.Length > 0)) + if (uiPolicy != null) { - m_persistenceDirectory = sDir; - return m_persistenceDirectory; + string sDir = uiPolicy.GetConfigSetting(ConstStrings.CONFIG_PERSISTENT_DIRECTORY); + if ((sDir != null) && (sDir.Length > 0)) + { + m_persistenceDirectory = sDir; + return m_persistenceDirectory; + } } }