[longomatch] Fix renaming templates



commit fc5478cab88c1d043d49c3b92268680e53417a4b
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Fri Nov 14 11:30:51 2014 +0100

    Fix renaming templates

 LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs |    8 ++++----
 LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs  |    8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs 
b/LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs
index 2108862..f132fb4 100644
--- a/LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs
@@ -424,11 +424,11 @@ namespace LongoMatch.Gui.Panel
                                } else {
                                        string prevName = template.Name;
                                        template.Name = args.NewText;
-                                       if (!SaveTemplate (template)) {
-                                               template.Name = prevName;
-                                       } else {
-                                               provider.Delete (template.Name);
+                                       if (SaveTemplate (template)) {
+                                               provider.Delete (prevName);
                                                templates.SetValue (iter, 1, template.Name);
+                                       } else {
+                                               template.Name = prevName;
                                        }
                                }
                        }
diff --git a/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs b/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs
index 805b08d..4c60bb0 100644
--- a/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs
@@ -317,11 +317,11 @@ namespace LongoMatch.Gui.Panel
                                } else {
                                        string prevName = team.Name;
                                        team.Name = args.NewText;
-                                       if (!SaveTemplate (team)) {
-                                               team.Name = prevName;
-                                       } else {
-                                               provider.Delete (team.Name);
+                                       if (SaveTemplate (team)) {
+                                               provider.Delete (prevName);
                                                teams.SetValue (iter, 1, team.Name);
+                                       } else {
+                                               team.Name = prevName;
                                        }
                                }
                        }


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