GUI: Fix hidden files visibility getting out of sync in the files browser

- The checkbox state was not initialized when opening the dialog.
- The visibility state was initialized from ConfMan too early resuling
  in the value being incorrect when multiple file browsers are used.
This commit is contained in:
Bastien Bouclet 2016-08-29 08:03:40 +02:00
parent 8d6a6fb982
commit dac70196f0

View File

@ -49,7 +49,7 @@ BrowserDialog::BrowserDialog(const char *title, bool dirBrowser)
_isDirBrowser = dirBrowser;
_fileList = NULL;
_currentPath = NULL;
_showHidden = ConfMan.getBool("gui_browser_show_hidden", Common::ConfigManager::kApplicationDomain);
_showHidden = false;
// Headline - TODO: should be customizable during creation time
new StaticTextWidget(this, "Browser.Headline", title);
@ -85,8 +85,10 @@ void BrowserDialog::open() {
if (!_node.isDirectory())
_node = Common::FSNode(".");
// Alway refresh file list
updateListing();
_showHidden = ConfMan.getBool("gui_browser_show_hidden", Common::ConfigManager::kApplicationDomain);
_showHiddenWidget->setState(_showHidden);
// At this point the file list has already been refreshed by the kHiddenCmd handler
}
void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {