[Monodevelop-patches-list] r895 - trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Fri Feb 13 23:59:03 EST 2004


Author: jluke
Date: 2004-02-13 23:59:03 -0500 (Fri, 13 Feb 2004)
New Revision: 895

Modified:
   trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/ChooseLocationPanel.cs
   trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/UseExistingFilePanel.cs
Log:
selecting an existing location should now work
make default user application dir (~/.MonoDevelop)


Modified: trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/ChooseLocationPanel.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/ChooseLocationPanel.cs	2004-02-14 04:03:49 UTC (rev 894)
+++ trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/ChooseLocationPanel.cs	2004-02-14 04:59:03 UTC (rev 895)
@@ -13,7 +13,6 @@
 using ICSharpCode.SharpDevelop.Internal.Project;
 using ICSharpCode.Core.Properties;
 using ICSharpCode.Core.Services;
-
 using ICSharpCode.Core.AddIns.Codons;
 
 namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard
@@ -23,20 +22,18 @@
 		IProperties properties;
 		static FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
 		
-		Button browseButton;
 		RadioButton specifyLocationRadioButton;
 		RadioButton sharpDevelopDirRadioButton;
-		Entry locationTextBox = new Entry ();
+		FolderEntry fEntry;
 		
 		public override bool ReceiveDialogMessage(DialogMessage message)
 		{
-			//Console.WriteLine ("Inside ReceiveDialogMessage");
 			if (message == DialogMessage.Cancel) {
 				properties.SetProperty("SharpDevelop.CodeCompletion.DataDirectory", String.Empty);
 			} else if (message == DialogMessage.Next || message == DialogMessage.OK) {
 				string path = null;				
 				if (specifyLocationRadioButton.Active) {
-					path = locationTextBox.Text.TrimEnd (System.IO.Path.DirectorySeparatorChar);
+					path = fEntry.Path.TrimEnd (System.IO.Path.DirectorySeparatorChar);
 				} else if (sharpDevelopDirRadioButton.Active) {
 					FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
 					PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
@@ -52,7 +49,6 @@
 					Directory.CreateDirectory(path);
 				}
 				
-				//Console.WriteLine ("Setting path to: " + path);
 				properties.SetProperty("SharpDevelop.CodeCompletion.DataDirectory", path);
 				propertyService.SetProperty ("SharpDevelop.CodeCompletion.DataDirectory", path);
 				propertyService.SaveProperties ();
@@ -64,7 +60,7 @@
 		{
 			try
 			{
-				browseButton.Sensitive = locationTextBox.Sensitive = specifyLocationRadioButton.Active;
+				fEntry.Sensitive = specifyLocationRadioButton.Active;
 			}
 			catch
 			{
@@ -73,24 +69,14 @@
 			SetFinishedState(sender, e);
 		}
 		
-		void BrowseLocationEvent(object sender, EventArgs e)
-		{
-			FolderDialog fd = new FolderDialog ("choose the location in which you want the code completion files to be generated");
-			int response = fd.Run ();
-			fd.Hide ();
-			if (response == (int) ResponseType.Ok) {
-				locationTextBox.Text = fd.Filename;
-			}
-		}
-		
 		void SetFinishedState(object sender, EventArgs e)
 		{
 			FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
 			try
 			{
 				EnableFinish = EnableNext = !specifyLocationRadioButton.Active ||
-  			                            (fileUtilityService.IsValidFileName(locationTextBox.Text) && 
-  			                            Directory.Exists(locationTextBox.Text));
+  			                            (fileUtilityService.IsValidFileName(fEntry.Path) && 
+  			                            Directory.Exists(fEntry.Path));
 			}
 			catch
 			{
@@ -109,17 +95,16 @@
 			VBox mainVBox = new VBox (false, 0);
 			NextWizardPanelID = "CreateDatabasePanel";
 			
-			browseButton = new Button ("...");
-			browseButton.Clicked += new EventHandler (BrowseLocationEvent);
+			fEntry = new FolderEntry ("Choose completion database location");
+			fEntry.DefaultPath = Environment.GetEnvironmentVariable ("HOME");
+			fEntry.PathChanged += new EventHandler (SetFinishedState);
 			
-			locationTextBox.Changed += new EventHandler (SetFinishedState);
-			
 			ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
 			
 			RadioButton appDirRadioButton = new RadioButton ("Use current user's application directory");
+			appDirRadioButton.Active = true;
 			appDirRadioButton.Toggled += new EventHandler (SetEnableStatus);
 			sharpDevelopDirRadioButton = new RadioButton (appDirRadioButton, "Use SharpDevelop application directory");
-			sharpDevelopDirRadioButton.Active = true;
 			sharpDevelopDirRadioButton.Toggled += new EventHandler (SetEnableStatus);
 			specifyLocationRadioButton = new RadioButton (appDirRadioButton, "Specify code completion database location");
 			specifyLocationRadioButton.Toggled += new EventHandler (SetEnableStatus);
@@ -131,8 +116,7 @@
 			t.WrapMode = Gtk.WrapMode.Word;
 			
 			HBox hbox = new HBox (false, 0);
-			hbox.PackStart (locationTextBox);
-			hbox.PackStart (browseButton, false, false, 3);
+			hbox.PackStart (fEntry);
 		
 			mainVBox.PackStart (t, true, true, 0);
 			mainVBox.PackStart (specifyLocationRadioButton, false, true, 6);

Modified: trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/UseExistingFilePanel.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/UseExistingFilePanel.cs	2004-02-14 04:03:49 UTC (rev 894)
+++ trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/UseExistingFilePanel.cs	2004-02-14 04:59:03 UTC (rev 895)
@@ -51,8 +51,9 @@
 			               Directory.Exists(path) && 
 			               File.Exists(fileUtilityService.GetDirectoryNameWithSeparator(path) + "CodeCompletionProxyDataV02.bin");
 			if (EnableFinish) {
-				properties.SetProperty("SharpDevelop.CodeCompletion.DataDirectory",
-				                       path);
+				properties.SetProperty("SharpDevelop.CodeCompletion.DataDirectory", path);
+				propertyService.SetProperty ("SharpDevelop.CodeCompletion.DataDirectory", path);
+				propertyService.SaveProperties ();
 			}
 		}
 		




More information about the Monodevelop-patches-list mailing list