[chronojump] Fixes on labels of height/weight metric and sport add



commit 7dcfb223edc8ea089be91333c597a598f2e27b86
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sat Jan 21 11:39:59 2017 +0100

    Fixes on labels of height/weight metric and sport add

 src/gui/genericWindow.cs |   20 +++++++++++---------
 src/gui/person.cs        |    8 +++++++-
 src/gui/session.cs       |    4 +++-
 3 files changed, 21 insertions(+), 11 deletions(-)
---
diff --git a/src/gui/genericWindow.cs b/src/gui/genericWindow.cs
index 7e313cf..88f3965 100644
--- a/src/gui/genericWindow.cs
+++ b/src/gui/genericWindow.cs
@@ -134,12 +134,15 @@ public class GenericWindow
                DestroyOnAccept = false;
        }
 
-       //for some widgets
+       //for an array of widgets
        static public GenericWindow Show (bool showNow, string textHeader, ArrayList array)
        {
                if (GenericWindowBox == null) {
                        GenericWindowBox = new GenericWindow(textHeader);
-               }
+               } else
+                       GenericWindowBox.label_header.Text = textHeader;
+
+               GenericWindowBox.Type = Types.UNDEFINED;
 
                GenericWindowBox.hideWidgets();
 
@@ -149,25 +152,24 @@ public class GenericWindow
                Pixbuf pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "stock_delete.png");
                GenericWindowBox.image_delete.Pixbuf = pixbuf;
 
-               GenericWindowBox.Type = Types.UNDEFINED;
-               
-               GenericWindowBox.label_header.Text = textHeader;
-               
                if(showNow)
                        GenericWindowBox.generic_window.Show ();
                
                return GenericWindowBox;
        }
-                       
+
        //for only one widget
        static public GenericWindow Show (string textHeader, Constants.GenericWindowShow stuff)
        {
                if (GenericWindowBox == null) {
                        GenericWindowBox = new GenericWindow(textHeader);
-               }
-               
+               } else
+                       GenericWindowBox.label_header.Text = textHeader;
+
                GenericWindowBox.Type = Types.UNDEFINED;
 
+               GenericWindowBox.hideWidgets();
+
                GenericWindowBox.showWidget(stuff);
                GenericWindowBox.generic_window.Show ();
                
diff --git a/src/gui/person.cs b/src/gui/person.cs
index a4ac65c..6ec98c6 100644
--- a/src/gui/person.cs
+++ b/src/gui/person.cs
@@ -1317,6 +1317,8 @@ public class PersonAddModifyWindow
        }
        void on_button_height_metric_accepted (object obj, EventArgs args)
        {
+               genericWin.Button_accept.Clicked -= new EventHandler(on_button_height_metric_accepted);
+
                string [] myStr = genericWin.TwoSpinSelected.Split(new char[] {':'});
                spinbutton_height.Value = Util.ConvertFeetInchesToCm(
                        Convert.ToInt32(myStr[0]), 
@@ -1331,6 +1333,8 @@ public class PersonAddModifyWindow
        }
        void on_button_weight_metric_accepted (object obj, EventArgs args)
        {
+               genericWin.Button_accept.Clicked -= new EventHandler(on_button_weight_metric_accepted);
+
                spinbutton_weight.Value = Util.ConvertPoundsToKg(genericWin.SpinDoubleSelected);
        }
 
@@ -1474,8 +1478,10 @@ public class PersonAddModifyWindow
                genericWin.Button_accept.Clicked += new EventHandler(on_sport_add_accepted);
        }
 
-       private void on_sport_add_accepted (object o, EventArgs args) {
+       private void on_sport_add_accepted (object o, EventArgs args)
+       {
                genericWin.Button_accept.Clicked -= new EventHandler(on_sport_add_accepted);
+
                string newSportName = genericWin.EntrySelected;
                if(Sqlite.Exists(false, Constants.SportTable, newSportName) ||
                                newSportName == Catalog.GetString(Constants.SportUndefined) || //let's save 
problems
diff --git a/src/gui/session.cs b/src/gui/session.cs
index 8806a96..5639e17 100644
--- a/src/gui/session.cs
+++ b/src/gui/session.cs
@@ -524,8 +524,10 @@ public class SessionAddEditWindow {
                genericWin.Button_accept.Clicked += new EventHandler(on_sport_add_accepted);
        }
 
-       private void on_sport_add_accepted (object o, EventArgs args) {
+       private void on_sport_add_accepted (object o, EventArgs args)
+       {
                genericWin.Button_accept.Clicked -= new EventHandler(on_sport_add_accepted);
+
                string newSportName = genericWin.EntrySelected;
                if(Sqlite.Exists(false, Constants.SportTable, newSportName) ||
                                newSportName == Catalog.GetString(Constants.SportUndefined) || //let's save 
problems


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