[Monodevelop-patches-list] r768 - in trunk/MonoDevelop: samples/VFS src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Tue Feb 3 18:38:03 EST 2004


Author: jluke
Date: 2004-02-03 18:38:03 -0500 (Tue, 03 Feb 2004)
New Revision: 768

Modified:
   trunk/MonoDevelop/samples/VFS/test.cs
   trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs
Log:
check for selections and existance of dirs


Modified: trunk/MonoDevelop/samples/VFS/test.cs
===================================================================
--- trunk/MonoDevelop/samples/VFS/test.cs	2004-02-03 22:30:16 UTC (rev 767)
+++ trunk/MonoDevelop/samples/VFS/test.cs	2004-02-03 23:38:03 UTC (rev 768)
@@ -8,9 +8,10 @@
 	{
 		Vfs.Init ();
 		Console.WriteLine (Vfs.Initialized);
-		string test_file = Path.Combine (Environment.CurrentDirectory, "test.txt");
+		string test_file = Path.Combine (Environment.CurrentDirectory, "test.cs");
 		if (File.Exists (test_file))
 		{
+
 			string mt = Vfs.GetMimeType (test_file);
 			Console.WriteLine (Vfs.IsKnownType (mt));
 			string icon = Vfs.GetIcon (mt);

Modified: trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs	2004-02-03 22:30:16 UTC (rev 767)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs	2004-02-03 23:38:03 UTC (rev 768)
@@ -56,13 +56,14 @@
 		{
 			store.Clear ();
 			// seems unnecessary
-			// store.AppendValues (".");
+			store.AppendValues (".");
+
 			if (currentDir != "/")
 				store.AppendValues ("..");
 
 			DirectoryInfo di = new DirectoryInfo (currentDir);
 			DirectoryInfo[] dirs = di.GetDirectories ();
-			
+	
 			foreach (DirectoryInfo d in dirs)
 			{
 				if (ignoreHidden)
@@ -81,9 +82,11 @@
 		{
 			TreeIter iter;
 			TreeModel model;
-			tv.Selection.GetSelected (out model, out iter);
-			string selection = (string) model.GetValue (iter, 0);
-			files = Directory.GetFiles (System.IO.Path.Combine (currentDir, selection));
+			if (tv.Selection.GetSelected (out model, out iter))
+			{
+				string selection = (string) store.GetValue (iter, 0);
+				files = Directory.GetFiles (System.IO.Path.Combine (currentDir, selection));
+			}
 		}
 
 		private void OnRowActivated (object o, RowActivatedArgs args)
@@ -91,8 +94,12 @@
 			TreeIter iter;
 			store.GetIter (out iter, args.Path);
 			string file = (string) store.GetValue (iter, 0);
-			currentDir = System.IO.Path.Combine (currentDir, file);
-			Populate ();
+			string newDir = System.IO.Path.Combine (currentDir, file);
+			if (Directory.Exists (newDir))
+			{
+				currentDir = newDir;
+				Populate ();
+			}
 		}
 	}
 }




More information about the Monodevelop-patches-list mailing list