[longomatch] Override MediaTimeNode's toString() and use it in the treeviews



commit fc18f4747abdef53b9ef346f74f994f1e3863b83
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sun Dec 27 23:39:56 2009 +0100

    Override MediaTimeNode's toString() and use it in the treeviews

 LongoMatch/DB/TagsTemplate.cs              |    4 ++++
 LongoMatch/Gui/TreeView/PlayersTreeView.cs |    4 +---
 LongoMatch/Gui/TreeView/PlaysTreeView.cs   |    5 +----
 LongoMatch/Time/MediaTimeNode.cs           |   10 ++++++++++
 4 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/LongoMatch/DB/TagsTemplate.cs b/LongoMatch/DB/TagsTemplate.cs
index 16d412f..aa2ad90 100644
--- a/LongoMatch/DB/TagsTemplate.cs
+++ b/LongoMatch/DB/TagsTemplate.cs
@@ -51,5 +51,9 @@ namespace LongoMatch.DB
 		public int Count (){
 			return tagsList.Count;
 		}
+		
+		public IEnumerator<Tag> GetEnumerator(){
+			return tagsList.GetEnumerator();
+		}
 	}
 }
diff --git a/LongoMatch/Gui/TreeView/PlayersTreeView.cs b/LongoMatch/Gui/TreeView/PlayersTreeView.cs
index acd436d..f2cc273 100644
--- a/LongoMatch/Gui/TreeView/PlayersTreeView.cs
+++ b/LongoMatch/Gui/TreeView/PlayersTreeView.cs
@@ -171,9 +171,7 @@ namespace LongoMatch.Gui.Component
 				if (editing && selectedIter.Equals(iter))
 					(cell as Gtk.CellRendererText).Markup = tNode.Name;
 				else
-					(cell as Gtk.CellRendererText).Markup ="<b>"+ Catalog.GetString("Name")+": </b>"+tNode.Name+"\n"+
-					                                       "<b>"+Catalog.GetString("Start")+": </b>"+tNode.Start.ToMSecondsString()+"\n"+
-					                                       "<b>"+Catalog.GetString("Stop")+": </b>"+tNode.Stop.ToMSecondsString();
+					(cell as Gtk.CellRendererText).Markup = (tNode as MediaTimeNode).ToString();
 			}
 
 			else if (item is Player)
diff --git a/LongoMatch/Gui/TreeView/PlaysTreeView.cs b/LongoMatch/Gui/TreeView/PlaysTreeView.cs
index 4af5e08..0168c99 100644
--- a/LongoMatch/Gui/TreeView/PlaysTreeView.cs
+++ b/LongoMatch/Gui/TreeView/PlaysTreeView.cs
@@ -194,10 +194,7 @@ namespace LongoMatch.Gui.Component
 			else if (tNode is MediaTimeNode) {
 				(cell as Gtk.CellRendererText).BackgroundGdk = colors[GetSectionFromIter(iter)];
 				(cell as Gtk.CellRendererText).CellBackgroundGdk = colors[GetSectionFromIter(iter)];
-				(cell as Gtk.CellRendererText).Markup = "<b>"+Catalog.GetString("Name")+": </b>"+tNode.Name+"\n"+
-				                                        "<b>"+Catalog.GetString("Team")+": </b>"+(tNode as MediaTimeNode).Team.ToString().ToLower()+"\n"+
-				                                        "<b>"+Catalog.GetString("Start")+": </b>"+tNode.Start.ToMSecondsString()+"\n"+
-				                                        "<b>"+Catalog.GetString("Stop")+": </b>"+tNode.Stop.ToMSecondsString();
+				(cell as Gtk.CellRendererText).Markup = (tNode as MediaTimeNode).ToString();
 			}
 			else {
 				(cell as Gtk.CellRendererText).Background = "white";
diff --git a/LongoMatch/Time/MediaTimeNode.cs b/LongoMatch/Time/MediaTimeNode.cs
index f95a367..9af8b84 100644
--- a/LongoMatch/Time/MediaTimeNode.cs
+++ b/LongoMatch/Time/MediaTimeNode.cs
@@ -20,6 +20,7 @@
 
 using System;
 using System.Collections.Generic;
+using Mono.Unix;
 using Gdk;
 
 namespace LongoMatch.TimeNodes
@@ -343,6 +344,15 @@ namespace LongoMatch.TimeNodes
 			if (tagsList.Contains(tag))
 				tagsList.Remove(tag);
 		}
+		
+		public override string ToString ()
+		{
+			return  "<b>"+Catalog.GetString("Name")+": </b>"+Name+"\n"+
+				    "<b>"+Catalog.GetString("Team")+": </b>"+Team.ToString().ToLower()+"\n"+
+					"<b>"+Catalog.GetString("Start")+": </b>"+Start.ToMSecondsString()+"\n"+
+					"<b>"+Catalog.GetString("Stop")+": </b>"+Stop.ToMSecondsString();
+		}
+
 		#endregion
 	}
 }



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