[longomatch] After adding a new play expand the tree and select the play



commit c07a40ba1a18ffa9c22c79f6f1b4860fd9c36de5
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sun Jan 10 02:31:05 2010 +0100

    After adding a new play expand the tree and select the play

 LongoMatch/Gui/Component/PlaysListTreeWidget.cs |   26 ++++++++++++++++------
 1 files changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/LongoMatch/Gui/Component/PlaysListTreeWidget.cs b/LongoMatch/Gui/Component/PlaysListTreeWidget.cs
index d6ab752..afc1d56 100644
--- a/LongoMatch/Gui/Component/PlaysListTreeWidget.cs
+++ b/LongoMatch/Gui/Component/PlaysListTreeWidget.cs
@@ -20,6 +20,7 @@
 
 using System;
 using Gtk;
+using Gdk;
 using Mono.Unix;
 using LongoMatch.DB;
 using LongoMatch.Handlers;
@@ -75,13 +76,24 @@ namespace LongoMatch.Gui.Component
 		}
 
 		public void AddPlay(MediaTimeNode play,int  section) {
-			if (project != null) {
-				TreeIter iter;
-				TreeStore model = (TreeStore)treeview.Model;
-				model.GetIterFromString(out iter, section.ToString());
-				TimeNode stNode = (TimeNode)model.GetValue(iter,0);
-				if (project.Sections.GetTimeNode(section) == stNode)
-					model.AppendValues(iter,play);
+			TreeIter sectionIter, playIter;
+			TreePath playPath;
+			TreeStore model;
+			TimeNode stNode;
+			Rectangle cellArea;
+			
+			if (project == null)
+			return;
+					
+			model = (TreeStore)treeview.Model;
+			model.GetIterFromString(out sectionIter, section.ToString());
+			stNode = (TimeNode)model.GetValue(sectionIter,0);
+			if (project.Sections.GetTimeNode(section) == stNode){
+				playIter = model.AppendValues(sectionIter,play);
+				playPath = model.GetPath(playIter);
+				treeview.Selection.UnselectAll();				
+				treeview.ExpandToPath(playPath);
+				treeview.Selection.SelectIter(playIter);
 			}
 		}
 



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