DolphinWX: Propagate event to refresh the game list

Prior to this refactor, certain options would cause the game list to refresh when the config modal dialog is closed (such as adding a folder to the path list). This restores that functionality.
This commit is contained in:
Lioncash
2015-03-18 20:33:20 -04:00
parent febd3909c6
commit b459a8ec61
4 changed files with 22 additions and 7 deletions

View File

@ -19,15 +19,20 @@
#include "DolphinWX/Config/PathConfigPane.h"
#include "DolphinWX/Config/WiiConfigPane.h"
// Sent by child panes to signify that the game list should
// be updated when this modal dialog closes.
wxDEFINE_EVENT(wxDOLPHIN_CFG_REFRESH_LIST, wxCommandEvent);
CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title,
const wxPoint& position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style)
{
// Control refreshing of the ISOs list
bRefreshList = false;
m_refresh_game_list_on_close = false;
Bind(wxEVT_CLOSE_WINDOW, &CConfigMain::OnClose, this);
Bind(wxEVT_BUTTON, &CConfigMain::OnOk, this, wxID_OK);
Bind(wxDOLPHIN_CFG_REFRESH_LIST, &CConfigMain::OnSetRefreshGameListOnClose, this);
CreateGUIControls();
}
@ -79,7 +84,7 @@ void CConfigMain::CreateGUIControls()
void CConfigMain::OnClose(wxCloseEvent& WXUNUSED(event))
{
EndModal((bRefreshList) ? wxID_OK : wxID_CANCEL);
EndModal((m_refresh_game_list_on_close) ? wxID_OK : wxID_CANCEL);
}
void CConfigMain::OnOk(wxCommandEvent& WXUNUSED(event))
@ -89,3 +94,8 @@ void CConfigMain::OnOk(wxCommandEvent& WXUNUSED(event))
// Save the config. Dolphin crashes too often to only save the settings on closing
SConfig::GetInstance().SaveSettings();
}
void CConfigMain::OnSetRefreshGameListOnClose(wxCommandEvent& WXUNUSED(event))
{
m_refresh_game_list_on_close = true;
}