[longomatch] Fix exception saving project after chaning its name
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Fix exception saving project after chaning its name
- Date: Wed, 21 Jan 2015 15:14:05 +0000 (UTC)
commit 036108ea33ebc9573c6ba5e16d7f6b788e0d5adf
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Wed Jan 21 16:12:55 2015 +0100
Fix exception saving project after chaning its name
LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs b/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs
index 62df994..78c0a83 100644
--- a/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs
@@ -39,7 +39,6 @@ namespace LongoMatch.Gui.Panel
ListStore teams;
TeamTemplate loadedTeam;
- Dictionary<string, TreeIter> itersDict;
ITeamTemplatesProvider provider;
public TeamsTemplatesPanel ()
@@ -75,7 +74,6 @@ namespace LongoMatch.Gui.Panel
teamtemplateeditor1.DeleteSelectedPlayers (); };
teams = new ListStore (typeof(Pixbuf), typeof(string));
- itersDict = new Dictionary<string, TreeIter> ();
var cell = new CellRendererText ();
cell.Editable = true;
@@ -124,7 +122,6 @@ namespace LongoMatch.Gui.Panel
bool first = true;
teams.Clear ();
- itersDict.Clear ();
foreach (TeamTemplate template in provider.Templates) {
Pixbuf img;
TreeIter iter;
@@ -137,7 +134,6 @@ namespace LongoMatch.Gui.Panel
StyleConf.TeamsShieldIconSize);
}
iter = teams.AppendValues (img, template.Name);
- itersDict.Add (template.Name, iter);
if (first || template.Name == templateName) {
templateIter = iter;
}
@@ -200,8 +196,19 @@ namespace LongoMatch.Gui.Panel
}
/* The shield might have changed, update it just in case */
if (loadedTeam.Shield != null) {
- teamseditortreeview.Model.SetValue (itersDict [loadedTeam.Name], 0,
- loadedTeam.Shield.Scale
(StyleConf.TeamsShieldIconSize, StyleConf.TeamsShieldIconSize).Value);
+ TreeIter iter;
+
+ teams.GetIterFirst (out iter);
+ while (teams.IterIsValid (iter)) {
+ string name = teams.GetValue (iter, 1) as string;
+ if (name == loadedTeam.Name) {
+ Pixbuf shield = loadedTeam.Shield.Scale
(StyleConf.TeamsShieldIconSize,
+
StyleConf.TeamsShieldIconSize).Value;
+ teamseditortreeview.Model.SetValue (iter, 0, shield);
+ break;
+ }
+ teams.IterNext (ref iter);
+ }
}
teamtemplateeditor1.Edited = false;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]