FileManager: Remove one direct call to FileSystemModel from outside

We should stop accessing the FileSystemModel outside DirectoryView.
This whole app is pretty badly factored, due to LibGUI being in its
infancy while it first developed.
This commit is contained in:
Andreas Kling 2020-08-12 20:27:23 +02:00
parent aae296ef08
commit 6caaa2bfdb
Notes: sideshowbarker 2024-07-19 03:41:19 +09:00
3 changed files with 8 additions and 1 deletions

View file

@ -355,3 +355,8 @@ void DirectoryView::update_statusbar()
set_status_message(builder.to_string());
}
void DirectoryView::set_should_show_dotfiles(bool show_dotfiles)
{
m_model->set_should_show_dotfiles(show_dotfiles);
}

View file

@ -110,6 +110,8 @@ public:
callback(*m_columns_view);
}
void set_should_show_dotfiles(bool);
GUI::FileSystemModel& model() { return *m_model; }
private:

View file

@ -678,7 +678,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
view_menu.add_action(*view_as_columns_action);
view_menu.add_separator();
view_menu.add_action(GUI::Action::create_checkable("Show dotfiles", { Mod_Ctrl, Key_H }, [&](auto& action) {
directory_view.model().set_should_show_dotfiles(action.is_checked());
directory_view.set_should_show_dotfiles(action.is_checked());
}));
auto& go_menu = menubar->add_menu("Go");