[longomatch] Fix new plays insertion in the correct iter
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Fix new plays insertion in the correct iter
- Date: Wed, 24 Sep 2014 20:19:39 +0000 (UTC)
commit 31dac64ddc3b8d1208e3e9a54174d96a54e84d39
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Fri Aug 29 19:00:18 2014 +0200
Fix new plays insertion in the correct iter
.../Gui/Component/PlaysListTreeWidget.cs | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
b/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
index b9b845c..f1b268d 100644
--- a/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
@@ -40,6 +40,7 @@ namespace LongoMatch.Gui.Component
{
Project project;
+ Dictionary<TaggerButton, TreeIter> itersDic = new Dictionary<TaggerButton, TreeIter> ();
public PlaysListTreeWidget()
{
@@ -103,11 +104,12 @@ namespace LongoMatch.Gui.Component
var cat = play.Category;
var model = (TreeStore)treeview.Model;
- model.GetIterFromString(out categoryIter, CategoryPath(cat));
+ categoryIter = itersDic[cat];
var playIter = model.AppendValues(categoryIter,play);
var playPath = model.GetPath(playIter);
treeview.Selection.UnselectAll();
treeview.ExpandToPath(playPath);
+ treeview.ScrollToCell (playPath, null, true, 0, 0);
treeview.Selection.SelectIter(playIter);
}
@@ -130,9 +132,9 @@ namespace LongoMatch.Gui.Component
private TreeStore GetModel (Project project)
{
Gtk.TreeIter iter;
- Dictionary<TaggerButton, TreeIter> itersDic = new Dictionary<TaggerButton, TreeIter>
();
Gtk.TreeStore dataFileListStore = new Gtk.TreeStore (typeof(object));
+ itersDic = new Dictionary<TaggerButton, TreeIter> ();
/* Add scores */
if (project.Categories.Scores.Count > 0) {
iter = dataFileListStore.AppendValues (
@@ -172,10 +174,6 @@ namespace LongoMatch.Gui.Component
return dataFileListStore;
}
- private string CategoryPath(TaggerButton cat) {
- return project.Categories.List.IndexOf(cat).ToString();
- }
-
protected virtual void OnEditProperties(AnalysisCategory cat) {
EditCategoryDialog dialog = new EditCategoryDialog(project, cat);
dialog.Run();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]