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



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

Log:
Added util class.
Refactored the dialog classes in order to use BaseDialog.

Added:
   trunk/src/GnomeSubtitles/Dialog/BaseDialog.cs
   trunk/src/GnomeSubtitles/Dialog/MessageDialog.cs
   trunk/src/GnomeSubtitles/Dialog/Util.cs
   trunk/src/GnomeSubtitles/Dialog/WarningDialog.cs
Modified:
   trunk/src/GnomeSubtitles/Dialog/AboutDialog.cs
   trunk/src/GnomeSubtitles/Dialog/EncodingsDialog.cs
   trunk/src/GnomeSubtitles/Dialog/ErrorDialog.cs
   trunk/src/GnomeSubtitles/Dialog/GladeDialog.cs
   trunk/src/GnomeSubtitles/Dialog/ReportBugWindow.cs
   trunk/src/GnomeSubtitles/Dialog/SaveConfirmationDialog.cs
   trunk/src/GnomeSubtitles/Dialog/SetLanguageDialog.cs
   trunk/src/GnomeSubtitles/Dialog/TimingsAdjustDialog.cs
   trunk/src/GnomeSubtitles/Dialog/TimingsShiftDialog.cs
   trunk/src/GnomeSubtitles/Dialog/VideoOpenDialog.cs

Modified: trunk/src/GnomeSubtitles/Dialog/AboutDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/AboutDialog.cs	(original)
+++ trunk/src/GnomeSubtitles/Dialog/AboutDialog.cs	Sat Jul 12 18:46:41 2008
@@ -48,11 +48,11 @@
 	}
 	
 	private void AboutDialogOpenUrl (Gtk.AboutDialog about, string url) {
-		Util.OpenUrl(url);
+		Core.Util.OpenUrl(url);
 	}
 	
 	private void AboutDialogOpenEmail (Gtk.AboutDialog about, string email) {
-		Util.OpenSendEmail(email);
+		Core.Util.OpenSendEmail(email);
 	}
 	
 	#pragma warning disable 618 //TODO Name has been deprecated

