Fix duplicate menu items by respecting the addToEngine bool.

resolves #6
master
poikilos 2021-03-28 08:50:51 -04:00
parent 29f52a1ad1
commit 3e6f8324eb
2 changed files with 7 additions and 1 deletions

View File

@ -343,6 +343,7 @@ Engine::Engine()
this->m_EnableTestAndExit = false;
settings.set_int("max_recent", 10);
std::string profile = std::getenv("HOME");
// ^ changes to USERPROFILE below if blank
std::string appdataParent;
std::string appdatas;
std::string myAppData;

View File

@ -35,6 +35,9 @@ const u32 UserInterface::UIC_FILE_RECENT_FIRST = UIE_RECENTMENU + 1;
// PRIVATE
void UserInterface::setupUserInterface()
{
this->recent_initialized = false;
this->recentMenu = nullptr;
// Menu
menu = m_Gui->addMenu();
menu->addItem(L"File", UIE_FILEMENU, true, true);
@ -893,7 +896,9 @@ void UserInterface::addRecentMenuItem(std::string path, bool addToEngine)
}
this->m_file_recent_last_idx = menu->getID();
*/
this->m_Engine->addRecent(path);
if (addToEngine) {
this->m_Engine->addRecent(path);
}
}
}