gnome-subtitles r1021 - trunk/src/GnomeSubtitles/Dialog



Author: pcastro
Date: Sat Jul 12 18:47:39 2008
New Revision: 1021
URL: http://svn.gnome.org/viewvc/gnome-subtitles?rev=1021&view=rev

Log:
Moved encodingComboBox declarations to Open and SaveAs dialogs, instead of SubtitleFileChooser dialog. This keeps the application from crashing with mono 1.9 (fixes #540009).

Modified:
   trunk/src/GnomeSubtitles/Dialog/FileOpenDialog.cs
   trunk/src/GnomeSubtitles/Dialog/FileSaveAsDialog.cs
   trunk/src/GnomeSubtitles/Dialog/SubtitleFileChooserDialog.cs

Modified: trunk/src/GnomeSubtitles/Dialog/FileOpenDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/FileOpenDialog.cs	(original)
+++ trunk/src/GnomeSubtitles/Dialog/FileOpenDialog.cs	Sat Jul 12 18:47:39 2008
@@ -42,6 +42,7 @@
 	private const string gladeFilename = "FileOpenDialog.glade";
 
 	/* Widgets */
+	[WidgetAttribute] private ComboBox encodingComboBox = null;
 	[WidgetAttribute] private ComboBox videoComboBox = null;
 	[WidgetAttribute] private Label videoLabel = null;
 	
@@ -69,8 +70,6 @@
 		
 		dialog.CurrentFolderChanged += OnCurrentFolderChanged;
 		dialog.SelectionChanged += OnSelectionChanged;
-
-	
 	}
 	
 	/* Public properties */
@@ -92,11 +91,15 @@
 			return Environment.GetFolderPath(Environment.SpecialFolder.Personal);
 	}
 	
-	protected override void AddInitialEncodingComboBoxItems (ComboBox comboBox) {
-		comboBox.AppendText(Catalog.GetString("Auto Detected"));
-		comboBox.AppendText("-");
+	protected override void AddInitialEncodingComboBoxItems () {
+		encodingComboBox.AppendText(Catalog.GetString("Auto Detected"));
+		encodingComboBox.AppendText("-");
 	}
-	
+
+	protected override ComboBox GetEncodingComboBox () {
+		return encodingComboBox;
+	}
+
 	/* Private members */
 	
 	private void FillVideoComboBoxBasedOnCurrentFolder () {
@@ -253,7 +256,7 @@
 				int videoFileIndex = videoComboBox.Active - 2;
 				chosenVideoFilename = videoFiles[videoFileIndex] as string;
 			}			
-			actionDone = true;
+			returnValue = true;
 		}
 		Close();
 	}

Modified: trunk/src/GnomeSubtitles/Dialog/FileSaveAsDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/FileSaveAsDialog.cs	(original)
+++ trunk/src/GnomeSubtitles/Dialog/FileSaveAsDialog.cs	Sat Jul 12 18:47:39 2008
@@ -39,6 +39,7 @@
 	
 	/* Widgets */
 	
+	[WidgetAttribute] private ComboBox encodingComboBox = null;
 	[WidgetAttribute] private ComboBox formatComboBox = null;
 	[WidgetAttribute] private ComboBox newlineTypeComboBox = null;
 
@@ -77,6 +78,10 @@
 		}
 	}
 	
+	protected override ComboBox GetEncodingComboBox () {
+		return encodingComboBox;
+	}
+	
 	/* Private members */
 	
 	private void SetTitle () {
@@ -292,7 +297,7 @@
 			
 			int encodingIndex = GetActiveEncodingComboBoxItem();
 			chosenEncoding = encodings[encodingIndex];
-			actionDone = true;
+			returnValue = true;
 			
 			chosenNewlineType = GetChosenNewlineType();
 		}

Modified: trunk/src/GnomeSubtitles/Dialog/SubtitleFileChooserDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/SubtitleFileChooserDialog.cs	(original)
+++ trunk/src/GnomeSubtitles/Dialog/SubtitleFileChooserDialog.cs	Sat Jul 12 18:47:39 2008
@@ -30,6 +30,7 @@
 public abstract class SubtitleFileChooserDialog : GladeDialog {
 	private int fixedEncoding = -1;
 	private bool isEncodingsChangeSilent = false; //used to indicate whether a change in the encodings list should be taken into account
+	private ComboBox encodingComboBox = null;
 
 	/* Protected variables */
 	protected new FileChooserDialog dialog = null;
@@ -40,9 +41,6 @@
 	
 	protected EncodingDescription[] encodings = null;
 
-	/* Widgets */
-	
-	[WidgetAttribute] private ComboBox encodingComboBox = null;
 
 	protected SubtitleFileChooserDialog (string filename, bool persistent) : base(filename, persistent, true) {
 		dialog = base.dialog as FileChooserDialog;
@@ -69,7 +67,9 @@
 	/* Protected members */
 
 	protected void SetEncodingComboBox () {
-		AddInitialEncodingComboBoxItems(encodingComboBox);
+		encodingComboBox = GetEncodingComboBox();
+
+		AddInitialEncodingComboBoxItems();		
 		encodingComboBox.RowSeparatorFunc = SeparatorFunc;
 		FillEncodingComboBox(Base.Config.PrefsEncodingsShownInMenu);
 	}
@@ -89,9 +89,13 @@
 		return -1;
 	}
 	
-	protected virtual void AddInitialEncodingComboBoxItems (ComboBox comboBox) {
+	protected virtual void AddInitialEncodingComboBoxItems () {
 	}
 	
+	/* Abstract members */
+	
+	protected abstract ComboBox GetEncodingComboBox ();
+	
 	
 	
 	/* Private members */



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