Added: trunk/src/GnomeSubtitles/Dialog/BaseDialog.cs
==============================================================================
--- (empty file)
+++ trunk/src/GnomeSubtitles/Dialog/BaseDialog.cs	Sat Jul 12 18:46:41 2008
@@ -0,0 +1,69 @@
+/*
+ * This file is part of Gnome Subtitles.
+ * Copyright (C) 2008 Pedro Castro
+ *
+ * Gnome Subtitles is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Gnome Subtitles is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+using Gtk;
+
+namespace GnomeSubtitles.Dialog {
+
+public abstract class BaseDialog {
+	
+	#region Protected variables
+	protected Gtk.Dialog dialog = null;
+	protected bool returnValue = false;
+	#endregion
+
+	public BaseDialog () {
+
+	}
+	
+	
+	#region Public methods
+	
+	public virtual void Show () {
+		dialog.Visible = true;
+	}
+	
+	public void Close() {
+		dialog.Destroy();
+	}
+	
+	public void Hide () {
+		dialog.Visible = false;
+	}
+	
+	public bool WaitForResponse () {
+		dialog.Run();
+		return returnValue;
+	}
+	
+	#endregion
+	
+	
+	#region Events
+	
+	protected void OnDeleteDoHide (object o, DeleteEventArgs args) {
+		Hide();
+		args.RetVal = true;
+	}
+	
+	#endregion
+
+}
+
+}

Modified: trunk/src/GnomeSubtitles/Dialog/EncodingsDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/EncodingsDialog.cs	(original)
+++ trunk/src/GnomeSubtitles/Dialog/EncodingsDialog.cs	Sat Jul 12 18:46:41 2008
@@ -105,7 +105,7 @@
 		if (path == null)
 			return;
 		
-		int encodingNumber = Util.PathToInt(path);
+		int encodingNumber = Core.Util.PathToInt(path);
 		EncodingDescription desc = Encodings.All[encodingNumber];
 		
 		AddToShownEncodings(desc);	

Modified: trunk/src/GnomeSubtitles/Dialog/ErrorDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/ErrorDialog.cs	(original)
+++ trunk/src/GnomeSubtitles/Dialog/ErrorDialog.cs	Sat Jul 12 18:46:41 2008
@@ -17,57 +17,30 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-using GnomeSubtitles.Dialog;
 using Gtk;
 using Mono.Unix;
 using System;
 
 namespace GnomeSubtitles.Dialog {
 
-public abstract class ErrorDialog : GladeDialog {
-	protected new MessageDialog dialog = null;
-	
-	/* Strings */
-	private const string gladeFilename = "ErrorDialog.glade";
+public abstract class ErrorDialog : MessageDialog {
 
 	/// <summary>Creates a new instance of the <see cref="ErrorDialog" /> class.</summary>
 	/// <remarks><see cref="SetText" /> can be used to set the dialog text, and <see cref="AddButtons" /> overriden to add buttons.</remarks>
-	public ErrorDialog () : base(gladeFilename) {
-		dialog = base.dialog as MessageDialog;
-		
-		AddButtons();
+	public ErrorDialog () : base(MessageType.Error) {
 	}
 	
-	public ErrorDialog (string primary, string secondary) : this() {
-		SetText(primary, secondary);
+	public ErrorDialog (string primary, string secondary) : base(MessageType.Error, primary, secondary) {
 	}
 	
-	/* Protected methods */
-	
-	protected void SetText (string primary, string secondary) {
-		string text = "<span weight=\"bold\" size=\"larger\">" + primary + "</span>\n\n" + secondary;
-		dialog.Markup = text; //Markup has to be used as the Text property is only available from GTK# 2.10	
-	}
 	
+	#region Protected methods
+
 	protected string GetGeneralExceptionErrorMessage (Exception exception) {
 		return Catalog.GetString("An unknown error has occured. Please report a bug and include this error name:") + " \"" + exception.GetType() + "\".";
 	}
 	
-	/* Abstract methods */
-	
-	protected abstract void AddButtons ();
-
-	/* Event members */
-	
-	#pragma warning disable 169		//Disables warning about handlers not being used
-	
-	private void OnResponse (object o, ResponseArgs args) {
-		ResponseType response = args.ResponseId;
-		if (response == ResponseType.Accept) {
-			actionDone = true;
-		}
-		Close();
-	}
+	#endregion
 
 }
 

Modified: trunk/src/GnomeSubtitles/Dialog/GladeDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/GladeDialog.cs	(original)
+++ trunk/src/GnomeSubtitles/Dialog/GladeDialog.cs	Sat Jul 12 18:46:41 2008
@@ -23,19 +23,14 @@
 
 namespace GnomeSubtitles.Dialog {
 
-public class GladeDialog {
+public class GladeDialog : BaseDialog {
 	private Glade.XML glade = null;
-	
-	/* protected variables */
-	protected Gtk.Dialog dialog = null;
-	protected bool actionDone = false;
-	
 
 	/// <summary>Creates a new instance of the <see cref="GladeDialog" /> class.</summary>
 	/// <remarks>The dialog isn't initialized. A call to <see cref="Init" /> is required to initialize this class.
 	/// This is useful if one needs to do some operations before creating the dialog.</remarks>
 	protected GladeDialog () {
-	}	
+	}
 
 	/// <summary>Creates a new instance of the <see cref="GladeDialog" /> class, given the filename of the dialog
 	/// and persistency possibility.</summary>
@@ -48,23 +43,6 @@
 		Init(filename, persistent, autoconnect);
 	}
 	
-	public bool WaitForResponse () {
-		dialog.Run();
-		return actionDone;
-	}
-		
-	public virtual void Show () {
-		dialog.Visible = true;
-	}
-	
-	public void Close() {
-		dialog.Destroy();
-	}
-	
-	public void Hide () {
-		dialog.Visible = false;
-	}
-	
 	/* Protected members */
 	
 	/// <summary>Constructs the dialog in the specified filename.</param> 
@@ -91,25 +69,16 @@
 
 		dialog = glade.GetWidget("dialog") as Gtk.Dialog;
 		
-		Window window = Core.Base.Ui.Window;
-		dialog.TransientFor = window;
-		dialog.Icon = window.Icon;
+		Util.SetBaseWindowToUi(dialog);
 		
 		if (persistent)
-			dialog.DeleteEvent += OnDelete;
+			dialog.DeleteEvent += OnDeleteDoHide;
 	}
 	
 	protected void Autoconnect () {
 		glade.Autoconnect(this);
 	}
 
-	/* Event members */
-	
-	private void OnDelete (object o, DeleteEventArgs args) {
-		Hide();
-		args.RetVal = true;
-	}
-
 }
 
 }

