[chronojump] Races with 2 tracks: do not allow to show sprint calculations



commit 45768f5437d7266681ddf86ad09e5a9e76c6c018
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Dec 31 13:56:01 2020 +0100

    Races with 2 tracks: do not allow to show sprint calculations

 src/gui/sprint.cs | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/src/gui/sprint.cs b/src/gui/sprint.cs
index 70e89ca8..1d029024 100644
--- a/src/gui/sprint.cs
+++ b/src/gui/sprint.cs
@@ -190,7 +190,16 @@ public partial class ChronoJumpWindow
 
                // you get the iter and the model if something is selected
                if (((TreeSelection)o).GetSelected(out model, out iter))
-                       button_sprint.Sensitive = true;
+               {
+                       //only allow sprint calculation when there are three tracks
+                       string splitTimes = (string) model.GetValue(iter, 3);
+                       if(splitTimes.Split(new char[] {';'}).Length >= 3)
+                               button_sprint.Sensitive = true;
+                       else
+                               button_sprint.Sensitive = false;
+               }
+               else
+                       button_sprint.Sensitive = false;
        }
 
        public static bool GetSelectedSprint (Gtk.TreeView tv)


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