diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index b78c17e6..4245e90d 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -927,6 +927,7 @@ void GMenu2X::readConfig() { string conf = exe_path() + "/gmenu2x.conf"; // Defaults *** Sync with default values in writeConfig confInt["saveSelection"] = 1; + //confStr["HideSections"] = ""; confInt["dialogAutoStart"] = 1; confInt["showHints"] = 1; confStr["datetime"] = xstr(__BUILDTIME__); @@ -950,6 +951,9 @@ void GMenu2X::readConfig() { confInt["cpuLink"] = CPU_LINK; confInt["cpuStep"] = CPU_STEP; + confInt["hideSectionApplications"] = 0; + confInt["hideSectionGames"] = 0; + // input.update(false); // if (!input[SETTINGS] && file_exists(conf)) { @@ -988,6 +992,9 @@ void GMenu2X::readConfig() { confInt["section"] = 0; confInt["link"] = 0; } + + hideSectionApplications = confInt["hideSectionApplications"] != 0; + hideSectionGames = confInt["hideSectionGames"] != 0; } void GMenu2X::writeConfig() { diff --git a/src/gmenu2x.h b/src/gmenu2x.h index 492033e5..9a513e83 100644 --- a/src/gmenu2x.h +++ b/src/gmenu2x.h @@ -153,6 +153,8 @@ class GMenu2X { Menu *menu; bool f200 = true; //gp2x type // touchscreen string currBackdrop; + bool hideSectionApplications = false; + bool hideSectionGames = false; ~GMenu2X(); void quit(); diff --git a/src/menu.cpp b/src/menu.cpp index 9ba4b031..2836b77e 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -77,6 +77,21 @@ void Menu::readSections() { addSection("settings"); addSection("applications"); + /* To keep things simple, we will always create the applications section */ + if (gmenu2x->hideSectionApplications) + { + auto itr = std::find(sections.begin(), sections.end(), "applications"); + if (itr != sections.end()) + sections.erase(itr); + } + + if (gmenu2x->hideSectionGames) + { + auto itr = std::find(sections.begin(), sections.end(), "games"); + if (itr != sections.end()) + sections.erase(itr); + } + closedir(dirp); sort(sections.begin(),sections.end(), case_less()); }