Added: trunk/src/GnomeSubtitles/Dialog/MessageDialog.cs
==============================================================================
--- (empty file)
+++ trunk/src/GnomeSubtitles/Dialog/MessageDialog.cs	Sat Jul 12 18:46:41 2008
@@ -0,0 +1,106 @@
+/*
+ * This file is part of Gnome Subtitles.
+ * Copyright (C) 2008 Pedro Castro
+ *
+ * Gnome Subtitles is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Gnome Subtitles is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+using GnomeSubtitles.Core;
+using Gtk;
+using System;
+
+namespace GnomeSubtitles.Dialog {
+	
+	public abstract class MessageDialog : BaseDialog {
+		protected new Gtk.MessageDialog dialog = null;
+
+		public MessageDialog (MessageType messageType) : this(messageType, null, null, null) {
+		}
+
+		public MessageDialog (MessageType messageType, string primaryText, params object[]primaryTextArgs) : this(messageType, primaryText, null, primaryTextArgs) {
+		}
+
+		public MessageDialog (MessageType messageType, string primaryText, string secondaryText) : this(messageType, primaryText, secondaryText, null) {
+		}
+		
+		public MessageDialog (MessageType messageType, string primaryText, string secondaryText, params object[]primaryTextArgs) : base() {
+			dialog = new Gtk.MessageDialog(Base.Ui.Window, DialogFlags.Modal, messageType, ButtonsType.None, primaryText, primaryTextArgs);
+			base.dialog = dialog;
+			
+			dialog.Response += OnResponse;
+
+			SetSecondaryText(secondaryText);
+
+			Util.SetBaseWindowToUi(dialog);
+			AddButtons();
+		}
+		
+		
+		#region Protected methods
+	
+		protected void SetText (string primaryText, string secondaryText, params object[] primaryTextArgs) {
+			SetPrimaryText(primaryText, primaryTextArgs);
+			SetSecondaryText(secondaryText);
+		}
+	
+		protected void SetText (string primaryText, string secondaryText) {
+			SetPrimaryText(primaryText);
+			SetSecondaryText(secondaryText);
+		}
+	
+		protected void SetPrimaryText (string text, params object[] textArgs) {
+			if (text != null)
+				dialog.Text = Core.Util.GetFormattedText(text, textArgs);
+		}
+		
+		protected void SetPrimaryText (string text) {
+			SetPrimaryText(text, null);
+		}
+		
+		protected void SetSecondaryText (string text, params object[] textArgs) {
+			if (text != null)
+				dialog.SecondaryText = Core.Util.GetFormattedText(text, textArgs);
+		}
+		
+		protected void SetSecondaryText (string text) {
+			SetSecondaryText(text, null);
+		}
+
+		#endregion
+		
+		
+		#region Abstract methods
+		
+		protected abstract void AddButtons ();
+		
+		#endregion
+
+		
+		#region Event members
+	
+		protected virtual void OnResponse (object o, ResponseArgs args) {
+			ResponseType response = args.ResponseId;
+			if (response == ResponseType.Accept) {
+				returnValue = true;
+			}
+			Close();
+		}
+		
+		#endregion
+		
+	}
+
+	
+}

Modified: trunk/src/GnomeSubtitles/Dialog/ReportBugWindow.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/ReportBugWindow.cs	(original)
+++ trunk/src/GnomeSubtitles/Dialog/ReportBugWindow.cs	Sat Jul 12 18:46:41 2008
@@ -65,7 +65,7 @@
 	}
 	
 	private void OnOpenWebForm (object o, EventArgs args) {
-		if (!Util.OpenBugReport())
+		if (!Core.Util.OpenBugReport())
 			Console.Error.WriteLine("Could not open web form");
 	}
 	

Modified: trunk/src/GnomeSubtitles/Dialog/SaveConfirmationDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/SaveConfirmationDialog.cs	(original)
+++ trunk/src/GnomeSubtitles/Dialog/SaveConfirmationDialog.cs	Sat Jul 12 18:46:41 2008
@@ -25,71 +25,85 @@
 
 namespace GnomeSubtitles.Dialog {
 
-public class SaveConfirmationDialog {
-	private MessageDialog dialog = null;
-	private bool toClose = false;
+public abstract class SaveConfirmationDialog : WarningDialog {
 	private SubtitleTextType textType;
 	
-	/* Strings */
+	#region Strings
 	private string secondaryText = Catalog.GetString("If you don't save, all your changes will be permanently lost.");
