[gnome-subtitles] Select first subtitle after emitting the document and translation loaded
- From: Pedro Daniel da Rocha Melo e Castro <pcastro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-subtitles] Select first subtitle after emitting the document and translation loaded
- Date: Sat, 16 Jul 2011 21:36:15 +0000 (UTC)
commit dae706dff6d5a1d79c32215319909ae745201797
Author: Pedro Castro <pedro gnomesubtitles org>
Date: Sat Jul 16 20:17:25 2011 +0100
Select first subtitle after emitting the document and translation loaded
This allows for the widgets to update according to selection, as normal, instead
of replicating a selection's behavior when the document or translation is loaded.
src/GnomeSubtitles/Core/Base.cs | 10 ++++++++++
src/GnomeSubtitles/Ui/View/SubtitleView.cs | 1 -
2 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/GnomeSubtitles/Core/Base.cs b/src/GnomeSubtitles/Core/Base.cs
index 0719dfe..0683d8e 100644
--- a/src/GnomeSubtitles/Core/Base.cs
+++ b/src/GnomeSubtitles/Core/Base.cs
@@ -176,6 +176,7 @@ public class Base {
document = new Document();
EmitDocumentLoadedEvent();
+ /* Create first subtitle. This happens after EmitDocumentLoadedEvent for all widgets to be ready */
if (document.Subtitles.Count == 0)
commandManager.Execute(new InsertFirstSubtitleCommand());
}
@@ -187,6 +188,9 @@ public class Base {
document = new Document(path, encoding);
TimingMode = document.TextFile.TimingMode;
EmitDocumentLoadedEvent();
+
+ /* Select first subtitle. This happens after EmitDocumentLoadedEvent for all widgets to be ready */
+ Ui.View.Selection.SelectFirst();
}
public static void CloseDocument () {
@@ -237,6 +241,9 @@ public class Base {
document.OpenTranslation(path, encoding);
EmitTranslationLoadedEvent();
+
+ /* Reselect, for the widgets to update accordingly */
+ Ui.View.Selection.Reselect();
}
public static void NewTranslation () {
@@ -245,6 +252,9 @@ public class Base {
document.NewTranslation();
EmitTranslationLoadedEvent();
+
+ /* Reselect, for the widgets to update accordingly */
+ Ui.View.Selection.Reselect();
}
public static void CloseTranslation () {
diff --git a/src/GnomeSubtitles/Ui/View/SubtitleView.cs b/src/GnomeSubtitles/Ui/View/SubtitleView.cs
index ed86331..3c66e1e 100644
--- a/src/GnomeSubtitles/Ui/View/SubtitleView.cs
+++ b/src/GnomeSubtitles/Ui/View/SubtitleView.cs
@@ -394,7 +394,6 @@ public class SubtitleView {
private void OnBaseDocumentLoaded (Document document) {
tree.Sensitive = true;
Load(document.Subtitles);
- selection.SelectFirst();
}
private void OnBaseDocumentUnloaded (Document document) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]