diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp index 7bba76f129..a877dc28b2 100644 --- a/Applications/FileManager/main.cpp +++ b/Applications/FileManager/main.cpp @@ -77,8 +77,8 @@ int main(int argc, char** argv) directory_view->open(location_textbox->text()); }; - file_system_model->on_selection_changed = [&](auto& index) { - auto path = file_system_model->path(index); + tree_view->on_selection_change = [&] { + auto path = file_system_model->path(tree_view->selection().first()); if (directory_view->path() == path) return; directory_view->open(path); diff --git a/Libraries/LibGUI/GAbstractView.cpp b/Libraries/LibGUI/GAbstractView.cpp index 19c6cb9234..bfeaf5a47b 100644 --- a/Libraries/LibGUI/GAbstractView.cpp +++ b/Libraries/LibGUI/GAbstractView.cpp @@ -100,5 +100,8 @@ void GAbstractView::activate(const GModelIndex& index) void GAbstractView::notify_selection_changed(Badge) { + did_update_selection(); + if (on_selection_change) + on_selection_change(); update(); } diff --git a/Libraries/LibGUI/GAbstractView.h b/Libraries/LibGUI/GAbstractView.h index 35c569fad6..04496027e5 100644 --- a/Libraries/LibGUI/GAbstractView.h +++ b/Libraries/LibGUI/GAbstractView.h @@ -36,6 +36,7 @@ public: void set_activates_on_selection(bool b) { m_activates_on_selection = b; } bool activates_on_selection() const { return m_activates_on_selection; } + Function on_selection_change; Function on_activation; Function on_selection; Function on_context_menu_request;