[longomatch] Allow edition of players name using the treeview



commit c3579013caa33a2c316858bd04d2ca847672b80f
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Fri Sep 4 19:30:27 2009 +0200

    Allow edition of players name using the treeview

 LongoMatch/Gui/PlayersTreeView.cs |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/LongoMatch/Gui/PlayersTreeView.cs b/LongoMatch/Gui/PlayersTreeView.cs
index 35db558..c01322a 100644
--- a/LongoMatch/Gui/PlayersTreeView.cs
+++ b/LongoMatch/Gui/PlayersTreeView.cs
@@ -127,6 +127,10 @@ namespace LongoMatch.Gui.Component
 						selectedTimeNode = selectedItem as MediaTimeNode;
 					    menu.Popup();
 					}
+					else{
+						nameCell.Editable = true;
+						this.SetCursor(path,  nameColumn, true);
+					}
 				}
 			}
 			return returnValue;								
@@ -199,11 +203,18 @@ namespace LongoMatch.Gui.Component
 		{
 			Gtk.TreeIter iter;
 			this.Model.GetIter (out iter, new Gtk.TreePath (args.Path)); 
-			TimeNode tNode = (TimeNode)this.Model.GetValue (iter,0);
-			tNode.Name = args.NewText;
-			nameCell.Editable=false;
-			if (TimeNodeChanged != null)
-				TimeNodeChanged(tNode,args.NewText);
+			if (Model.GetValue (iter,0) is TimeNode){
+				TimeNode tNode = (TimeNode)this.Model.GetValue (iter,0);
+				tNode.Name = args.NewText;
+				nameCell.Editable=false;
+				if (TimeNodeChanged != null)
+					TimeNodeChanged(tNode,args.NewText);
+			}
+			else{
+				Player player = (Player)this.Model.GetValue (iter,0);
+				player.Name = args.NewText;
+				nameCell.Editable=false;				
+			}
 		}
 			
 		



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