[gnome-subtitles] Fixed crash on opening a translation file with no subtitles loaded
- From: Pedro Daniel da Rocha Melo e Castro <pcastro src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-subtitles] Fixed crash on opening a translation file with no subtitles loaded
- Date: Sun, 7 Jun 2009 14:47:08 -0400 (EDT)
commit 82144a133bcd34f938e206205d68441b2351b604
Author: Pedro Castro <mail pedrocastro org>
Date: Sun Jun 7 01:52:40 2009 +0100
Fixed crash on opening a translation file with no subtitles loaded
---
gnome-subtitles.mds | 8 ++++++--
src/GnomeSubtitles/Ui/Edit/SubtitleEditTextView.cs | 2 +-
src/GnomeSubtitles/Ui/View/Subtitles.cs | 13 ++++++++++---
3 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/gnome-subtitles.mds b/gnome-subtitles.mds
index 96fddb8..189d9c7 100644
--- a/gnome-subtitles.mds
+++ b/gnome-subtitles.mds
@@ -1,4 +1,9 @@
-<Combine name="gnome-subtitles" fileversion="2.0" outputpath="build/" MakePkgConfig="False" MakeLibPC="True">
+<Combine fileversion="2.0" outputpath="build/" name="gnome-subtitles" MakePkgConfig="False" MakeLibPC="True">
+ <Policies>
+ <StandardHeader Text="" inheritsSet="MITX11License" />
+ <DotNetNamingPolicy DirectoryNamespaceAssociation="None" ResourceNamePolicy="FileFormatDefault" />
+ <TextStylePolicy FileWidth="120" TabWidth="4" TabsToSpaces="False" NoTabsAfterNonTabs="False" RemoveTrailingWhitespace="True" EolMarker="Native" />
+ </Policies>
<Configurations active="Debug">
<Configuration name="Debug" ctype="CombineConfiguration">
<Entry build="True" name="gnome-subtitles" configuration="Debug" />
@@ -10,7 +15,6 @@
<StartMode startupentry="gnome-subtitles" single="True">
<Execute type="None" entry="gnome-subtitles" />
</StartMode>
- <DeployTargets />
<Entries>
<Entry filename="gnome-subtitles.mdp" />
</Entries>
diff --git a/src/GnomeSubtitles/Ui/Edit/SubtitleEditTextView.cs b/src/GnomeSubtitles/Ui/Edit/SubtitleEditTextView.cs
index 24d0eca..432155b 100644
--- a/src/GnomeSubtitles/Ui/Edit/SubtitleEditTextView.cs
+++ b/src/GnomeSubtitles/Ui/Edit/SubtitleEditTextView.cs
@@ -374,7 +374,7 @@ public abstract class SubtitleEditTextView {
private void OnToggleOverwrite (object o, EventArgs args) {
/* Update the GUI overwrite status */
UpdateOverwriteStatus();
-
+
/* Emit the toggle event */
if (!isToggleOverwriteSilent)
EmitToggleOverwrite();
diff --git a/src/GnomeSubtitles/Ui/View/Subtitles.cs b/src/GnomeSubtitles/Ui/View/Subtitles.cs
index fe5f8db..1db7b18 100644
--- a/src/GnomeSubtitles/Ui/View/Subtitles.cs
+++ b/src/GnomeSubtitles/Ui/View/Subtitles.cs
@@ -147,9 +147,16 @@ public class Subtitles : SubLib.Core.Domain.Subtitles {
/// <summary>Loads possible extra subtitles at the end of the model.</summary>
/// <remarks>Extra subtitles exist if subtitles were added to the base collection.</remarks>
- public void AddExtra (int count) {
- int startIndex = (Count == 0) ? 0 : Count - 1;
- for (int index = startIndex ; index < startIndex + count ; index++)
+ public void AddExtra (int extraCount) {
+ if (extraCount <= 0)
+ return;
+
+ int lastIndex = Count + extraCount - 1;
+
+ if (Count == 0)
+ AddNewAt(0);
+
+ for (int index = Count - 1 ; index < lastIndex ; index++)
AddNewAfter(index);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]