Navigation Menu

Skip to content

Commit

Permalink
#5180: Migrate FilterMenu to use registerMenuItem instead of doing th…
Browse files Browse the repository at this point in the history
…e logic on its own
  • Loading branch information
codereader committed May 15, 2020
1 parent 3f03436 commit 9344476
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions radiant/ui/filters/FilterMenu.cpp
Expand Up @@ -23,14 +23,9 @@ FilterMenu::FilterMenu() :

FilterMenu::~FilterMenu()
{
for (auto i : _filterItems)
for (const auto& i : _filterItems)
{
IEventPtr event = GlobalEventManager().findEvent(i.first);

if (event)
{
event->disconnectMenuItem(i.second);
}
GlobalEventManager().unregisterMenuItem(i.first, i.second);
}

_menu = nullptr;
Expand All @@ -43,12 +38,7 @@ void FilterMenu::visitFilter(const std::string& filterName)

std::string eventName = GlobalFilterSystem().getFilterEventName(filterName);

IEventPtr event = GlobalEventManager().findEvent(eventName);

if (event)
{
event->connectMenuItem(item);
}
GlobalEventManager().registerMenuItem(eventName, item);

_filterItems.emplace(eventName, item);
}
Expand Down

0 comments on commit 9344476

Please sign in to comment.