+	#endregion
 
 
-	public SaveConfirmationDialog (string primaryText, string rejectLabel, SubtitleTextType textType) {
+	public SaveConfirmationDialog (string primaryText, SubtitleTextType textType) : base() {
 		this.textType = textType;
 	
-		string message = "<span weight=\"bold\" size=\"larger\">" + primaryText + "</span>\n\n" + secondaryText;
 		string fileName = (textType == SubtitleTextType.Text ? Base.Document.TextFile.Filename : Base.Document.TranslationFile.Filename);
-		dialog = new MessageDialog(Core.Base.Ui.Window, DialogFlags.Modal, MessageType.Warning,
-			ButtonsType.None, message, fileName);
+		SetText(primaryText, secondaryText, fileName);
+	}
+	
+	
+	#region Abstract methods
+	
+	protected abstract string GetRejectLabel ();
+	
+	#endregion
+	
+
+	#region Protected methods
 	
+	protected override void AddButtons () {
+		string rejectLabel = GetRejectLabel();
 		dialog.AddButton(rejectLabel, ResponseType.Reject);
 		dialog.AddButton(Stock.Cancel, ResponseType.Cancel);
 		dialog.AddButton(Stock.Save, ResponseType.Accept);
-		dialog.Title = String.Empty;
-		
-		dialog.Response += OnResponse;
 	}
 	
-	public bool WaitForResponse () {
-		dialog.Run();
-		return toClose;
-	}
+	#endregion
+	
 	
-	/* Event handlers */
+	#region Events
 	
-	private void OnResponse (object o, ResponseArgs args) {
-		CloseDialog();
+	protected override void OnResponse (object o, ResponseArgs args) {
+		Close();
 
 		ResponseType response = args.ResponseId;
 		if (response == ResponseType.Reject)
-			toClose = true;
+			returnValue = true;
 		else if (response == ResponseType.Accept) {
 			if (textType == SubtitleTextType.Text)
-				toClose = Core.Base.Ui.Save();
+				returnValue = Core.Base.Ui.Save();
 			else
-				toClose = Core.Base.Ui.TranslationSave();
+				returnValue = Core.Base.Ui.TranslationSave();
 		}
 	}
 	
-	/* Private members */
-	
-	private void CloseDialog() {
-		dialog.Destroy();
-	}
-	
+	#endregion
+
 }
 
 /* Confirmation dialogs for New operations */
 
 public class SaveSubtitlesOnNewFileConfirmationDialog : SaveConfirmationDialog {
+
+	#region Strings
 	private static string primaryText = Catalog.GetString("Save the changes to subtitles \"{0}\" before creating new subtitles?");
 	private static string rejectLabel = Catalog.GetString("Create without Saving");
+	#endregion
 
-	public SaveSubtitlesOnNewFileConfirmationDialog () : base(primaryText, rejectLabel, SubtitleTextType.Text) {
+	public SaveSubtitlesOnNewFileConfirmationDialog () : base(primaryText, SubtitleTextType.Text) {
 	}
 	
-	public SaveSubtitlesOnNewFileConfirmationDialog (string primaryText, SubtitleTextType textType) : base(primaryText, rejectLabel, textType) {
+	public SaveSubtitlesOnNewFileConfirmationDialog (string primaryText, SubtitleTextType textType) : base(primaryText, textType) {
 	}
+	
+	
+	#region Protected methods
+	
+	protected override string GetRejectLabel ()
+	{
+		return rejectLabel;
+	}
+	
+	#endregion
 }
 
 public class SaveTranslationOnNewFileConfirmationDialog : SaveSubtitlesOnNewFileConfirmationDialog {
@@ -113,11 +127,20 @@
 	private static string primaryText = Catalog.GetString("Save the changes to subtitles \"{0}\" before opening?");
 	private static string rejectLabel = Catalog.GetString("Open without Saving");
 
-	public SaveSubtitlesOnOpenFileConfirmationDialog () : base(primaryText, rejectLabel, SubtitleTextType.Text) {
+	public SaveSubtitlesOnOpenFileConfirmationDialog () : base(primaryText, SubtitleTextType.Text) {
 	}
 	
-	public SaveSubtitlesOnOpenFileConfirmationDialog (string primaryText, SubtitleTextType textType) : base (primaryText, rejectLabel, textType) {
+	public SaveSubtitlesOnOpenFileConfirmationDialog (string primaryText, SubtitleTextType textType) : base (primaryText, textType) {
 	}
+	
+	#region Protected methods
+	
+	protected override string GetRejectLabel ()
+	{
+		return rejectLabel;
+	}
+	
+	#endregion
 }
 
 //This works both for file open and translation open
@@ -134,11 +157,20 @@
 	private static string primaryText = Catalog.GetString("Save the changes to subtitles \"{0}\" before closing?");
 	private static string rejectLabel = Catalog.GetString("Close without Saving");
 
-	public SaveSubtitlesOnCloseFileConfirmationDialog () : base(primaryText, rejectLabel, SubtitleTextType.Text) {
+	public SaveSubtitlesOnCloseFileConfirmationDialog () : base(primaryText, SubtitleTextType.Text) {
+	}
+	
+	public SaveSubtitlesOnCloseFileConfirmationDialog (string primaryText, SubtitleTextType textType) : base(primaryText, textType) {
 	}
 	
-	public SaveSubtitlesOnCloseFileConfirmationDialog (string primaryText, SubtitleTextType textType) : base(primaryText, rejectLabel, textType) {
+	#region Protected methods
+	
+	protected override string GetRejectLabel ()
+	{
+		return rejectLabel;
 	}
+	
+	#endregion
 }
 
 public class SaveTranslationOnCloseConfirmationDialog : SaveSubtitlesOnCloseFileConfirmationDialog {

Modified: trunk/src/GnomeSubtitles/Dialog/SetLanguageDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/SetLanguageDialog.cs	(original)
+++ trunk/src/GnomeSubtitles/Dialog/SetLanguageDialog.cs	Sat Jul 12 18:46:41 2008
@@ -76,7 +76,7 @@
 		
 		int activeLanguageIndex = GetActiveLanguageIndex(textType, count);
 		
-		TreePath path = Util.IntToPath(activeLanguageIndex);
+		TreePath path = Core.Util.IntToPath(activeLanguageIndex);
 		languagesTreeView.ScrollToCell(path, null, true, 0.5f, 0.5f);
    		languagesTreeView.SetCursor(path, null, false);
 	}
@@ -104,7 +104,7 @@
 		if (path == null)
 			return -1;
 			
-		return Util.PathToInt(path);
+		return Core.Util.PathToInt(path);
 	}
 	
 	private TreePath GetSelectedPath (TreeView tree) {

Modified: trunk/src/GnomeSubtitles/Dialog/TimingsAdjustDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/TimingsAdjustDialog.cs	(original)
+++ trunk/src/GnomeSubtitles/Dialog/TimingsAdjustDialog.cs	Sat Jul 12 18:46:41 2008
@@ -58,7 +58,7 @@
 	}
 	
 	private void SetSpinButtons () {
-		int width = Util.SpinButtonTimeWidth(firstSubtitleNewStartSpinButton);
+		int width = Core.Util.SpinButtonTimeWidth(firstSubtitleNewStartSpinButton);
 		firstSubtitleNewStartSpinButton.WidthRequest = width;
 		lastSubtitleNewStartSpinButton.WidthRequest = width;
 	}
@@ -69,8 +69,8 @@
 			firstSubtitleStartLabel.Text = startLabel;
 			lastSubtitleStartLabel.Text = startLabel;
 		}
-		Util.SetSpinButtonTimingMode(firstSubtitleNewStartSpinButton, timingMode, false);
-		Util.SetSpinButtonTimingMode(lastSubtitleNewStartSpinButton, timingMode, false);
+		Core.Util.SetSpinButtonTimingMode(firstSubtitleNewStartSpinButton, timingMode, false);
+		Core.Util.SetSpinButtonTimingMode(lastSubtitleNewStartSpinButton, timingMode, false);
 	}	
 
 	private void SetApplyToAll () {
@@ -112,9 +112,9 @@
 			lastSubtitleNewStartSpinButton.Value = lastSubtitle.Frames.Start;
 		}
 		else {
-			firstSubtitleStartInputLabel.Text = Util.TimeSpanToText(firstSubtitle.Times.Start);
+			firstSubtitleStartInputLabel.Text = Core.Util.TimeSpanToText(firstSubtitle.Times.Start);
 			firstSubtitleNewStartSpinButton.Value = firstSubtitle.Times.Start.TotalMilliseconds;
-			lastSubtitleStartInputLabel.Text = Util.TimeSpanToText(lastSubtitle.Times.Start);
+			lastSubtitleStartInputLabel.Text = Core.Util.TimeSpanToText(lastSubtitle.Times.Start);
 			lastSubtitleNewStartSpinButton.Value = lastSubtitle.Times.Start.TotalMilliseconds;
 		}
 	}

Modified: trunk/src/GnomeSubtitles/Dialog/TimingsShiftDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/TimingsShiftDialog.cs	(original)
+++ trunk/src/GnomeSubtitles/Dialog/TimingsShiftDialog.cs	Sat Jul 12 18:46:41 2008
@@ -61,7 +61,7 @@
 	}
 	
 	private void InitSpinButton () {
-		spinButton.WidthRequest = Util.SpinButtonTimeWidth(spinButton);
+		spinButton.WidthRequest = Core.Util.SpinButtonTimeWidth(spinButton);
 		spinButton.Alignment = 0.5f;
 	}
 
@@ -70,7 +70,7 @@
 			return;
 			
 		timingMode = newTimingMode;	
-		Util.SetSpinButtonTimingMode(spinButton, timingMode, true);
+		Core.Util.SetSpinButtonTimingMode(spinButton, timingMode, true);
 		
 		string label = (timingMode == TimingMode.Times ? Catalog.GetString("Time") : Catalog.GetString("Frames"));
 		string markup = "<b>" + label + "</b>";

Added: trunk/src/GnomeSubtitles/Dialog/Util.cs
==============================================================================
--- (empty file)
+++ trunk/src/GnomeSubtitles/Dialog/Util.cs	Sat Jul 12 18:46:41 2008
@@ -0,0 +1,44 @@
+/*
+ * This file is part of Gnome Subtitles.
+ * Copyright (C) 2008 Pedro Castro
+ *
+ * Gnome Subtitles is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Gnome Subtitles is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+using GnomeSubtitles.Core;
+using Gtk;
+
+namespace GnomeSubtitles.Dialog {
+
+public class Util {
+
+	#region Public methods
+	
+	public static void SetBaseWindow (Gtk.Dialog dialog, Window window) {
+		dialog.TransientFor = window;
+		dialog.Icon = window.Icon;
+	}
+	
+	public static void SetBaseWindowToUi (Gtk.Dialog dialog) {
+		Window window = Base.Ui.Window;
+		SetBaseWindow(dialog, window);
+	}
+	
+	#endregion
+
+
+}
+
+}

Modified: trunk/src/GnomeSubtitles/Dialog/VideoOpenDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/VideoOpenDialog.cs	(original)
+++ trunk/src/GnomeSubtitles/Dialog/VideoOpenDialog.cs	Sat Jul 12 18:46:41 2008
@@ -78,7 +78,7 @@
 	private void OnResponse (object o, ResponseArgs args) {
 		if (args.ResponseId == ResponseType.Ok) {
 			chosenUri = (dialog as FileChooserDialog).Uri;
-			actionDone = true;
+			returnValue = true;
 		}
 		Close();
 	}

Added: trunk/src/GnomeSubtitles/Dialog/WarningDialog.cs
==============================================================================
--- (empty file)
+++ trunk/src/GnomeSubtitles/Dialog/WarningDialog.cs	Sat Jul 12 18:46:41 2008
@@ -0,0 +1,36 @@
+/*
+ * This file is part of Gnome Subtitles.
+ * Copyright (C) 2008 Pedro Castro
+ *
+ * Gnome Subtitles is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Gnome Subtitles is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+using Gtk;
+using Mono.Unix;
+using System;
+
+namespace GnomeSubtitles.Dialog {
+
+public abstract class WarningDialog : MessageDialog {
+	
+	public WarningDialog () : base(MessageType.Warning) {
+	}
+
+	public WarningDialog (string primary, string secondary) : base(MessageType.Warning, primary, secondary) {
+	}
+
+}
+
+}



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