[Monodevelop-patches-list] r2011 - in trunk/MonoDevelop/Core/src: Libraries/MonoDevelop.Gui.Widgets Libraries/MonoDevelop.Gui.Widgets/FileSelector Main/Base Main/Base/Commands

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Fri Oct 29 23:46:33 EDT 2004


Author: tberman
Date: 2004-10-29 23:46:33 -0400 (Fri, 29 Oct 2004)
New Revision: 2011

Modified:
   trunk/MonoDevelop/Core/src/Libraries/MonoDevelop.Gui.Widgets/ChangeLog
   trunk/MonoDevelop/Core/src/Libraries/MonoDevelop.Gui.Widgets/FileSelector/FileSelector.cs
   trunk/MonoDevelop/Core/src/Main/Base/ChangeLog
   trunk/MonoDevelop/Core/src/Main/Base/Commands/FileCommands.cs
Log:
fix Save as.


Modified: trunk/MonoDevelop/Core/src/Libraries/MonoDevelop.Gui.Widgets/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/Libraries/MonoDevelop.Gui.Widgets/ChangeLog	2004-10-30 03:32:01 UTC (rev 2010)
+++ trunk/MonoDevelop/Core/src/Libraries/MonoDevelop.Gui.Widgets/ChangeLog	2004-10-30 03:46:33 UTC (rev 2011)
@@ -1,3 +1,7 @@
+2004-10-29  Todd Berman  <tberman at off.net>
+
+	* FileSelector/FileSelector.cs: Add proper Save buttons.
+
 2004-10-16  John Luke  <john.luke at gmail.com>
 
 	* Makefile.am: remove MCS use $(CSC) from configure.in,

Modified: trunk/MonoDevelop/Core/src/Libraries/MonoDevelop.Gui.Widgets/FileSelector/FileSelector.cs
===================================================================
--- trunk/MonoDevelop/Core/src/Libraries/MonoDevelop.Gui.Widgets/FileSelector/FileSelector.cs	2004-10-30 03:32:01 UTC (rev 2010)
+++ trunk/MonoDevelop/Core/src/Libraries/MonoDevelop.Gui.Widgets/FileSelector/FileSelector.cs	2004-10-30 03:46:33 UTC (rev 2011)
@@ -35,6 +35,9 @@
 			if (action == FileChooserAction.SelectFolder) {
 				AddButton (Gtk.Stock.Cancel, ResponseType.Cancel);
 				AddButton ("Select Folder", ResponseType.Ok);
+			} else if (action == FileChooserAction.Save) {
+				AddButton (Gtk.Stock.Cancel, ResponseType.Cancel);
+				AddButton (Gtk.Stock.Save, ResponseType.Ok);
 			}
 			CommonSetup ();
 		}
@@ -72,6 +75,9 @@
 
 		void UpdateLastDir ()
 		{
+			if (this.Filename == null || this.Filename == "")
+				return;
+			
 			if (this.Filename.EndsWith ("/") || Directory.Exists (this.Filename))
 				lastPath = this.Filename;
 			else

Modified: trunk/MonoDevelop/Core/src/Main/Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/Main/Base/ChangeLog	2004-10-30 03:32:01 UTC (rev 2010)
+++ trunk/MonoDevelop/Core/src/Main/Base/ChangeLog	2004-10-30 03:46:33 UTC (rev 2011)
@@ -1,5 +1,9 @@
 2004-10-29  Todd Berman  <tberman at off.net>
 
+	* Commands/FileCommands: Fix SaveAs.
+
+2004-10-29  Todd Berman  <tberman at off.net>
+
 	* Commands/FileCommands.cs: Patch from Valters Svabe
 	<valters at inbox.lv> to close bug #62300
 

Modified: trunk/MonoDevelop/Core/src/Main/Base/Commands/FileCommands.cs
===================================================================
--- trunk/MonoDevelop/Core/src/Main/Base/Commands/FileCommands.cs	2004-10-30 03:32:01 UTC (rev 2010)
+++ trunk/MonoDevelop/Core/src/Main/Base/Commands/FileCommands.cs	2004-10-30 03:46:33 UTC (rev 2011)
@@ -153,33 +153,30 @@
 							break;
 						}
 					}*/
-					
-					using (FileSelector fdiag = new FileSelector (GettextCatalog.GetString ("Save as..."))) {
-						fdiag.SetFilename (window.ViewContent.ContentName);
-						int response = fdiag.Run ();
-						string filename = fdiag.Filename;
-						fdiag.Hide ();
-					
-					
-						if (response == (int)Gtk.ResponseType.Ok) {
-							IFileService fileService = (IFileService)MonoDevelop.Core.Services.ServiceManager.GetService(typeof(IFileService));
-							FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.GetService(typeof(FileUtilityService));
-							if (!fileUtilityService.IsValidFileName(filename)) {
-								IMessageService messageService =(IMessageService)ServiceManager.GetService(typeof(IMessageService));
-								messageService.ShowMessage(String.Format (GettextCatalog.GetString ("File name {0} is invalid"), filename));
-								return;
-							}
-
-						// save backup first
-						if((bool) PropertyService.GetProperty ("SharpDevelop.CreateBackupCopy", false)) {
-							fileUtilityService.ObservedSave(new NamedFileOperationDelegate(window.ViewContent.Save), filename + "~");
+					FileSelector fdiag = new FileSelector (GettextCatalog.GetString ("Save as..."), Gtk.FileChooserAction.Save);
+					fdiag.SetFilename (window.ViewContent.ContentName);
+					int response = fdiag.Run ();
+					string filename = fdiag.Filename;
+					fdiag.Hide ();
+				
+					if (response == (int)Gtk.ResponseType.Ok) {
+						IFileService fileService = (IFileService)MonoDevelop.Core.Services.ServiceManager.GetService(typeof(IFileService));
+						FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.GetService(typeof(FileUtilityService));
+						if (!fileUtilityService.IsValidFileName(filename)) {
+							IMessageService messageService =(IMessageService)ServiceManager.GetService(typeof(IMessageService));
+							messageService.ShowMessage(String.Format (GettextCatalog.GetString ("File name {0} is invalid"), filename));
+							return;
 						}
-						
-						// do actual save
-						if (fileUtilityService.ObservedSave(new NamedFileOperationDelegate(window.ViewContent.Save), filename) == FileOperationResult.OK) {
-							fileService.RecentOpen.AddLastFile(filename);							
-						}
+
+					// save backup first
+					if((bool) PropertyService.GetProperty ("SharpDevelop.CreateBackupCopy", false)) {
+						fileUtilityService.ObservedSave(new NamedFileOperationDelegate(window.ViewContent.Save), filename + "~");
 					}
+					
+					// do actual save
+					if (fileUtilityService.ObservedSave(new NamedFileOperationDelegate(window.ViewContent.Save), filename) == FileOperationResult.OK) {
+						fileService.RecentOpen.AddLastFile(filename);							
+					}
 				}
 			}
 		}




More information about the Monodevelop-patches-list mailing list