diff --git a/CASA/gui/CasaMain.cs b/CASA/gui/CasaMain.cs
index f6ef6440..009231e6 100644
--- a/CASA/gui/CasaMain.cs
+++ b/CASA/gui/CasaMain.cs
@@ -385,11 +385,11 @@ namespace Novell.CASA.GUI
Logger.DbgLog("GUI:CasaMain.Login() - BEGIN");
if( true == IsMasterPasswordSet() )
- {
+ {
Logger.DbgLog("GUI:CasaMain.Login() - IsMasterPasswordSet returned true");
if( false == miCASA.IsSecretPersistent(1,"") )
- {
+ {
Logger.DbgLog("GUI:CasaMain.Login() - IsMasterPasswordSet returned false");
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null);
gxmlTemp.Autoconnect (this);
@@ -405,7 +405,7 @@ namespace Novell.CASA.GUI
}
}
else
- {
+ {
Logger.DbgLog("GUI:CasaMain.Login() - IsMasterPasswordSet returned false");
// did the daemon get restarted before the user created a master password?
@@ -713,7 +713,7 @@ namespace Novell.CASA.GUI
string MICASA_PASSCODE_BY_MASTER_PASSWD_FILE = "/.miCASAPCByMPasswd";
string fileName = Common.GetUserPersistentDir(config) + MICASA_PASSCODE_BY_MASTER_PASSWD_FILE;
- Logger.DbgLog("GUI:CasaMain.IsMasterPasswordSet() - END");
+ Logger.DbgLog("GUI:CasaMain.IsMasterPasswordSet() - END");
return (File.Exists(fileName));
}
@@ -1750,6 +1750,7 @@ namespace Novell.CASA.GUI
public void okbuttonPreferences_clicked(object abj, EventArgs args)
{
Logger.DbgLog("GUI:CasaMain.okbuttonPreferences_clicked() - BEGIN");
+ bool bCloseDialog = true;
string[] storeID = new string[]{""};
@@ -1757,7 +1758,7 @@ namespace Novell.CASA.GUI
Common.IS_MOZILLA = checkbuttonMozilla.Active;
Common.IS_GNOMEKEYRING = checkbuttonGnomeKeyring.Active;
Common.IS_KDEWALLET = checkbuttonKdeWallet.Active;
- dialogPreferences.Destroy();
+
/// FIREFOX
if(Common.IS_FIREFOX)
@@ -1841,12 +1842,18 @@ namespace Novell.CASA.GUI
string sOldDir = Common.GetUserPersistentDir(config);
try
{
- if (MoveMiCASAFiles(sOldDir, sNewDir))
- {
- // save off selected directory
- Common.SetUserPersistentDir(config, sNewDir);
- CommonGUI.DisplayMessage(Gtk.MessageType.Info, "Files moved from\r\n" + sOldDir + "\r\nto\r\n" + sNewDir);
- }
+ string sMoveMessage = MoveMiCASAFiles(sOldDir, sNewDir);
+ if (sMoveMessage.Equals("Success"))
+ {
+ // save off selected directory
+ Common.SetUserPersistentDir(config, 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)
{
@@ -1854,6 +1861,11 @@ namespace Novell.CASA.GUI
}
config.WriteConfig();
+ if (bCloseDialog)
+ {
+ dialogPreferences.Destroy();
+ }
+
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.Equals(sNewDirectory))
@@ -2234,11 +2251,14 @@ namespace Novell.CASA.GUI
// instruct our daemon/service to change the location
ChangePersistentDir cpd = new ChangePersistentDir(sOldDirectory, sNewDirectory);
cpd = (ChangePersistentDir)MiCasaRequestReply.Send(MiCasaRequestReply.VERB_CHANGE_PERSIST_DIR, cpd);
- if (cpd.GetErrorMessage().Equals("Success"))
- return true;
+ if (cpd.GetErrorMessage().Equals("Success"))
+ return "Success";
+ else
+ return cpd.GetErrorMessage();
}
}
- return false;
+
+ return null;
}
@@ -2247,11 +2267,11 @@ namespace Novell.CASA.GUI
{
PersistentPolicyDialog ppd = new PersistentPolicyDialog();
ppd.ShowDialog();
- }
-
- public void on_mmiFindAndReplace_activate(object obj, EventArgs args)
- {
- objMiCasa.FindAndReplaceValues();
+ }
+
+ public void on_mmiFindAndReplace_activate(object obj, EventArgs args)
+ {
+ objMiCasa.FindAndReplaceValues();
}
diff --git a/CASA/gui/Common.cs b/CASA/gui/Common.cs
index 60aa3c6f..322a3e9b 100644
--- a/CASA/gui/Common.cs
+++ b/CASA/gui/Common.cs
@@ -441,8 +441,15 @@ public class Common
}
internal static string GetUserName()
- {
- return Environment.GetEnvironmentVariable("USERNAME");
+ {
+ if (Common.IS_LINUX)
+ {
+ return Environment.GetEnvironmentVariable("USER");
+ }
+ else
+ {
+ return Environment.GetEnvironmentVariable("USERNAME");
+ }
}
diff --git a/CASA/gui/FileChooser.cs b/CASA/gui/FileChooser.cs
index 30433137..18523587 100644
--- a/CASA/gui/FileChooser.cs
+++ b/CASA/gui/FileChooser.cs
@@ -6,592 +6,592 @@ using Gtk;
namespace Novell.CASA.GUI
{
- ///
- /// Summary description for FileChooser.
- ///
- public class FileChooser
- {
- private string m_currentDirectory;
- private string m_currentFilter = "*";
- private string m_hintFile = null;
- private string m_sFileSelected = null;
- private bool m_bFileChoosing = true;
+ ///
+ /// Summary description for FileChooser.
+ ///
+ public class FileChooser
+ {
+ private string m_currentDirectory;
+ private string m_currentFilter = "*";
+ private string m_hintFile = null;
+ private string m_sFileSelected = null;
+ private bool m_bFileChoosing = true;
- private Gtk.TreeStore tsDrives = new TreeStore(typeof(string));
- private Gtk.TreeStore ts = new TreeStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string));
+ private Gtk.TreeStore tsDrives = new TreeStore(typeof(string));
+ private Gtk.TreeStore ts = new TreeStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string));
- private string m_pathSeparator = "/";
+ private string m_pathSeparator = "/";
- // actions
- private int m_iAction = 1;
- public const int ACTION_OPEN = 1;
- public const int ACTION_SAVE = 2;
- public const int ACTION_CHOOSE_DIR = 3;
-
+ // actions
+ private int m_iAction = 1;
+ public const int ACTION_OPEN = 1;
+ public const int ACTION_SAVE = 2;
+ public const int ACTION_CHOOSE_DIR = 3;
-#region Glade Widgets
-
- [Glade.Widget]
- Gtk.Dialog dialogFileChooser,
- dialogNewFolder;
-
- [Glade.Widget]
- Gtk.TreeView treeviewFavorites,
- treeviewListing;
- [Glade.Widget]
- Gtk.Entry entrySelectedFile,
- entryCurrentDir,
- entryNewFolder,
- entryFilter;
+ #region Glade Widgets
- [Glade.Widget]
- Gtk.Button buttonUP,
- buttonNewFolder;
+ [Glade.Widget]
+ Gtk.Dialog dialogFileChooser,
+ dialogNewFolder;
- [Glade.Widget]
- Gtk.Menu menuDeleteDirFile;
-
-#endregion
+ [Glade.Widget]
+ Gtk.TreeView treeviewFavorites,
+ treeviewListing;
- public FileChooser(int action)
- {
+ [Glade.Widget]
+ Gtk.Entry entrySelectedFile,
+ entryCurrentDir,
+ entryNewFolder,
+ entryFilter;
- m_iAction = action;
+ [Glade.Widget]
+ Gtk.Button buttonUP,
+ buttonNewFolder;
- if (Common.IS_WINDOWS)
- m_pathSeparator = "\\";
+ [Glade.Widget]
+ Gtk.Menu menuDeleteDirFile;
- SetCurrentDirectory(Common.GetUserHomeDir());
- }
+ #endregion
- private void SetCurrentDirectory(string dir)
- {
- // replace all instances of the path separator with correct one
- if (Common.IS_WINDOWS)
- m_currentDirectory = dir.Replace("/", "\\");
- else
- m_currentDirectory = dir;
+ public FileChooser(int action)
+ {
- if (!m_currentDirectory.EndsWith(m_pathSeparator))
- m_currentDirectory = m_currentDirectory + m_pathSeparator;
-
- //if (m_currentDirectory.EndsWith(m_pathSeparator))
- // m_currentDirectory = m_currentDirectory.Substring(0, m_currentDirectory.Length - 1);
+ m_iAction = action;
- SetNewFolderButton();
+ if (Common.IS_WINDOWS)
+ m_pathSeparator = "\\";
- DisplayDirectory();
- }
+ SetCurrentDirectory(Common.GetUserHomeDir());
+ }
- public string GetFile(string sHintDir, string sHintFile)
- {
- return GetFile(sHintDir, sHintFile, null);
- }
+ private void SetCurrentDirectory(string dir)
+ {
+ // replace all instances of the path separator with correct one
+ if (Common.IS_WINDOWS)
+ m_currentDirectory = dir.Replace("/", "\\");
+ else
+ m_currentDirectory = dir;
- public string GetFile(string sHintDir, string sHintFile, string sFilter)
- {
- if (sHintDir != null)
- {
- if (Directory.Exists(sHintDir))
- SetCurrentDirectory(sHintDir);
- }
-
- if (sHintFile != null)
- {
- m_hintFile = sHintFile;
- }
+ if (!m_currentDirectory.EndsWith(m_pathSeparator))
+ m_currentDirectory = m_currentDirectory + m_pathSeparator;
- if (sFilter != null)
- {
- m_currentFilter = sFilter;
- }
-
- DisplayChooser();
+ //if (m_currentDirectory.EndsWith(m_pathSeparator))
+ // m_currentDirectory = m_currentDirectory.Substring(0, m_currentDirectory.Length - 1);
- if (m_sFileSelected != null)
- {
+ SetNewFolderButton();
- if (m_iAction == FileChooser.ACTION_CHOOSE_DIR)
- {
- string sDirectory = m_currentDirectory + m_sFileSelected;
- if (sDirectory.EndsWith(m_pathSeparator))
- {
- sDirectory = sDirectory.Substring(0, sDirectory.Length - 1);
- }
- return sDirectory;
- }
- else
- {
- // is there a filter?
- if (m_currentFilter.Length > 0)
- {
- int dotPosition = m_currentFilter.LastIndexOf(".");
- if (dotPosition > 0)
- {
- string sFileExt = m_currentFilter.Substring(dotPosition);
- if (!m_sFileSelected.EndsWith(sFileExt) && (!sFileExt.EndsWith("*")))
- {
- return m_currentDirectory + m_sFileSelected + sFileExt;
- }
- }
- }
- }
+ DisplayDirectory();
+ }
-
- return m_currentDirectory + m_sFileSelected;
-
- }
- else
- return null;
+ public string GetFile(string sHintDir, string sHintFile)
+ {
+ return GetFile(sHintDir, sHintFile, null);
+ }
- }
+ public string GetFile(string sHintDir, string sHintFile, string sFilter)
+ {
+ if (sHintDir != null)
+ {
+ if (Directory.Exists(sHintDir))
+ SetCurrentDirectory(sHintDir);
+ }
- private void DisplayChooser()
- {
-
- // display chooser
- Show();
+ if (sHintFile != null)
+ {
+ m_hintFile = sHintFile;
+ }
- // wait for user
- while (m_bFileChoosing)
- {
- // Flush pending events to keep the GUI reponsive
- while (Gtk.Application.EventsPending ())
- Gtk.Application.RunIteration ();
- Thread.Sleep(100);
- }
- }
+ if (sFilter != null)
+ {
+ m_currentFilter = sFilter;
+ }
- public void Show(string sHintDir, string sHintFile)
- {
+ DisplayChooser();
- if (sHintDir != null)
- {
- if (Directory.Exists(sHintDir))
- SetCurrentDirectory(sHintDir);
- }
-
- if (sHintFile != null)
- {
- m_hintFile = sHintFile;
- }
+ if (m_sFileSelected != null)
+ {
- this.Show();
- }
+ if (m_iAction == FileChooser.ACTION_CHOOSE_DIR)
+ {
+ string sDirectory = m_currentDirectory + m_sFileSelected;
+ if (sDirectory.EndsWith(m_pathSeparator))
+ {
+ sDirectory = sDirectory.Substring(0, sDirectory.Length - 1);
+ }
+ return sDirectory;
+ }
+ else
+ {
+ // is there a filter?
+ if (m_currentFilter.Length > 0)
+ {
+ int dotPosition = m_currentFilter.LastIndexOf(".");
+ if (dotPosition > 0)
+ {
+ string sFileExt = m_currentFilter.Substring(dotPosition);
+ if (!m_sFileSelected.EndsWith(sFileExt) && (!sFileExt.EndsWith("*")))
+ {
+ return m_currentDirectory + m_sFileSelected + sFileExt;
+ }
+ }
+ }
+ }
- public void Show()
- {
- // load and connect handlers
- Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogFileChooser", null);
- gxmlTemp.Autoconnect(this);
- if (m_iAction == ACTION_CHOOSE_DIR)
- {
- entrySelectedFile.Visible = false;
- dialogFileChooser.Title = "Select a directory";
+ return m_currentDirectory + m_sFileSelected;
- }
- else if (m_iAction == ACTION_OPEN)
- {
- buttonNewFolder.Visible = false;
- entrySelectedFile.Sensitive = false;
- dialogFileChooser.Title = "Select the file to open";
- }
- else
- {
- dialogFileChooser.Title = "Save secrets to ....";
- }
-
+ }
+ else
+ return null;
+
+ }
+
+ private void DisplayChooser()
+ {
+
+ // display chooser
+ Show();
+
+ // wait for user
+ while (m_bFileChoosing)
+ {
+ // Flush pending events to keep the GUI reponsive
+ while (Gtk.Application.EventsPending())
+ Gtk.Application.RunIteration();
+ Thread.Sleep(100);
+ }
+ }
+
+ public void Show(string sHintDir, string sHintFile)
+ {
+
+ if (sHintDir != null)
+ {
+ if (Directory.Exists(sHintDir))
+ SetCurrentDirectory(sHintDir);
+ }
+
+ if (sHintFile != null)
+ {
+ m_hintFile = sHintFile;
+ }
+
+ this.Show();
+ }
+
+ public void Show()
+ {
+ // load and connect handlers
+ Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogFileChooser", null);
+ gxmlTemp.Autoconnect(this);
+
+ if (m_iAction == ACTION_CHOOSE_DIR)
+ {
+ entrySelectedFile.Visible = false;
+ dialogFileChooser.Title = "Select a directory";
+
+ }
+ else if (m_iAction == ACTION_OPEN)
+ {
+ buttonNewFolder.Visible = false;
+ entrySelectedFile.Sensitive = false;
+ dialogFileChooser.Title = "Select the file to open";
+ }
+ else
+ {
+ dialogFileChooser.Title = "Save secrets to ....";
+ }
#if LINUX
- tsDrives.AppendValues("/home");
+ tsDrives.AppendValues("/home/.casa/"+Common.GetUserName());
+ tsDrives.AppendValues(Common.GetUserHomeDir());
tsDrives.AppendValues("/media");
#else
- // show logical drives
- string[] drives = Directory.GetLogicalDrives();
- for (int i=0; i 0))
- m_sFileSelected = entrySelectedFile.Text + m_pathSeparator;
- else
- m_sFileSelected = "";
+ try
+ {
+ if (treeviewFavorites.Selection.GetSelected(out model, out iter))
+ {
+ selected = (string)model.GetValue(iter, 0);
+ SetCurrentDirectory(selected);
+ DisplayFileListing();
+ }
+ }
+ catch (Exception e)
+ {
+ Logger.DbgLog(e.ToString());
+ }
+ }
- // destroy dialog
- dialogFileChooser.Destroy();
- m_bFileChoosing = false;
- }
- else
- {
- ProcessSelection();
- }
- }
+ public void on_btnOkFileChooser_clicked(object obj, EventArgs args)
+ {
+ if (m_iAction == ACTION_CHOOSE_DIR)
+ {
+ // set directory selected
+ if ((entrySelectedFile.Text != null) && (entrySelectedFile.Text.Length > 0))
+ m_sFileSelected = entrySelectedFile.Text + m_pathSeparator;
+ else
+ m_sFileSelected = "";
+
+ // destroy dialog
+ dialogFileChooser.Destroy();
+ m_bFileChoosing = false;
+ }
+ else
+ {
+ ProcessSelection();
+ }
+ }
- public void on_btnCancelFileChooser_clicked(object obj, EventArgs args)
- {
- m_bFileChoosing = false;
- if (dialogFileChooser != null)
- {
- dialogFileChooser.Destroy();
- }
- }
+ public void on_btnCancelFileChooser_clicked(object obj, EventArgs args)
+ {
+ m_bFileChoosing = false;
+ if (dialogFileChooser != null)
+ {
+ dialogFileChooser.Destroy();
+ }
+ }
- public void on_dialogFileChooser_destroy(object o, EventArgs args)
- {
- m_bFileChoosing = false;
- }
+ public void on_dialogFileChooser_destroy(object o, EventArgs args)
+ {
+ m_bFileChoosing = false;
+ }
- public void on_buttonUP_clicked(object o, EventArgs args)
- {
- // remove trailing slash if there is one
- if (m_currentDirectory.EndsWith(m_pathSeparator))
- m_currentDirectory = m_currentDirectory.Substring(0, m_currentDirectory.Length - 1);
+ public void on_buttonUP_clicked(object o, EventArgs args)
+ {
+ // remove trailing slash if there is one
+ if (m_currentDirectory.EndsWith(m_pathSeparator))
+ m_currentDirectory = m_currentDirectory.Substring(0, m_currentDirectory.Length - 1);
- // back up one directory
- int iSlashIndex = m_currentDirectory.LastIndexOf(m_pathSeparator);
- if (iSlashIndex > 1)
- {
- // if windows drive letter, keep the slash
- if ((Common.IS_WINDOWS) && (iSlashIndex == 2))
- SetCurrentDirectory(m_currentDirectory.Substring(0, iSlashIndex + 1));
- else
- SetCurrentDirectory(m_currentDirectory.Substring(0, iSlashIndex));
+ // back up one directory
+ int iSlashIndex = m_currentDirectory.LastIndexOf(m_pathSeparator);
+ if (iSlashIndex > 1)
+ {
+ // if windows drive letter, keep the slash
+ if ((Common.IS_WINDOWS) && (iSlashIndex == 2))
+ SetCurrentDirectory(m_currentDirectory.Substring(0, iSlashIndex + 1));
+ else
+ SetCurrentDirectory(m_currentDirectory.Substring(0, iSlashIndex));
- DisplayFileListing();
- }
- }
+ DisplayFileListing();
+ }
+ }
- private void imageUp_ButtonPressEvent(object o, ButtonPressEventArgs args)
- {
-
- }
-
- private void treeviewListing_MoveCursor(object o, MoveCursorArgs args)
- {
- //Console.WriteLine("Cursor moved");
- DisplaySelectedFile();
- }
-
- private void treeviewListing_ButtonReleaseEvent(object o, ButtonReleaseEventArgs args)
- {
-
- //Console.WriteLine("Button released");
- DisplaySelectedFile();
-
- if( 3 == args.Event.Button )
- {
- try
- {
- Logger.DbgLog("GUI:MiCasa.OnRightClicked() - Context menu opened.");
- Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "menuDeleteDirFile", null);
- gxmlTemp.Autoconnect (this);
- menuDeleteDirFile.Popup(null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentEventTime);
- }
- catch(Exception exp)
- {
- Logger.DbgLog("GUI:MiCasa.OnRightClicked() - EXCEPTION:" + exp.ToString());
- }
- }
- }
-
- public void onDeleteDirFile(object obj, EventArgs args)
- {
- string sDirFile = entrySelectedFile.Text;
- if (sDirFile != null)
- {
- if (Directory.Exists(m_currentDirectory + m_pathSeparator + sDirFile))
- {
- try
- {
- Directory.Delete(m_currentDirectory + m_pathSeparator + sDirFile);
- }
- catch (Exception e)
- {
- CommonGUI.DisplayMessage(Gtk.MessageType.Error, e.ToString());
- }
- }
- else
- {
- File.Delete(m_currentDirectory + m_pathSeparator + sDirFile);
- }
-
- DisplayFileListing();
-
- }
- }
-
- private void DisplaySelectedFile()
- {
- TreeModel model;
- TreeIter iter;
- string selected;
-
- try
- {
- if( treeviewListing.Selection.GetSelected (out model, out iter) )
- {
- selected = (string) model.GetValue(iter, 1);
- entrySelectedFile.Text = selected;
- }
- }
- catch (Exception e)
- {
-
- }
- }
+ private void imageUp_ButtonPressEvent(object o, ButtonPressEventArgs args)
+ {
+
+ }
+
+ private void treeviewListing_MoveCursor(object o, MoveCursorArgs args)
+ {
+ //Console.WriteLine("Cursor moved");
+ DisplaySelectedFile();
+ }
+
+ private void treeviewListing_ButtonReleaseEvent(object o, ButtonReleaseEventArgs args)
+ {
+
+ //Console.WriteLine("Button released");
+ DisplaySelectedFile();
+
+ if (3 == args.Event.Button)
+ {
+ try
+ {
+ Logger.DbgLog("GUI:MiCasa.OnRightClicked() - Context menu opened.");
+ Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "menuDeleteDirFile", null);
+ gxmlTemp.Autoconnect(this);
+ menuDeleteDirFile.Popup(null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentEventTime);
+ }
+ catch (Exception exp)
+ {
+ Logger.DbgLog("GUI:MiCasa.OnRightClicked() - EXCEPTION:" + exp.ToString());
+ }
+ }
+ }
+
+ public void onDeleteDirFile(object obj, EventArgs args)
+ {
+ string sDirFile = entrySelectedFile.Text;
+ if (sDirFile != null)
+ {
+ if (Directory.Exists(m_currentDirectory + m_pathSeparator + sDirFile))
+ {
+ try
+ {
+ Directory.Delete(m_currentDirectory + m_pathSeparator + sDirFile);
+ }
+ catch (Exception e)
+ {
+ CommonGUI.DisplayMessage(Gtk.MessageType.Error, e.ToString());
+ }
+ }
+ else
+ {
+ File.Delete(m_currentDirectory + m_pathSeparator + sDirFile);
+ }
+
+ DisplayFileListing();
+
+ }
+ }
+
+ private void DisplaySelectedFile()
+ {
+ TreeModel model;
+ TreeIter iter;
+ string selected;
+
+ try
+ {
+ if (treeviewListing.Selection.GetSelected(out model, out iter))
+ {
+ selected = (string)model.GetValue(iter, 1);
+ entrySelectedFile.Text = selected;
+ }
+ }
+ catch (Exception e)
+ {
+
+ }
+ }
- private void SetNewFolderButton()
- {
- if (buttonNewFolder != null)
- {
- if ((m_currentDirectory.Equals("/home/")) ||
- (m_currentDirectory.Equals("/home/.casa/")) ||
- (m_currentDirectory.Equals("/media/")))
- {
- buttonNewFolder.Sensitive = false;
- }
- else
- {
- buttonNewFolder.Sensitive = true;
- }
- }
-
- SetUPButton();
- }
-
- private void SetUPButton()
- {
- if (buttonUP != null)
- {
- if ((m_currentDirectory.Equals("/home/")) ||
- (m_currentDirectory.Equals("/media/")))
- {
- buttonUP.Sensitive = false;
- }
- else
- {
- buttonUP.Sensitive = true;
- }
- }
- }
-
-
- // new folder handler
- public void on_buttonNewFolder_clicked(object obj, EventArgs args)
- {
- //prompt for new folder name
- // load and connect handlers
- Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogNewFolder", null);
- gxmlTemp.Autoconnect(this);
-
- dialogNewFolder.SetPosition(Gtk.WindowPosition.CenterOnParent);
- }
-
- public void on_okbuttonNewFolder_clicked(object obj, EventArgs args)
- {
- // create the new folder
- string sNewFolder = entryNewFolder.Text;
- if (sNewFolder != null)
- {
- // create folder in currentdir
- try
- {
- Directory.CreateDirectory(m_currentDirectory + m_pathSeparator + sNewFolder);
- if (dialogNewFolder != null)
- {
- dialogNewFolder.Destroy();
- }
-
- DisplayFileListing();
- }
- catch (Exception e)
- {
-
- }
- }
- }
-
- public void on_cancelbuttonNewFolder_clicked(object obj, EventArgs args)
- {
- if (dialogNewFolder != null)
- {
- dialogNewFolder.Destroy();
- }
- }
- }
+ private void SetNewFolderButton()
+ {
+ if (buttonNewFolder != null)
+ {
+ if ((m_currentDirectory.Equals("/home/.casa/")) ||
+ (m_currentDirectory.Equals("/media/")))
+ {
+ buttonNewFolder.Sensitive = false;
+ }
+ else
+ {
+ buttonNewFolder.Sensitive = true;
+ }
+ }
+
+ SetUPButton();
+ }
+
+ private void SetUPButton()
+ {
+ if (buttonUP != null)
+ {
+ if ((m_currentDirectory.Equals(Common.GetUserHomeDir() + "/")) ||
+ (m_currentDirectory.Equals("/home/.casa/" + Common.GetUserName() + "/")) ||
+ (m_currentDirectory.Equals("/media/")))
+ {
+ buttonUP.Sensitive = false;
+ }
+ else
+ {
+ buttonUP.Sensitive = true;
+ }
+ }
+ }
+
+
+ // new folder handler
+ public void on_buttonNewFolder_clicked(object obj, EventArgs args)
+ {
+ //prompt for new folder name
+ // load and connect handlers
+ Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogNewFolder", null);
+ gxmlTemp.Autoconnect(this);
+
+ dialogNewFolder.SetPosition(Gtk.WindowPosition.CenterOnParent);
+ }
+
+ public void on_okbuttonNewFolder_clicked(object obj, EventArgs args)
+ {
+ // create the new folder
+ string sNewFolder = entryNewFolder.Text;
+ if (sNewFolder != null)
+ {
+ // create folder in currentdir
+ try
+ {
+ Directory.CreateDirectory(m_currentDirectory + m_pathSeparator + sNewFolder);
+ if (dialogNewFolder != null)
+ {
+ dialogNewFolder.Destroy();
+ }
+
+ DisplayFileListing();
+ }
+ catch (Exception e)
+ {
+
+ }
+ }
+ }
+
+ public void on_cancelbuttonNewFolder_clicked(object obj, EventArgs args)
+ {
+ if (dialogNewFolder != null)
+ {
+ dialogNewFolder.Destroy();
+ }
+ }
+ }
}