diff options
Diffstat (limited to 'src/c/fastforge.c')
| -rw-r--r-- | src/c/fastforge.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/c/fastforge.c b/src/c/fastforge.c index 623765e..2dc7cf0 100644 --- a/src/c/fastforge.c +++ b/src/c/fastforge.c @@ -9,12 +9,13 @@ enum { MAIN_MENU_INDEX_START_NEW = 0, MAIN_MENU_INDEX_CURRENT_TIMER = 1, MAIN_MENU_INDEX_STOP_CURRENT = 2, - MAIN_MENU_INDEX_HISTORY = 3, - MAIN_MENU_INDEX_STATS = 4, - MAIN_MENU_INDEX_SETTINGS = 5, - MAIN_MENU_INDEX_BACKUP = 6, - MAIN_MENU_INDEX_ABOUT = 7, - MAIN_MENU_ITEM_COUNT = 8 + MAIN_MENU_INDEX_CANCEL_CURRENT = 3, + MAIN_MENU_INDEX_HISTORY = 4, + MAIN_MENU_INDEX_STATS = 5, + MAIN_MENU_INDEX_SETTINGS = 6, + MAIN_MENU_INDEX_BACKUP = 7, + MAIN_MENU_INDEX_ABOUT = 8, + MAIN_MENU_ITEM_COUNT = 9 }; enum { @@ -96,6 +97,7 @@ static char s_settings_target_text[32]; static char s_settings_dev_text[32]; #endif static char s_menu_stop_subtitle[32]; +static char s_menu_cancel_subtitle[32]; static char s_placeholder_title_text[24]; static char s_placeholder_body_text[160]; static char s_placeholder_hint_text[24]; @@ -655,10 +657,13 @@ static void refresh_goal_window_content(void) { static void sync_main_menu_state(void) { if (fast_is_running()) { snprintf(s_menu_stop_subtitle, sizeof(s_menu_stop_subtitle), "End now and save"); + snprintf(s_menu_cancel_subtitle, sizeof(s_menu_cancel_subtitle), "Discard, no history"); } else { snprintf(s_menu_stop_subtitle, sizeof(s_menu_stop_subtitle), "No fast running"); + snprintf(s_menu_cancel_subtitle, sizeof(s_menu_cancel_subtitle), "No fast running"); } s_main_menu_items[MAIN_MENU_INDEX_STOP_CURRENT].subtitle = s_menu_stop_subtitle; + s_main_menu_items[MAIN_MENU_INDEX_CANCEL_CURRENT].subtitle = s_menu_cancel_subtitle; if (s_main_menu_layer) { menu_layer_reload_data(simple_menu_layer_get_menu_layer(s_main_menu_layer)); @@ -1087,6 +1092,18 @@ static void menu_stop_current_callback(int index, void *context) { refresh_all_ui_state(); } +/* Cancel discards the running fast without saving it to history. */ +static void menu_cancel_current_callback(int index, void *context) { + (void)index; + (void)context; + if (!fast_cancel()) { + show_placeholder_window("NOT RUNNING", "There is no active fast to cancel.", "BACK Menu"); + return; + } + show_placeholder_window("FAST CANCELLED", "Fast discarded. Not in history.", "BACK Menu"); + refresh_all_ui_state(); +} + static void menu_history_callback(int index, void *context) { (void)index; (void)context; @@ -1740,6 +1757,11 @@ static void configure_main_menu_items(void) { .subtitle = "", .callback = menu_stop_current_callback }; + s_main_menu_items[MAIN_MENU_INDEX_CANCEL_CURRENT] = (SimpleMenuItem) { + .title = "Cancel Current Fast", + .subtitle = "", + .callback = menu_cancel_current_callback + }; s_main_menu_items[MAIN_MENU_INDEX_HISTORY] = (SimpleMenuItem) { .title = "History", .subtitle = "Completed fasts", |
