gnome-subtitles r992 - trunk/src/GnomeSubtitles/Core



Author: pcastro
Date: Sat Jun  7 21:21:49 2008
New Revision: 992
URL: http://svn.gnome.org/viewvc/gnome-subtitles?rev=992&view=rev

Log:
Fixed bug with Undo/Redo buttons not being updated. This happened when 
opening a file after a new file was created, because CommandManager 
wasn't cleared up.


Modified:
   trunk/src/GnomeSubtitles/Core/GUI.cs
   trunk/src/GnomeSubtitles/Core/Global.cs

Modified: trunk/src/GnomeSubtitles/Core/GUI.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/GUI.cs	(original)
+++ trunk/src/GnomeSubtitles/Core/GUI.cs	Sat Jun  7 21:21:49 2008
@@ -118,10 +118,12 @@
     	if (!ToCreateNewAfterWarning())
     		return;
 
-		if (path == String.Empty)
+		if (path == String.Empty) {
+			//To translators: this is the filename for new files (before being saved)
 			path = Catalog.GetString("Unsaved Subtitles");
+		}
 
-		Global.CreateDocument(path);
+		Global.CreateDocumentNew(path);
 
 		if (Global.Document.Subtitles.Count == 0) {
 			Global.CommandManager.Execute(new InsertFirstSubtitleCommand());
@@ -304,7 +306,7 @@
     private void Open (string path, int codePage, string videoFilename) {
     	try {
     		Encoding encoding =  CodePageToEncoding(codePage);
-    		Global.CreateDocument(path, encoding);
+    		Global.CreateDocumentOpen(path, encoding);
 			view.Selection.SelectFirst(); //TODO is this needed?
 		
 			if (videoFilename != String.Empty)

Modified: trunk/src/GnomeSubtitles/Core/Global.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Global.cs	(original)
+++ trunk/src/GnomeSubtitles/Core/Global.cs	Sat Jun  7 21:21:49 2008
@@ -129,7 +129,7 @@
 		execution.QuitProgram();
 	}
 	
-	public static void CreateDocument (string path) {
+	public static void CreateDocumentNew (string path) {
 		bool wasLoaded = IsDocumentLoaded;
 		document = new Document(path, wasLoaded);
 		
@@ -138,10 +138,11 @@
 		GUI.UpdateFromNewDocument(wasLoaded);		
 	}
 	
-	public static void CreateDocument (string path, Encoding encoding) {
+	public static void CreateDocumentOpen (string path, Encoding encoding) {
 		bool wasLoaded = IsDocumentLoaded;
 		document = new Document(path, encoding, wasLoaded);
 
+		CommandManager.Clear();
 		TimingMode = document.TextFile.TimingMode;
 		GUI.UpdateFromDocumentModified(false);
 		GUI.UpdateFromNewDocument(wasLoaded);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]