[longomatch] Unregister events on widget destroy
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Unregister events on widget destroy
- Date: Mon, 7 Jul 2014 11:28:28 +0000 (UTC)
commit 21074434421d2d8a2a5a4787c35a5b886ed77f7a
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Wed Jun 11 12:35:15 2014 +0200
Unregister events on widget destroy
LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs | 3 +-
.../Gui/Component/AnalysisTemplateEditor.cs | 3 +-
LongoMatch.GUI/Gui/Component/CodingWidget.cs | 21 ++++++++++++++++++-
LongoMatch.GUI/Gui/Component/NotesWidget.cs | 12 ++++++++++-
.../Gui/Component/PlaysCoordinatesTagger.cs | 10 +++++++-
.../Gui/Component/PlaysSelectionWidget.cs | 2 +-
6 files changed, 41 insertions(+), 10 deletions(-)
---
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
index 672b7cf..1ff042b 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
@@ -325,12 +325,11 @@ namespace LongoMatch.Gui
playbutton.Clicked += OnPlaybuttonClicked;
pausebutton.Clicked += OnPausebuttonClicked;
drawbutton.Clicked += OnDrawButtonClicked;
+ volumebutton.Clicked += OnVolumebuttonClicked;
timescale.ValueChanged += OnTimescaleValueChanged;
timescale.AdjustBounds += OnTimescaleAdjustBounds;
vscale1.FormatValue += OnVscale1FormatValue;
vscale1.ValueChanged += OnVscale1ValueChanged;
- drawbutton.Clicked += OnDrawButtonClicked;
- volumebutton.Clicked += OnVolumebuttonClicked;
}
diff --git a/LongoMatch.GUI/Gui/Component/AnalysisTemplateEditor.cs
b/LongoMatch.GUI/Gui/Component/AnalysisTemplateEditor.cs
index dd0567e..9cfb770 100644
--- a/LongoMatch.GUI/Gui/Component/AnalysisTemplateEditor.cs
+++ b/LongoMatch.GUI/Gui/Component/AnalysisTemplateEditor.cs
@@ -32,11 +32,10 @@ namespace LongoMatch.Gui.Component
{
this.Build ();
buttonswidget.Mode = LongoMatch.Common.TagMode.Predifined;
- Config.EventsBroker.NewTagEvent += HandleCategorySelected;
categoryproperties.Visible = false;
savebutton.Clicked += HandleSaveClicked;
}
-
+
public Categories Template {
set {
template = value;
diff --git a/LongoMatch.GUI/Gui/Component/CodingWidget.cs b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
index 927786b..7bffd51 100644
--- a/LongoMatch.GUI/Gui/Component/CodingWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
@@ -46,10 +46,17 @@ namespace LongoMatch.Gui.Component
drawingarea1.HeightRequest = 200;
drawingarea1.WidthRequest = 300;
- Config.EventsBroker.Tick += (t, l, p) => timeline.CurrentTime = t;
- Config.EventsBroker.PlaySelected += (play) => timeline.SelectedTimeNode = play;
+ Config.EventsBroker.Tick += HandleTick;
+ Config.EventsBroker.PlaySelected += HandlePlaySelected;
}
+ protected override void OnDestroyed ()
+ {
+ Config.EventsBroker.Tick -= HandleTick;
+ Config.EventsBroker.PlaySelected -= HandlePlaySelected;
+ base.OnDestroyed ();
+ }
+
public void SetProject (Project project, bool isLive, PlaysFilter filter) {
this.project = project;
autoTaggingMode.Active = true;
@@ -111,6 +118,16 @@ namespace LongoMatch.Gui.Component
drawingarea1.Visible = buttonswidget.Visible;
timeline.Visible = timelineMode.Active;
}
+
+ void HandlePlaySelected (Play play)
+ {
+ timeline.SelectedTimeNode = play;
+ }
+
+ void HandleTick (Time currentTime, Time streamLength, double currentPosition)
+ {
+ timeline.CurrentTime = currentTime;
+ }
}
}
diff --git a/LongoMatch.GUI/Gui/Component/NotesWidget.cs b/LongoMatch.GUI/Gui/Component/NotesWidget.cs
index 4602386..018c78d 100644
--- a/LongoMatch.GUI/Gui/Component/NotesWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/NotesWidget.cs
@@ -38,8 +38,13 @@ namespace LongoMatch.Gui.Component
this.Build();
this.buf = textview1.Buffer;
buf.Changed += new EventHandler(OnEdition);
- Config.EventsBroker.PlaySelected += (play) => {Play = play;};
+ Config.EventsBroker.PlaySelected += HandlePlaySelected;
+ }
+ protected override void OnDestroyed ()
+ {
+ Config.EventsBroker.PlaySelected -= HandlePlaySelected;
+ base.OnDestroyed ();
}
public Play Play {
@@ -73,5 +78,10 @@ namespace LongoMatch.Gui.Component
}
}
+ void HandlePlaySelected (Play play)
+ {
+ Play = play;
+ }
+
}
}
diff --git a/LongoMatch.GUI/Gui/Component/PlaysCoordinatesTagger.cs
b/LongoMatch.GUI/Gui/Component/PlaysCoordinatesTagger.cs
index b4b4f99..c66783c 100644
--- a/LongoMatch.GUI/Gui/Component/PlaysCoordinatesTagger.cs
+++ b/LongoMatch.GUI/Gui/Component/PlaysCoordinatesTagger.cs
@@ -41,9 +41,9 @@ namespace LongoMatch.Gui.Component
{
this.Build ();
SetMode (true);
- Config.EventsBroker.PlaySelected += (play) => LoadPlay (play, false);
+ Config.EventsBroker.PlaySelected += HandlePlaySelected;
}
-
+
public bool CoordinatesSensitive {
set {
field.Sensitive = value;
@@ -187,9 +187,15 @@ namespace LongoMatch.Gui.Component
goal.Visible = true;
}
+ void HandlePlaySelected (Play play)
+ {
+ LoadPlay (play, false);
+ }
+
protected override void OnDestroyed ()
{
base.OnDestroyed ();
+ Config.EventsBroker.PlaySelected -= HandlePlaySelected;
if (fieldPixbuf != null)
fieldPixbuf.Dispose();
if (hFieldPixbuf != null)
diff --git a/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs
b/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs
index d74aaf5..cf0c67e 100644
--- a/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs
@@ -67,10 +67,10 @@ namespace LongoMatch.Gui.Component
}
public void Clear() {
+ Config.EventsBroker.TeamTagsChanged -= UpdateTeamsModels;
playsList.Project = null;
localPlayersList.Clear();
visitorPlayersList.Clear();
- Config.EventsBroker.TeamTagsChanged -= UpdateTeamsModels;
}
public bool PlayListLoaded {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]