[longomatch/newui: 107/157] Group score and penalty cards in the plays list



commit 6a4e60bea13771d16e8179dcbce820b33af79fa8
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Aug 27 11:39:06 2014 +0200

    Group score and penalty cards in the plays list

 .../Gui/Component/PlaysListTreeWidget.cs           |   38 ++++++++++++++++----
 .../Gui/Component/PlaysSelectionWidget.cs          |    1 +
 2 files changed, 32 insertions(+), 7 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs 
b/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
index fe5579c..6e5f892 100644
--- a/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
@@ -120,12 +120,36 @@ namespace LongoMatch.Gui.Component
                        }
                }
 
-               private TreeStore GetModel(Project project){
-                       Dictionary<TaggerButton, TreeIter> itersDic = new Dictionary<TaggerButton, 
TreeIter>();
-                       Gtk.TreeStore dataFileListStore = new Gtk.TreeStore(typeof (TaggerButton), 
typeof(TimeNode));
-
-                       foreach(TaggerButton cat in project.Categories.List) {
-                               Gtk.TreeIter iter = dataFileListStore.AppendValues(cat, null);
+               private TreeStore GetModel (Project project)
+               {
+                       Gtk.TreeIter iter;
+                       Dictionary<TaggerButton, TreeIter> itersDic = new Dictionary<TaggerButton, TreeIter> 
();
+                       Gtk.TreeStore dataFileListStore = new Gtk.TreeStore (typeof(object));
+
+                       /* Add scores */
+                       if (project.Categories.Scores.Count > 0) {
+                               iter = dataFileListStore.AppendValues (
+                                       new AnalysisCategory { Name = Catalog.GetString ("Score"),
+                                       SortMethod = SortMethodType.SortByStartTime,
+                                       Color = Config.Style.PaletteActive}, null);
+                               foreach (Score s in project.Categories.Scores) {
+                                       itersDic.Add(s, iter);
+                               }
+                       }
+                       
+                       /* Add penalty cards*/
+                       if (project.Categories.PenaltyCards.Count > 0) {
+                               iter = dataFileListStore.AppendValues (
+                                       new AnalysisCategory { Name = Catalog.GetString ("Penalty Cards"),
+                                       SortMethod = SortMethodType.SortByStartTime,
+                                       Color = Config.Style.PaletteActive}, null);
+                               foreach (PenaltyCard pc in project.Categories.PenaltyCards) {
+                                       itersDic.Add(pc, iter);
+                               }
+                       }
+                       
+                       foreach(TaggerButton cat in project.Categories.CategoriesList) {
+                               iter = dataFileListStore.AppendValues(cat);
                                itersDic.Add(cat, iter);
                        }
                        
@@ -135,7 +159,7 @@ namespace LongoMatch.Gui.Component
                                if(!itersDic.ContainsKey(cat))
                                        continue;
                                foreach(Play play in playsGroup) {
-                                       dataFileListStore.AppendValues(itersDic[cat],play);
+                                       dataFileListStore.AppendValues(itersDic[cat], play);
                                }
                        }
                        return dataFileListStore;
diff --git a/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs 
b/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs
index 37e58d9..bfcbf5a 100644
--- a/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs
@@ -68,6 +68,7 @@ namespace LongoMatch.Gui.Component
                        localPlayersList.Clear();
                        visitorPlayersList.Clear();
                        playsList1.Destroy ();
+                       playlistwidget.Destroy ();
                        base.OnDestroyed ();
                }
                


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