diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 3577f2359f..ac18bdf31c 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -313,8 +313,7 @@ int generic_action_ok_displaylist_push(const char *path, int action_ok_push_quick_menu(void) { bool msg_force = true; - menu_list_t *menu_list = menu_list_get_ptr(); - menu_list_flush_stack(menu_list, NULL, MENU_SETTINGS); + menu_entries_flush_stack(NULL, MENU_SETTINGS); menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force); generic_action_ok_displaylist_push("", @@ -433,7 +432,6 @@ static int action_ok_playlist_entry(const char *path, content_playlist_t *playlist = g_defaults.history; bool is_history = true; menu_handle_t *menu = menu_driver_get_ptr(); - menu_list_t *menu_list = menu_list_get_ptr(); uint32_t hash_label = menu_hash_calculate(label); if (!menu) @@ -496,7 +494,7 @@ static int action_ok_playlist_entry(const char *path, menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); break; default: - menu_list_flush_stack(menu_list, NULL, MENU_SETTINGS); + menu_entries_flush_stack(NULL, MENU_SETTINGS); break; } @@ -543,7 +541,6 @@ static int generic_action_ok(const char *path, global_t *global = global_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr(); settings_t *settings = config_get_ptr(); - menu_list_t *menu_list = menu_list_get_ptr(); if (!menu) goto error; @@ -659,7 +656,7 @@ static int generic_action_ok(const char *path, break; } - menu_list_flush_stack(menu_list, flush_char, flush_type); + menu_entries_flush_stack(flush_char, flush_type); return ret; diff --git a/menu/menu_entries.c b/menu/menu_entries.c index 119abcdf35..62bfa431c2 100644 --- a/menu/menu_entries.c +++ b/menu/menu_entries.c @@ -308,6 +308,13 @@ void menu_entries_get_last_stack(const char **path, const char **label, menu_list_get_last_stack(menu_list, path, label, file_type, entry_idx); } +void menu_entries_flush_stack(const char *needle, unsigned final_type) +{ + menu_list_t *menu_list = menu_list_get_ptr(); + if (menu_list) + menu_list_flush_stack(menu_list, needle, final_type); +} + void menu_entries_pop_stack(size_t *ptr) { menu_list_t *menu_list = menu_list_get_ptr(); diff --git a/menu/menu_entries.h b/menu/menu_entries.h index b3ace2cc05..26f3c534aa 100644 --- a/menu/menu_entries.h +++ b/menu/menu_entries.h @@ -139,6 +139,8 @@ menu_file_list_cbs_t *menu_entries_get_last_stack_actiondata(void); void menu_entries_pop_stack(size_t *ptr); +void menu_entries_flush_stack(const char *needle, unsigned final_type); + #ifdef __cplusplus } #endif diff --git a/menu/menu_entry.c b/menu/menu_entry.c index 75646af5ea..b0875ce06b 100644 --- a/menu/menu_entry.c +++ b/menu/menu_entry.c @@ -221,7 +221,6 @@ void menu_entry_pathdir_get_value(uint32_t i, char *s, size_t len) int menu_entry_pathdir_set_value(uint32_t i, const char *s) { const char *menu_path = NULL; - menu_list_t *menu_list = menu_list_get_ptr(); menu_file_list_cbs_t *cbs = menu_entries_get_last_stack_actiondata(); menu_entries_get_last_stack(&menu_path, NULL, NULL, NULL); @@ -235,7 +234,7 @@ int menu_entry_pathdir_set_value(uint32_t i, const char *s) menu_setting_set_with_string_representation(cbs->setting, menu_path); menu_setting_generic(cbs->setting, false); - menu_list_flush_stack(menu_list, NULL, 49); + menu_entries_flush_stack(NULL, 49); return 0; }