[gnome-subtitles] Check subtitle bounds for the given last sync point on Synchronize
- From: Pedro Daniel da Rocha Melo e Castro <pcastro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-subtitles] Check subtitle bounds for the given last sync point on Synchronize
- Date: Sun, 7 Mar 2010 02:11:06 +0000 (UTC)
commit a6d723ccb5878bd19d76c1901fa4b110c16f8f2a
Author: Pedro Castro <mail>
Date: Sun Mar 7 02:05:19 2010 +0000
Check subtitle bounds for the given last sync point on Synchronize
.../Dialog/TimingsSynchronizeDialog.cs | 27 ++++++++++++-------
1 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/src/GnomeSubtitles/Dialog/TimingsSynchronizeDialog.cs b/src/GnomeSubtitles/Dialog/TimingsSynchronizeDialog.cs
index b159da8..de36e9c 100644
--- a/src/GnomeSubtitles/Dialog/TimingsSynchronizeDialog.cs
+++ b/src/GnomeSubtitles/Dialog/TimingsSynchronizeDialog.cs
@@ -165,6 +165,11 @@ public class TimingsSynchronizeDialog : GladeDialog {
return intervals;
}
+
+ private bool CanSynchronize () {
+ return (syncPoints.Collection.Count > 0)
+ && (syncPoints.Collection.Get(syncPoints.Collection.Count - 1).SubtitleNumber < Base.Document.Subtitles.Count);
+ }
/* Cell Renderers */
@@ -266,17 +271,19 @@ public class TimingsSynchronizeDialog : GladeDialog {
protected override bool ProcessResponse (ResponseType response) {
if (response == ResponseType.Ok) {
- bool toSyncAll = syncAllSubtitlesCheckButton.Active;
- SelectionIntended selectionIntended = (toSyncAll ? SelectionIntended.All : SelectionIntended.Range);
-
- TreePath[] pathRange = null;
- if (selectionIntended == SelectionIntended.Range) {
- pathRange = new TreePath[2];
- pathRange[0] = Core.Util.IntToPath(syncPoints.Collection[0].SubtitleNumber);
- pathRange[1] = Core.Util.IntToPath(syncPoints.Collection[syncPoints.Collection.Count - 1].SubtitleNumber);
+ if (CanSynchronize()) {
+ bool toSyncAll = syncAllSubtitlesCheckButton.Active;
+ SelectionIntended selectionIntended = (toSyncAll ? SelectionIntended.All : SelectionIntended.Range);
+
+ TreePath[] pathRange = null;
+ if (selectionIntended == SelectionIntended.Range) {
+ pathRange = new TreePath[2];
+ pathRange[0] = Core.Util.IntToPath(syncPoints.Collection[0].SubtitleNumber);
+ pathRange[1] = Core.Util.IntToPath(syncPoints.Collection[syncPoints.Collection.Count - 1].SubtitleNumber);
+ }
+
+ Base.CommandManager.Execute(new SynchronizeTimingsCommand(syncPoints, toSyncAll, selectionIntended, pathRange));
}
-
- Base.CommandManager.Execute(new SynchronizeTimingsCommand(syncPoints, toSyncAll, selectionIntended, pathRange));
return true;
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]