[longomatch/redesign3: 147/156] Allow using a team name different from the file one



commit cf548d77053ed9fc898df89c7b75f5f768f5891f
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Aug 16 20:22:01 2011 +0200

    Allow using a team name different from the file one

 LongoMatch/Gui/Component/TemplatesEditorBase.cs |    4 ++--
 LongoMatch/Services/TemplatesService.cs         |    4 +++-
 LongoMatch/Store/Templates/TeamTemplate.cs      |   10 +++++++++-
 3 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/LongoMatch/Gui/Component/TemplatesEditorBase.cs b/LongoMatch/Gui/Component/TemplatesEditorBase.cs
index c6689c6..9c43bb6 100644
--- a/LongoMatch/Gui/Component/TemplatesEditorBase.cs
+++ b/LongoMatch/Gui/Component/TemplatesEditorBase.cs
@@ -307,7 +307,7 @@ namespace LongoMatch.Gui.Component
 				foreach(Player player in template)
 					playersListStore.AppendValues(player);
 				treeview.Model=playersListStore;
-				teamentry.Text = template.Name;
+				teamentry.Text = template.TeamName;
 			}
 		}
 		
@@ -316,7 +316,7 @@ namespace LongoMatch.Gui.Component
 			Label label = new Label(Catalog.GetString("Team name")+":");
 			teamentry = new Entry ();
 			teamentry.Changed += delegate(object sender, EventArgs e) {
-				Template.Name = teamentry.Text;
+				Template.TeamName = teamentry.Text;
 			};
 		
 			box.PackStart (label, false, false, 0);
diff --git a/LongoMatch/Services/TemplatesService.cs b/LongoMatch/Services/TemplatesService.cs
index 1086ac1..2ffd74a 100644
--- a/LongoMatch/Services/TemplatesService.cs
+++ b/LongoMatch/Services/TemplatesService.cs
@@ -193,7 +193,9 @@ namespace LongoMatch.Services
 		
 		public T Load (string name) {
 			Log.Information("Loading template " +  name);
-			return (T)methodLoad.Invoke(null, new object[] {GetPath(name)});
+			var template = (T)methodLoad.Invoke(null, new object[] {GetPath(name)});
+			template.Name = name;
+			return template;
 		}
 		
 		public void Save (ITemplate<U> template) {
diff --git a/LongoMatch/Store/Templates/TeamTemplate.cs b/LongoMatch/Store/Templates/TeamTemplate.cs
index 306f777..a970a60 100644
--- a/LongoMatch/Store/Templates/TeamTemplate.cs
+++ b/LongoMatch/Store/Templates/TeamTemplate.cs
@@ -19,6 +19,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using Mono.Unix;
 
 using LongoMatch.Common;
 using LongoMatch.Interfaces;
@@ -29,13 +30,20 @@ namespace LongoMatch.Store.Templates
 
 	public class TeamTemplate: List<Player>, ITemplate<Player>
 	{
-		public TeamTemplate() {}
+		public TeamTemplate() {
+			TeamName = Catalog.GetString("default");
+		}
 
 		public String Name {
 			get;
 			set;
 		}
 
+		public String TeamName {
+			get;
+			set;
+		}
+		
 		public List<Player> PlayingPlayersList {
 			get {
 				return this.Where(p=>p.Playing).Select(p=>p).ToList();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]