[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rockbox-cvs
Subject:    Database: Remove File View menu
From:       rockbox-gerrit-noreply--- via rockbox-cvs <rockbox-cvs () lists ! haxx ! se>
Date:       2022-04-18 14:48:57
Message-ID: 202204181448.23IEmv2R104841 () archos ! rockbox ! org
[Download RAW message or body]

commit 1c66e975222558e8cd80d8ce2cd083370fb157a2
Author: Christian Soffke <christian.soffke@gmail.com>
Date:   Tue Apr 12 19:31:24 2022 +0200

    Database: Remove File View menu
    
    These options don't seem to
    apply to the database...
    
    Change-Id: I777073eeaed4099acf44996b95fa05b4c2b3abc4

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,
-- 
rockbox-cvs mailing list
rockbox-cvs@lists.haxx.se
https://lists.haxx.se/listinfo/rockbox-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic