form.SizeGripStyle = SizeGripStyle.Show;
form.MaximizeBox = true;
+ form.MinimizeBox = true;
form.FormBorderStyle = FormBorderStyle.Sizable;
form.MinimumSize = new Size (554, 405);
- form.Size = new Size (554, 405); // 384
+ form.ClientSize = new Size (554, 405); // 384
form.Controls.Add (smallButtonToolBar);
form.Controls.Add (cancelButton);
{
lastFolder = (string)MWFConfig.GetValue (filedialog_string, lastfolder_string);
+ if (lastFolder != null && lastFolder.IndexOf ("://") == -1) {
+ if (!Directory.Exists (lastFolder)) {
+ lastFolder = MWFVFS.DesktopPrefix;
+ }
+ }
+
if (initialDirectory != "")
lastFolder = initialDirectory;
else
Color foreColor = e.ForeColor;
int xPos = dcbi.XPos;
-
+
if ((e.State & DrawItemState.ComboBoxEdit) != 0)
xPos = 0;
- else
- if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) {
- backColor = ThemeEngine.Current.ColorHighlight;
+
+ gr.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (backColor),
+ new Rectangle (0, 0, bmp.Width, bmp.Height));
+
+ if ((e.State & DrawItemState.Selected) == DrawItemState.Selected &&
+ (!DroppedDown || (e.State & DrawItemState.ComboBoxEdit) != DrawItemState.ComboBoxEdit)) {
foreColor = ThemeEngine.Current.ColorHighlightText;
+
+ int w = (int) gr.MeasureString (dcbi.Name, e.Font).Width;
+
+ gr.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ThemeEngine.Current.ColorHighlight),
+ new Rectangle (xPos + 23, 1, w + 3, e.Bounds.Height - 2));
+ if ((e.State & DrawItemState.Focus) == DrawItemState.Focus) {
+ ControlPaint.DrawFocusRectangle (gr, new Rectangle (xPos + 22, 0, w + 5,
+ e.Bounds.Height), foreColor, ThemeEngine.Current.ColorHighlight);
+ }
}
-
- gr.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (backColor), new Rectangle (0, 0, bmp.Width, bmp.Height));
-
+
gr.DrawString (dcbi.Name, e.Font , ThemeEngine.Current.ResPool.GetSolidBrush (foreColor), new Point (24 + xPos, (bmp.Height - e.Font.Height) / 2));
gr.DrawImage (dcbi.ImageList.Images [dcbi.ImageIndex], new Rectangle (new Point (xPos + 2, 0), new Size (16, 16)));
public void CreateNewFolder ()
{
- if (currentFolder == MWFVFS.RecentlyUsedPrefix)
+ if (currentFolder == MWFVFS.MyComputerPrefix ||
+ currentFolder == MWFVFS.RecentlyUsedPrefix)
return;
FSEntry fsEntry = new FSEntry ();
} else
if (o is ToolBarButton) {
ToolBarButton t = o as ToolBarButton;
- t.Enabled = (directoryStack.Count > 1);
+ t.Enabled = (directoryStack.Count > 0);
}
}
}
workerThread = null;
}
+ // Added next line to ensure the control is created before BeginInvoke is called on it
+ calling_control.CreateControl();
workerThread = new WorkerThread (fileSystem, the_filters, updateDelegate, calling_control);
get_folder_content_thread_start = new ThreadStart (workerThread.GetFolderContentThread);
}
}
+ public ArrayList GetFoldersOnly ()
+ {
+ return fileSystem.GetFoldersOnly ();
+ }
+
public void WriteRecentlyUsedFiles (string filename)
{
fileSystem.WriteRecentlyUsedFiles (filename);
}
}
+ public ArrayList GetFoldersOnly ()
+ {
+ ArrayList directories_out = new ArrayList ();
+
+ if (currentFolderFSEntry.FullName == MWFVFS.DesktopPrefix) {
+ FSEntry personalFSEntry = GetPersonalFSEntry ();
+
+ directories_out.Add (personalFSEntry);
+
+ FSEntry myComputerFSEntry = GetMyComputerFSEntry ();
+
+ directories_out.Add (myComputerFSEntry);
+
+ FSEntry myNetworkFSEntry = GetMyNetworkFSEntry ();
+
+ directories_out.Add (myNetworkFSEntry);
+
+ ArrayList d_out = GetNormalFolders (ThemeEngine.Current.Places (UIIcon.PlacesDesktop));
+ directories_out.AddRange (d_out);
+
+ } else
+ if (currentFolderFSEntry.FullName == MWFVFS.RecentlyUsedPrefix) {
+ //files_out = GetRecentlyUsedFiles ();
+ } else
+ if (currentFolderFSEntry.FullName == MWFVFS.MyComputerPrefix) {
+ directories_out.AddRange (GetMyComputerContent ());
+ } else
+ if (currentFolderFSEntry.FullName == MWFVFS.PersonalPrefix || currentFolderFSEntry.FullName == MWFVFS.MyComputerPersonalPrefix) {
+ ArrayList d_out = GetNormalFolders (ThemeEngine.Current.Places (UIIcon.PlacesPersonal));
+ directories_out.AddRange (d_out);
+ } else
+ if (currentFolderFSEntry.FullName == MWFVFS.MyNetworkPrefix) {
+ directories_out.AddRange (GetMyNetworkContent ());
+ } else {
+ directories_out = GetNormalFolders (currentFolderFSEntry.FullName);
+ }
+ return directories_out;
+ }
+
protected void GetNormalFolderContent (string from_folder, StringCollection filters, out ArrayList directories_out, out ArrayList files_out)
{
DirectoryInfo dirinfo = new DirectoryInfo (from_folder);
directories_out = new ArrayList ();
- DirectoryInfo[] dirs = dirinfo.GetDirectories ();
+ DirectoryInfo[] dirs = null;
- for (int i = 0; i < dirs.Length; i++) {
- directories_out.Add (GetDirectoryFSEntry (dirs [i], currentTopFolderFSEntry));
- }
+ try {
+ dirs = dirinfo.GetDirectories ();
+ } catch (Exception) {}
+
+ if (dirs != null)
+ for (int i = 0; i < dirs.Length; i++) {
+ directories_out.Add (GetDirectoryFSEntry (dirs [i], currentTopFolderFSEntry));
+ }
files_out = new ArrayList ();
ArrayList files = new ArrayList ();
- if (filters == null) {
- files.AddRange (dirinfo.GetFiles ());
- } else {
- foreach (string s in filters)
- files.AddRange (dirinfo.GetFiles (s));
- }
+ try {
+ if (filters == null) {
+ files.AddRange (dirinfo.GetFiles ());
+ } else {
+ foreach (string s in filters)
+ files.AddRange (dirinfo.GetFiles (s));
+ }
+ } catch (Exception) {}
for (int i = 0; i < files.Count; i++) {
files_out.Add (GetFileFSEntry (files [i] as FileInfo));
}
}
+ protected ArrayList GetNormalFolders (string from_folder)
+ {
+ DirectoryInfo dirinfo = new DirectoryInfo (from_folder);
+
+ ArrayList directories_out = new ArrayList ();
+
+ DirectoryInfo[] dirs = null;
+
+ try {
+ dirs = dirinfo.GetDirectories ();
+ } catch (Exception) {}
+
+ if (dirs != null)
+ for (int i = 0; i < dirs.Length; i++) {
+ directories_out.Add (GetDirectoryFSEntry (dirs [i], currentTopFolderFSEntry));
+ }
+
+ return directories_out;
+ }
+
protected virtual FSEntry GetDirectoryFSEntry (DirectoryInfo dirinfo, FSEntry topFolderFSEntry)
{
FSEntry fs = new FSEntry ();
private FSEntry mycomputerFSEntry = null;
private FSEntry mynetworkFSEntry = null;
+ private string personal_folder;
+ private string recently_used_path;
+ private string full_kde_recent_document_dir;
+
public UnixFileSystem ()
{
+ personal_folder = ThemeEngine.Current.Places (UIIcon.PlacesPersonal);
+ recently_used_path = Path.Combine (personal_folder, ".recently-used");
+
+ full_kde_recent_document_dir = personal_folder + "/.kde/share/apps/RecentDocuments";
+
desktopFSEntry = new FSEntry ();
desktopFSEntry.Attributes = FileAttributes.Directory;
desktopFSEntry.Name = "Desktop";
desktopFSEntry.RealName = ThemeEngine.Current.Places (UIIcon.PlacesDesktop);
desktopFSEntry.FileType = FSEntry.FSEntryType.Directory;
- desktopFSEntry.IconIndex = MimeIconEngine.GetIconIndexForMimeType ("deskop/desktop");
+ desktopFSEntry.IconIndex = MimeIconEngine.GetIconIndexForMimeType ("desktop/desktop");
desktopFSEntry.LastAccessTime = DateTime.Now;
recentlyusedFSEntry = new FSEntry ();
public override void WriteRecentlyUsedFiles (string fileToAdd)
{
- string personal_folder = ThemeEngine.Current.Places (UIIcon.PlacesPersonal);
- string recently_used_path = Path.Combine (personal_folder, ".recently-used");
-
if (File.Exists (recently_used_path) && new FileInfo (recently_used_path).Length > 0) {
XmlDocument xml_doc = new XmlDocument ();
xml_doc.Load (recently_used_path);
public override ArrayList GetRecentlyUsedFiles ()
{
// check for GNOME and KDE
- string personal_folder = ThemeEngine.Current.Places (UIIcon.PlacesPersonal);
- string recently_used_path = Path.Combine (personal_folder, ".recently-used");
ArrayList files_al = new ArrayList ();
}
// KDE
- string full_kde_recent_document_dir = personal_folder + "/.kde/share/apps/RecentDocuments";
-
if (Directory.Exists (full_kde_recent_document_dir)) {
string[] files = Directory.GetFiles (full_kde_recent_document_dir, "*.desktop");
desktopFSEntry.Name = "Desktop";
desktopFSEntry.RealName = ThemeEngine.Current.Places (UIIcon.PlacesDesktop);
desktopFSEntry.FileType = FSEntry.FSEntryType.Directory;
- desktopFSEntry.IconIndex = MimeIconEngine.GetIconIndexForMimeType ("deskop/desktop");
+ desktopFSEntry.IconIndex = MimeIconEngine.GetIconIndexForMimeType ("desktop/desktop");
desktopFSEntry.LastAccessTime = DateTime.Now;
recentlyusedFSEntry = new FSEntry ();
internal class MWFConfigInstance
{
- private Hashtable classes_hashtable = new Hashtable ();
-
- private string path;
- private string fullFileName;
- private XmlTextReader xtr;
- private XmlTextWriter xtw;
-
- private static string defaultFileName;
-
- private readonly string configName = "MWFConfig";
-
- private int platform = (int) Environment.OSVersion.Platform;
+ Hashtable classes_hashtable = new Hashtable ();
+ string path;
+ static string full_file_name;
+ XmlTextReader xtr;
+ XmlTextWriter xtw;
+ static string default_file_name;
+ readonly string configName = "MWFConfig";
+ static int platform = (int) Environment.OSVersion.Platform;
+
+ static bool IsUnix ()
+ {
+ return (platform == 4 || platform == 128);
+ }
+
+ static MWFConfigInstance ()
+ {
+ string b = "mwf_config";
+ string dir = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
+
+ if (IsUnix ()){
+ dir = Path.Combine (dir, ".mono");
+ try {
+ Directory.CreateDirectory (dir);
+ } catch {}
+ }
+
+ default_file_name = Path.Combine (dir, b);
+ full_file_name = default_file_name;
+ }
public MWFConfigInstance ()
{
- if ((platform == 4) || (platform == 128)) {
- defaultFileName = ".mwf_config";
- } else {
- defaultFileName = "mwf_config";
- }
-
- Open (defaultFileName);
+ Open (default_file_name);
}
// only for testing
- public MWFConfigInstance (string fileName)
+ public MWFConfigInstance (string filename)
{
- Open (fileName);
- }
+ path = Path.GetDirectoryName (filename);
+ if (path == null || path == String.Empty) {
+ path = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
+
+ full_file_name = Path.Combine (path, filename);
+ } else
+ full_file_name = filename;
+
+ Open (full_file_name);
+ }
~MWFConfigInstance ()
{
class_entry.SetValue (value_name, value);
}
- private void Open (string fileName)
+ private void Open (string filename)
{
- path = Path.GetDirectoryName (fileName);
-
- if (path == null || path == String.Empty) {
- path = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
-
- fullFileName = Path.Combine (path, fileName);
- } else
- fullFileName = fileName;
-
try {
- xtr = new XmlTextReader (fullFileName);
+ xtr = new XmlTextReader (filename);
ReadConfig ();
public void Flush ()
{
try {
- xtw = new XmlTextWriter (fullFileName, null);
+ xtw = new XmlTextWriter (full_file_name, null);
xtw.Formatting = Formatting.Indented;
WriteConfig ();
xtw.Close ();
-
- if ((platform != 4) && (platform != 128))
- File.SetAttributes (fullFileName, FileAttributes.Hidden);
- } catch (Exception) {}
+
+ if (!IsUnix ())
+ File.SetAttributes (full_file_name, FileAttributes.Hidden);
+ } catch (Exception){
+ }
}
public void RemoveClass (string class_name)