[chronojump] Jump and Run types with " get removed



commit cd28a7f59831b60c0f7b72797a7df1f4546ebc6f
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Jul 1 15:27:54 2016 +0200

    Jump and Run types with " get removed

 src/gui/jumpType.cs |   13 +++++++------
 src/gui/runType.cs  |   12 ++++++------
 src/util.cs         |    2 ++
 3 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/src/gui/jumpType.cs b/src/gui/jumpType.cs
index b594a7e..82be15a 100644
--- a/src/gui/jumpType.cs
+++ b/src/gui/jumpType.cs
@@ -123,24 +123,25 @@ public class JumpTypeAddWindow
        
        void on_button_accept_clicked (object o, EventArgs args)
        {
+               string name = Util.RemoveTildeAndColonAndDot(entry_name.Text);
+               name = Util.RemoveChar(name, '"');
+
                //check if this jump type exists, and check it's name is not AllJumpsName
-               bool jumpTypeExists = Sqlite.Exists (false, Constants.JumpTypeTable, 
Util.RemoveTildeAndColonAndDot(entry_name.Text));
-               if(Util.RemoveTildeAndColonAndDot(entry_name.Text) == Constants.AllJumpsName) {
+               bool jumpTypeExists = Sqlite.Exists (false, Constants.JumpTypeTable, name);
+               if(name == Constants.AllJumpsName)
                        jumpTypeExists = true;
-               }
                
                if(jumpTypeExists) {
                        //string myString =  Catalog.GetString ("Jump type: '") + 
                        //      Util.RemoveTildeAndColonAndDot(entry_name.Text) + 
                        //      Catalog.GetString ("' exists. Please, use another name");
                        
-                       string myString = string.Format(Catalog.GetString("Jump type: '{0}' exists. Please, 
use another name"), Util.RemoveTildeAndColonAndDot(entry_name.Text) );
+                       string myString = string.Format(Catalog.GetString("Jump type: '{0}' exists. Please, 
use another name"), name);
                        
                        LogB.Information (myString);
                        ErrorWindow.Show(myString);
                } else {
-                       string myJump = "";
-                       myJump = Util.RemoveTildeAndColonAndDot(entry_name.Text);
+                       string myJump = name;
                        if(radiobutton_startIn_yes.Active) {
                                myJump = myJump + ":1"; 
                        } else {
diff --git a/src/gui/runType.cs b/src/gui/runType.cs
index f3cf1c4..25cb137 100644
--- a/src/gui/runType.cs
+++ b/src/gui/runType.cs
@@ -164,21 +164,21 @@ public class RunTypeAddWindow
        void on_button_accept_clicked (object o, EventArgs args)
        {
                //ConsoleB.Information(getEntriesString());
+               string name = Util.RemoveTildeAndColonAndDot(entry_name.Text);
+               name = Util.RemoveChar(name, '"');
 
                //check if this run type exists, and check it's name is not AllRunsName
-               bool runTypeExists = Sqlite.Exists (false, Constants.RunTypeTable, 
Util.RemoveTildeAndColonAndDot(entry_name.Text));
-               if(Util.RemoveTildeAndColonAndDot(entry_name.Text) == Constants.AllRunsName) {
+               bool runTypeExists = Sqlite.Exists (false, Constants.RunTypeTable, name);
+               if(name == Constants.AllRunsName)
                        runTypeExists = true;
-               }
                
                if(runTypeExists) {
-                       string myString = string.Format(Catalog.GetString("Run type: '{0}' exists. Please, 
use another name"), 
-                                       Util.RemoveTildeAndColonAndDot(entry_name.Text) );
+                       string myString = string.Format(Catalog.GetString("Run type: '{0}' exists. Please, 
use another name"), name); 
                        LogB.Information (myString);
                        ErrorWindow.Show(myString);
                } else {
                        RunType type = new RunType();
-                       type.Name = Util.RemoveTildeAndColonAndDot(entry_name.Text);
+                       type.Name = name;
                        type.Description = Util.RemoveTildeAndColon(textview_description.Buffer.Text);
                                                
                        if(radiobutton_dist_variable.Active)
diff --git a/src/util.cs b/src/util.cs
index 9493a9d..bd072cd 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -294,6 +294,8 @@ public class Util
        }
        
        //dot is used for separating sex in stats names (cannot be used for a new jumpType)
+       //also recomended:
+       //name = Util.RemoveChar(name, '"');
        public static string RemoveTildeAndColonAndDot(string myString) 
        {
                StringBuilder myStringBuilder = new StringBuilder(myString);


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