[Monodevelop-patches-list] r1946 - in branches/MonoDevelop-plan-43: . src/Plugins/Content src/Plugins/Node src/Plugins/Workbench

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Mon Aug 16 11:39:04 EDT 2004


Author: jzwart
Date: 2004-08-16 11:39:04 -0400 (Mon, 16 Aug 2004)
New Revision: 1946

Modified:
   branches/MonoDevelop-plan-43/ChangeLog
   branches/MonoDevelop-plan-43/src/Plugins/Content/ContentManager.cs
   branches/MonoDevelop-plan-43/src/Plugins/Content/content.ui
   branches/MonoDevelop-plan-43/src/Plugins/Node/Buffer.cs
   branches/MonoDevelop-plan-43/src/Plugins/Workbench/workbench.ui
Log:
2004-08-16  Jeroen Zwartepoorte  <jeroen at xs4all.nl>

	* src/Plugins/Workbench/workbench.ui: remove quit action from toolbar.
	* src/Plugins/Node/Buffer.cs: add some more bits.
	* src/Plugins/Content/content.ui: add save button to toolbar.
	* src/Plugins/Content/ContentManager.cs: show message dialog when there
	aren't any FileNode's for a file type.



Modified: branches/MonoDevelop-plan-43/ChangeLog
===================================================================
--- branches/MonoDevelop-plan-43/ChangeLog	2004-08-15 21:12:38 UTC (rev 1945)
+++ branches/MonoDevelop-plan-43/ChangeLog	2004-08-16 15:39:04 UTC (rev 1946)
@@ -1,3 +1,11 @@
+2004-08-16  Jeroen Zwartepoorte  <jeroen at xs4all.nl>
+
+	* src/Plugins/Workbench/workbench.ui: remove quit action from toolbar.
+	* src/Plugins/Node/Buffer.cs: add some more bits.
+	* src/Plugins/Content/content.ui: add save button to toolbar.
+	* src/Plugins/Content/ContentManager.cs: show message dialog when there
+	aren't any FileNode's for a file type.
+
 2004-08-15  Jeroen Zwartepoorte  <jeroen at xs4all.nl>
 
 	* src/Plugins/plugins.build: add csharp.build.

Modified: branches/MonoDevelop-plan-43/src/Plugins/Content/ContentManager.cs
===================================================================
--- branches/MonoDevelop-plan-43/src/Plugins/Content/ContentManager.cs	2004-08-15 21:12:38 UTC (rev 1945)
+++ branches/MonoDevelop-plan-43/src/Plugins/Content/ContentManager.cs	2004-08-16 15:39:04 UTC (rev 1946)
@@ -37,8 +37,13 @@
 			action = new Action ("FileOpenAction", "_Open...",
 					     "Open a file", Gtk.Stock.Open);
 			action.Activated += new EventHandler (OnFileOpen);
-			group.Add (action);
+			group.Add (action, "<control>o");
 		
+			action = new Action ("FileSaveAction", "_Save",
+					     "Save the current file", Gtk.Stock.Save);
+			action.Activated += new EventHandler (OnFileSave);
+			group.Add (action, "<control>s");
+		
 			Workbench.Workbench.AddActionGroup (group);
 			Workbench.Workbench.AddUiFromFile ("content.ui");
 		}
@@ -69,11 +74,22 @@
 
 			// Find a FileNode Type for the specified mimetype.
 			FileNodeEntry entry = FileNode.FindFileNodeType (mimetype);
-			// FIXME: if the mimetype is of type text/* and there's no specific node for it,
-			// fallback to text/plain and try to open that.
+			// Fallback to text/plain if there is no specific node.
+			if (entry == null && mimetype.StartsWith ("text/"))
+				entry = FileNode.FindFileNodeType ("text/plain");
 			if (entry == null) {
-				// FIXME: popup a dialog saying there are no viewers for this mimetype.
 				log.Debug ("No matching FileNode found for mimetype \"" + mimetype + "\"");
+				string msg = "Could not open the file \"" + fcd.Filename +
+					     "\" because there is no support for this type of file" +
+					     " (" + mimetype + ").";
+				MessageDialog md = new MessageDialog ((Window)Workbench.Workbench.ActiveWorkbench,
+								      DialogFlags.Modal | DialogFlags.DestroyWithParent,
+								      MessageType.Error, ButtonsType.Ok,
+								      msg);
+				md.DefaultResponse = ResponseType.Ok;
+				md.Resizable = false;
+				md.Run ();
+				md.Destroy ();
 				return;
 			}
 
@@ -105,6 +121,10 @@
 			}
 		}
 	
+		private void OnFileSave (object obj, EventArgs e)
+		{
+		}
+
 		////////////////////////////////////////////////////////////////////////
 		// Static methods
 		////////////////////////////////////////////////////////////////////////

Modified: branches/MonoDevelop-plan-43/src/Plugins/Content/content.ui
===================================================================
--- branches/MonoDevelop-plan-43/src/Plugins/Content/content.ui	2004-08-15 21:12:38 UTC (rev 1945)
+++ branches/MonoDevelop-plan-43/src/Plugins/Content/content.ui	2004-08-16 15:39:04 UTC (rev 1946)
@@ -4,10 +4,17 @@
 		<placeholder name="FileOpenPlaceholder">
 			<menuitem name="FileOpen" action="FileOpenAction"/>
 		</placeholder>
+		<placeholder name="FileSavePlaceholder">
+			<separator/>
+			<menuitem name="FileSave" action="FileSaveAction"/>
+		</placeholder>
 	</menu>
 </menubar>
 <toolbar name="toolbar">
 	<placeholder name="FileOpenPlaceholder">
 		<toolitem name="FileOpenButton" action="FileOpenAction"/>
 	</placeholder>
+	<placeholder name="FileSavePlaceholder">
+		<toolitem name="FileSaveButton" action="FileSaveAction"/>
+	</placeholder>
 </toolbar>

Modified: branches/MonoDevelop-plan-43/src/Plugins/Node/Buffer.cs
===================================================================
--- branches/MonoDevelop-plan-43/src/Plugins/Node/Buffer.cs	2004-08-15 21:12:38 UTC (rev 1945)
+++ branches/MonoDevelop-plan-43/src/Plugins/Node/Buffer.cs	2004-08-16 15:39:04 UTC (rev 1946)
@@ -14,7 +14,9 @@
 using Gnome.Vfs;
 
 namespace MonoDevelop.Node {
-	public delegate byte[] BufferContentCallback (Buffer buffer);
+	public delegate void BufferChanged (Buffer buffer);
+	public delegate void BufferLoaded (Buffer buffer);
+	public delegate void BufferSaving (Buffer buffer);
 
 	public class Buffer {
 		private BufferContentCallback callback;
@@ -79,7 +81,7 @@
 
 		public Stream Writer {
 			get {
-				return null;
+				return new VfsStream (uri.ToString (), FileMode.Truncate);
 			}
 		}
 		

Modified: branches/MonoDevelop-plan-43/src/Plugins/Workbench/workbench.ui
===================================================================
--- branches/MonoDevelop-plan-43/src/Plugins/Workbench/workbench.ui	2004-08-15 21:12:38 UTC (rev 1945)
+++ branches/MonoDevelop-plan-43/src/Plugins/Workbench/workbench.ui	2004-08-16 15:39:04 UTC (rev 1946)
@@ -49,5 +49,4 @@
 </menubar>
 <toolbar name="toolbar">
 	<placeholder name="FileOpenPlaceholder"/>
-	<toolitem name="QuitButton" action="QuitAction"/>
 </toolbar>




More information about the Monodevelop-patches-list mailing list