mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +00:00
GModel: Rename on_model_update(GModel&) => on_update()
Just simplifying the API of this hook a little bit.
This commit is contained in:
parent
f7dce05c82
commit
076827a05d
4 changed files with 5 additions and 5 deletions
|
@ -58,7 +58,7 @@ DirectoryView::DirectoryView(GWidget* parent)
|
||||||
|
|
||||||
m_item_view->set_model_column(GDirectoryModel::Column::Name);
|
m_item_view->set_model_column(GDirectoryModel::Column::Name);
|
||||||
|
|
||||||
m_table_view->model()->on_model_update = [this](auto&) {
|
m_table_view->model()->on_update = [this] {
|
||||||
set_status_message(String::format("%d item%s (%u byte%s)",
|
set_status_message(String::format("%d item%s (%u byte%s)",
|
||||||
model().row_count(),
|
model().row_count(),
|
||||||
model().row_count() != 1 ? "s" : "",
|
model().row_count() != 1 ? "s" : "",
|
||||||
|
|
|
@ -27,8 +27,8 @@ void GModel::for_each_view(Function<void(GAbstractView&)> callback)
|
||||||
|
|
||||||
void GModel::did_update()
|
void GModel::did_update()
|
||||||
{
|
{
|
||||||
if (on_model_update)
|
if (on_update)
|
||||||
on_model_update(*this);
|
on_update();
|
||||||
for_each_view([](auto& view) {
|
for_each_view([](auto& view) {
|
||||||
view.did_update_model();
|
view.did_update_model();
|
||||||
});
|
});
|
||||||
|
|
|
@ -67,7 +67,7 @@ public:
|
||||||
void register_view(Badge<GAbstractView>, GAbstractView&);
|
void register_view(Badge<GAbstractView>, GAbstractView&);
|
||||||
void unregister_view(Badge<GAbstractView>, GAbstractView&);
|
void unregister_view(Badge<GAbstractView>, GAbstractView&);
|
||||||
|
|
||||||
Function<void(GModel&)> on_model_update;
|
Function<void()> on_update;
|
||||||
Function<void(const GModelIndex&)> on_selection_changed;
|
Function<void(const GModelIndex&)> on_selection_changed;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -7,7 +7,7 @@ GSortingProxyModel::GSortingProxyModel(NonnullRefPtr<GModel>&& target)
|
||||||
: m_target(move(target))
|
: m_target(move(target))
|
||||||
, m_key_column(-1)
|
, m_key_column(-1)
|
||||||
{
|
{
|
||||||
m_target->on_model_update = [this](GModel&) {
|
m_target->on_update = [this] {
|
||||||
resort();
|
resort();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue