- Limit where persistent files can be saved.
This commit is contained in:
parent
d0a9891cdf
commit
fbfa990210
@ -1750,6 +1750,7 @@ namespace Novell.CASA.GUI
|
|||||||
public void okbuttonPreferences_clicked(object abj, EventArgs args)
|
public void okbuttonPreferences_clicked(object abj, EventArgs args)
|
||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:CasaMain.okbuttonPreferences_clicked() - BEGIN");
|
Logger.DbgLog("GUI:CasaMain.okbuttonPreferences_clicked() - BEGIN");
|
||||||
|
bool bCloseDialog = true;
|
||||||
|
|
||||||
string[] storeID = new string[]{""};
|
string[] storeID = new string[]{""};
|
||||||
|
|
||||||
@ -1757,7 +1758,7 @@ namespace Novell.CASA.GUI
|
|||||||
Common.IS_MOZILLA = checkbuttonMozilla.Active;
|
Common.IS_MOZILLA = checkbuttonMozilla.Active;
|
||||||
Common.IS_GNOMEKEYRING = checkbuttonGnomeKeyring.Active;
|
Common.IS_GNOMEKEYRING = checkbuttonGnomeKeyring.Active;
|
||||||
Common.IS_KDEWALLET = checkbuttonKdeWallet.Active;
|
Common.IS_KDEWALLET = checkbuttonKdeWallet.Active;
|
||||||
dialogPreferences.Destroy();
|
|
||||||
|
|
||||||
/// FIREFOX
|
/// FIREFOX
|
||||||
if(Common.IS_FIREFOX)
|
if(Common.IS_FIREFOX)
|
||||||
@ -1841,11 +1842,17 @@ namespace Novell.CASA.GUI
|
|||||||
string sOldDir = Common.GetUserPersistentDir(config);
|
string sOldDir = Common.GetUserPersistentDir(config);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (MoveMiCASAFiles(sOldDir, sNewDir))
|
string sMoveMessage = MoveMiCASAFiles(sOldDir, sNewDir);
|
||||||
|
if (sMoveMessage.Equals("Success"))
|
||||||
{
|
{
|
||||||
// save off selected directory
|
// save off selected directory
|
||||||
Common.SetUserPersistentDir(config, sNewDir);
|
Common.SetUserPersistentDir(config, sNewDir);
|
||||||
CommonGUI.DisplayMessage(Gtk.MessageType.Info, "Files moved from\r\n" + sOldDir + "\r\nto\r\n" + sNewDir);
|
CommonGUI.DisplayMessage(Gtk.MessageType.Info, "Files moved from\r\n" + sOldDir + "\r\nto\r\n" + sNewDir);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CommonGUI.DisplayMessage(Gtk.MessageType.Warning, sMoveMessage);
|
||||||
|
bCloseDialog = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -1854,6 +1861,11 @@ namespace Novell.CASA.GUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
config.WriteConfig();
|
config.WriteConfig();
|
||||||
|
if (bCloseDialog)
|
||||||
|
{
|
||||||
|
dialogPreferences.Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
Logger.DbgLog("GUI:CasaMain.okbuttonPreferences_clicked() - END");
|
Logger.DbgLog("GUI:CasaMain.okbuttonPreferences_clicked() - END");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2225,8 +2237,13 @@ namespace Novell.CASA.GUI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool MoveMiCASAFiles(string sOldDirectory, string sNewDirectory)
|
private string MoveMiCASAFiles(string sOldDirectory, string sNewDirectory)
|
||||||
{
|
{
|
||||||
|
if (sNewDirectory == null || sNewDirectory.Length == 0)
|
||||||
|
{
|
||||||
|
return "No persistent directory entered";
|
||||||
|
}
|
||||||
|
|
||||||
if ((sOldDirectory != null) && (sNewDirectory != null))
|
if ((sOldDirectory != null) && (sNewDirectory != null))
|
||||||
{
|
{
|
||||||
if (!sOldDirectory.Equals(sNewDirectory))
|
if (!sOldDirectory.Equals(sNewDirectory))
|
||||||
@ -2235,10 +2252,13 @@ namespace Novell.CASA.GUI
|
|||||||
ChangePersistentDir cpd = new ChangePersistentDir(sOldDirectory, sNewDirectory);
|
ChangePersistentDir cpd = new ChangePersistentDir(sOldDirectory, sNewDirectory);
|
||||||
cpd = (ChangePersistentDir)MiCasaRequestReply.Send(MiCasaRequestReply.VERB_CHANGE_PERSIST_DIR, cpd);
|
cpd = (ChangePersistentDir)MiCasaRequestReply.Send(MiCasaRequestReply.VERB_CHANGE_PERSIST_DIR, cpd);
|
||||||
if (cpd.GetErrorMessage().Equals("Success"))
|
if (cpd.GetErrorMessage().Equals("Success"))
|
||||||
return true;
|
return "Success";
|
||||||
|
else
|
||||||
|
return cpd.GetErrorMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -441,9 +441,16 @@ public class Common
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal static string GetUserName()
|
internal static string GetUserName()
|
||||||
|
{
|
||||||
|
if (Common.IS_LINUX)
|
||||||
|
{
|
||||||
|
return Environment.GetEnvironmentVariable("USER");
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
return Environment.GetEnvironmentVariable("USERNAME");
|
return Environment.GetEnvironmentVariable("USERNAME");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
internal static string GetUserHomeDir()
|
internal static string GetUserHomeDir()
|
||||||
|
@ -203,9 +203,9 @@ namespace Novell.CASA.GUI
|
|||||||
dialogFileChooser.Title = "Save secrets to ....";
|
dialogFileChooser.Title = "Save secrets to ....";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if LINUX
|
#if LINUX
|
||||||
tsDrives.AppendValues("/home");
|
tsDrives.AppendValues("/home/.casa/"+Common.GetUserName());
|
||||||
|
tsDrives.AppendValues(Common.GetUserHomeDir());
|
||||||
tsDrives.AppendValues("/media");
|
tsDrives.AppendValues("/media");
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -519,8 +519,7 @@ namespace Novell.CASA.GUI
|
|||||||
{
|
{
|
||||||
if (buttonNewFolder != null)
|
if (buttonNewFolder != null)
|
||||||
{
|
{
|
||||||
if ((m_currentDirectory.Equals("/home/")) ||
|
if ((m_currentDirectory.Equals("/home/.casa/")) ||
|
||||||
(m_currentDirectory.Equals("/home/.casa/")) ||
|
|
||||||
(m_currentDirectory.Equals("/media/")))
|
(m_currentDirectory.Equals("/media/")))
|
||||||
{
|
{
|
||||||
buttonNewFolder.Sensitive = false;
|
buttonNewFolder.Sensitive = false;
|
||||||
@ -538,7 +537,8 @@ namespace Novell.CASA.GUI
|
|||||||
{
|
{
|
||||||
if (buttonUP != null)
|
if (buttonUP != null)
|
||||||
{
|
{
|
||||||
if ((m_currentDirectory.Equals("/home/")) ||
|
if ((m_currentDirectory.Equals(Common.GetUserHomeDir() + "/")) ||
|
||||||
|
(m_currentDirectory.Equals("/home/.casa/" + Common.GetUserName() + "/")) ||
|
||||||
(m_currentDirectory.Equals("/media/")))
|
(m_currentDirectory.Equals("/media/")))
|
||||||
{
|
{
|
||||||
buttonUP.Sensitive = false;
|
buttonUP.Sensitive = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user