From 1c66e975222558e8cd80d8ce2cd083370fb157a2 Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Tue, 12 Apr 2022 19:31:24 +0200 Subject: [PATCH] Database: Remove File View menu These options don't seem to apply to the database... Change-Id: I777073eeaed4099acf44996b95fa05b4c2b3abc4 --- apps/menus/settings_menu.c | 21 ++++++++++++++++++++- apps/onplay.c | 6 ++++++ apps/onplay.h | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 562a89e85a..2539f17860 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c @@ -56,6 +56,7 @@ #include "usb-ibasso.h" #endif #include "plugin.h" +#include "onplay.h" #ifndef HAS_BUTTON_HOLD static int selectivesoftlock_callback(int action, @@ -221,12 +222,30 @@ static int fileview_callback(int action, return action; } -MAKE_MENU(file_menu, ID2P(LANG_FILE), 0, Icon_file_view_menu, +static int filemenu_callback(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list); +MAKE_MENU(file_menu, ID2P(LANG_FILE), filemenu_callback, Icon_file_view_menu, &sort_case, &sort_dir, &sort_file, &interpret_numbers, &dirfilter, &show_filename_ext, &browse_current, &show_path_in_browser, &clear_start_directory_item ); +static int filemenu_callback(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) +{ + (void)this_list; + + if (action == ACTION_REQUEST_MENUITEM && + this_item == &file_menu && + get_onplay_context() == CONTEXT_ID3DB && + get_current_activity() != ACTIVITY_SETTINGS) + return ACTION_EXIT_MENUITEM; + + return action; +} + /* FILE VIEW MENU */ /***********************************/ diff --git a/apps/onplay.c b/apps/onplay.c index ee183450fa..7245ac2016 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -1986,3 +1986,9 @@ int onplay(char* file, int attr, int from, bool hotkey) return onplay_result; } } + +int get_onplay_context(void) +{ + return context; +} + diff --git a/apps/onplay.h b/apps/onplay.h index bff8dafff0..3a259d68e6 100644 --- a/apps/onplay.h +++ b/apps/onplay.h @@ -22,6 +22,7 @@ #define _ONPLAY_H_ int onplay(char* file, int attr, int from_screen, bool hotkey); +int get_onplay_context(void); enum { ONPLAY_MAINMENU = -1,