[gnome-subtitles] Improve fix in bug #638238, allowing "Insert Subtitle Before" with no subtitles or empty selection



commit 4007967b26ab41dc39bebb36a05e092e1bb9b628
Author: Pedro Castro <mail pedrocastro org>
Date:   Wed Dec 29 04:24:36 2010 +0000

    Improve fix in bug #638238, allowing "Insert Subtitle Before" with no subtitles or empty selection

 src/GnomeSubtitles/Core/EventHandlers.cs |    5 ++++-
 src/GnomeSubtitles/Ui/Menus.cs           |    1 -
 src/GnomeSubtitles/Ui/WidgetNames.cs     |    1 -
 3 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/GnomeSubtitles/Core/EventHandlers.cs b/src/GnomeSubtitles/Core/EventHandlers.cs
index cb75941..107c08c 100644
--- a/src/GnomeSubtitles/Core/EventHandlers.cs
+++ b/src/GnomeSubtitles/Core/EventHandlers.cs
@@ -133,7 +133,10 @@ public class EventHandlers {
 	}
 	
 	public void OnEditInsertSubtitleBefore (object o, EventArgs args) {
-		Base.CommandManager.Execute(new InsertSubtitleBeforeCommand());
+		if ((Base.Document.Subtitles.Count == 0) || (Base.Ui.View.Selection.Count == 0))
+			Base.CommandManager.Execute(new InsertFirstSubtitleCommand());
+		else 
+			Base.CommandManager.Execute(new InsertSubtitleBeforeCommand());
 	}
 	
 	public void OnEditInsertSubtitleAfter (object o, EventArgs args) {
diff --git a/src/GnomeSubtitles/Ui/Menus.cs b/src/GnomeSubtitles/Ui/Menus.cs
index 7dbde8e..d1d1c60 100644
--- a/src/GnomeSubtitles/Ui/Menus.cs
+++ b/src/GnomeSubtitles/Ui/Menus.cs
@@ -134,7 +134,6 @@ public class Menus {
 	private void SetNonZeroSelectionDependentSensitivity (bool sensitivity) {
 		SetStylesSensitivity(sensitivity);
 		SetSensitivity(WidgetNames.EditDeleteSubtitles, sensitivity);
-		SetSensitivity(WidgetNames.EditInsertSubtitleBefore, sensitivity);
 		SetSensitivity(WidgetNames.DeleteSubtitlesButton, sensitivity);
 	}
 	
diff --git a/src/GnomeSubtitles/Ui/WidgetNames.cs b/src/GnomeSubtitles/Ui/WidgetNames.cs
index 2cb2fff..ab9d506 100644
--- a/src/GnomeSubtitles/Ui/WidgetNames.cs
+++ b/src/GnomeSubtitles/Ui/WidgetNames.cs
@@ -49,7 +49,6 @@ public class WidgetNames {
 	public const string EditFormatItalic = "editFormatItalic";
 	public const string EditFormatUnderline = "editFormatUnderline";
 	public const string EditInsertSubtitleMenu = "editInsertSubtitleMenu";
-	public const string EditInsertSubtitleBefore = "editInsertSubtitleBefore";
 	public const string EditDeleteSubtitles = "editDeleteSubtitles";
 	
 	/* View Menu */



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