FileManager: Set up the model error/complete callbacks earlier

We need to set these up before calling set_root_path, as that's where
the error callbacks would fire from.
This commit is contained in:
Andreas Kling 2020-10-22 18:26:59 +02:00
parent 0b746075d8
commit 39a7358b51
Notes: sideshowbarker 2024-07-19 01:48:21 +09:00

View file

@ -158,9 +158,6 @@ const GUI::FileSystemModel::Node& DirectoryView::node(const GUI::ModelIndex& ind
void DirectoryView::setup_model()
{
if (is_desktop())
m_model->set_root_path(Core::StandardPaths::desktop_directory());
m_model->on_error = [this](int, const char* error_string) {
auto failed_path = m_model->root_path();
auto error_message = String::formatted("Could not read {}:\n{}", failed_path, error_string);
@ -199,6 +196,9 @@ void DirectoryView::setup_model()
if (on_thumbnail_progress)
on_thumbnail_progress(done, total);
};
if (is_desktop())
m_model->set_root_path(Core::StandardPaths::desktop_directory());
}
void DirectoryView::setup_icon_view()