[longomatch] Fix renaming templates



commit 6106791c1f0b1cbcfff3767b977e0f81d35155f3
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Mar 31 19:23:12 2015 +0200

    Fix renaming templates

 LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs |    5 +++--
 LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs  |    6 ++++--
 2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs 
b/LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs
index 23b973c..79f0f7f 100644
--- a/LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs
@@ -434,8 +434,9 @@ namespace LongoMatch.Gui.Panel
                                        args.RetVal = false;
                                } else {
                                        try {
-                                               provider.Copy (name, args.NewText);
-                                               provider.Delete (name);
+                                               Dashboard dashboard = provider.Load (name);
+                                               dashboard.Name = args.NewText;
+                                               provider.Save (dashboard);
                                                // Change displayed name and template name in our store
                                                templates.SetValue (iter, 1, args.NewText);
                                                templates.SetValue (iter, 2, args.NewText);
diff --git a/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs b/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs
index 21fba64..4f51942 100644
--- a/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs
@@ -379,9 +379,11 @@ namespace LongoMatch.Gui.Panel
                                        args.RetVal = false;
                                } else {
                                        try {
-                                               provider.Copy (name, args.NewText);
-                                               provider.Delete (name);
+                                               Team team = provider.Load (name);
+                                               team.Name = args.NewText;
+                                               provider.Save (team);
                                                teams.SetValue (iter, 1, args.NewText);
+                                               teams.SetValue (iter, 2, args.NewText);
                                        } catch (Exception ex) {
                                                Config.GUIToolkit.ErrorMessage (ex.Message);
                                        }


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