diff --git a/Applications/FileManager/DirectoryView.cpp b/Applications/FileManager/DirectoryView.cpp index e4156adc3c..24f4b81675 100644 --- a/Applications/FileManager/DirectoryView.cpp +++ b/Applications/FileManager/DirectoryView.cpp @@ -58,17 +58,15 @@ DirectoryView::DirectoryView(GWidget* parent) m_item_view->set_model_column(GDirectoryModel::Column::Name); - m_item_view->on_model_notification = [this](const GModelNotification& notification) { - if (notification.type() == GModelNotification::Type::ModelUpdated) { - set_status_message(String::format("%d item%s (%u byte%s)", - model().row_count(), - model().row_count() != 1 ? "s" : "", - model().bytes_in_files(), - model().bytes_in_files() != 1 ? "s" : "")); + m_table_view->model()->on_model_update = [this](auto&) { + set_status_message(String::format("%d item%s (%u byte%s)", + model().row_count(), + model().row_count() != 1 ? "s" : "", + model().bytes_in_files(), + model().bytes_in_files() != 1 ? "s" : "")); - if (on_path_change) - on_path_change(model().path()); - } + if (on_path_change) + on_path_change(model().path()); }; m_model->on_thumbnail_progress = [this](int done, int total) { diff --git a/Applications/SystemMonitor/ProcessTableView.cpp b/Applications/SystemMonitor/ProcessTableView.cpp index 2871018182..50a080c118 100644 --- a/Applications/SystemMonitor/ProcessTableView.cpp +++ b/Applications/SystemMonitor/ProcessTableView.cpp @@ -26,14 +26,6 @@ void ProcessTableView::refresh() model()->update(); } -void ProcessTableView::model_notification(const GModelNotification& notification) -{ - if (notification.type() == GModelNotification::ModelUpdated) { - // Do something? - return; - } -} - pid_t ProcessTableView::selected_pid() const { if (!model()->selected_index().is_valid()) diff --git a/Applications/SystemMonitor/ProcessTableView.h b/Applications/SystemMonitor/ProcessTableView.h index 98d3f3edb1..3eace1bdb1 100644 --- a/Applications/SystemMonitor/ProcessTableView.h +++ b/Applications/SystemMonitor/ProcessTableView.h @@ -17,7 +17,4 @@ public: void refresh(); Function on_process_selected; - -private: - virtual void model_notification(const GModelNotification&) override; }; diff --git a/Libraries/LibGUI/GAbstractView.cpp b/Libraries/LibGUI/GAbstractView.cpp index a7e560cb0b..cbf370cb96 100644 --- a/Libraries/LibGUI/GAbstractView.cpp +++ b/Libraries/LibGUI/GAbstractView.cpp @@ -28,17 +28,10 @@ void GAbstractView::set_model(RefPtr&& model) did_update_model(); } -void GAbstractView::model_notification(const GModelNotification& notification) -{ - if (on_model_notification) - on_model_notification(notification); -} - void GAbstractView::did_update_model() { if (!model() || model()->selected_index() != m_edit_index) stop_editing(); - model_notification(GModelNotification(GModelNotification::ModelUpdated)); } void GAbstractView::did_update_selection() diff --git a/Libraries/LibGUI/GAbstractView.h b/Libraries/LibGUI/GAbstractView.h index 730d944b32..53ff525ecf 100644 --- a/Libraries/LibGUI/GAbstractView.h +++ b/Libraries/LibGUI/GAbstractView.h @@ -34,12 +34,10 @@ public: Function on_activation; Function on_selection; Function on_context_menu_request; - Function on_model_notification; Function(const GModelIndex&)> aid_create_editing_delegate; protected: - virtual void model_notification(const GModelNotification&); virtual void did_scroll() override; void activate(const GModelIndex&); void update_edit_widget_position(); diff --git a/Libraries/LibGUI/GModel.h b/Libraries/LibGUI/GModel.h index bfdc9125c8..e41c2e50ea 100644 --- a/Libraries/LibGUI/GModel.h +++ b/Libraries/LibGUI/GModel.h @@ -18,27 +18,6 @@ enum class GSortOrder { Descending }; -class GModelNotification { -public: - enum Type { - Invalid = 0, - ModelUpdated, - }; - - explicit GModelNotification(Type type, const GModelIndex& index = GModelIndex()) - : m_type(type) - , m_index(index) - { - } - - Type type() const { return m_type; } - GModelIndex index() const { return m_index; } - -private: - Type m_type { Invalid }; - GModelIndex m_index; -}; - class GModel : public RefCounted { public: struct ColumnMetadata {