[chronojump] On encoder cannot capture or edit exericise if no exercise exists
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] On encoder cannot capture or edit exericise if no exercise exists
- Date: Wed, 14 Nov 2018 15:37:29 +0000 (UTC)
commit 9d5dae5f3db4b05e55344408e287d5e987db4fdd
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Nov 14 16:37:00 2018 +0100
On encoder cannot capture or edit exericise if no exercise exists
src/gui/encoder.cs | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 73eafccc..441f5bc0 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -885,6 +885,12 @@ public partial class ChronoJumpWindow
//called from main GUI
void on_button_encoder_capture_clicked (object o, EventArgs args)
{
+ if(! selectedEncoderExerciseExists())
+ {
+ new DialogMessage(Constants.MessageTypes.WARNING, "Need to create/select an
exercise.");
+ return;
+ }
+
saveEncoderExerciseOptionsToPreferences();
//if seeing "show table" move to "show graph"
@@ -4415,9 +4421,22 @@ public partial class ChronoJumpWindow
hbox_top_person_encoder.Sensitive = ! show;
}
+ //useful when there are no exercises (have been removed from database)
+ bool selectedEncoderExerciseExists ()
+ {
+ return (getExerciseIDFromCombo(exerciseCombos.CAPTURE) != -1);
+ }
+
+
//info is now info and edit (all values can be changed), and detete (there's delete button)
void on_button_encoder_exercise_edit_clicked (object o, EventArgs args)
{
+ if(! selectedEncoderExerciseExists())
+ {
+ new DialogMessage(Constants.MessageTypes.WARNING, "Need to create/select an
exercise.");
+ return;
+ }
+
EncoderExercise ex = (EncoderExercise) SqliteEncoder.SelectEncoderExercises(
false, getExerciseIDFromCombo(exerciseCombos.CAPTURE), false)[0];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]