1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:27:35 +00:00

FileManager: Make DirectoryView listen for configuration changes

DirectoryView now inherits from Config::Listener and will update its
view mode immediately if changed from elsewhere.

This is pretty neat. :^)
This commit is contained in:
Andreas Kling 2021-08-26 19:15:55 +02:00
parent c8c58626e9
commit 696dbc889f
3 changed files with 18 additions and 1 deletions

View file

@ -340,6 +340,17 @@ void DirectoryView::set_view_mode_from_string(String const& mode)
}
}
void DirectoryView::config_string_did_change(String const& domain, String const& group, String const& key, String const& value)
{
if (domain != "FileManager" || group != "DirectoryView")
return;
if (key == "ViewMode") {
set_view_mode_from_string(value);
return;
}
}
void DirectoryView::set_view_mode(ViewMode mode)
{
if (m_view_mode == mode)