1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +00:00

LibGUI: Add a cancel button callback to settings window tabs

Some settings tabs, like the ones on the upcoming terminal settings,
need to know when the cancel button is pressed to clean up things like
temporary live updates. Therefore, the SettingsWindow::Tab now features
a cancel_settings callback which does not need to be implemented.
This commit is contained in:
kleines Filmröllchen 2021-11-21 00:57:07 +01:00 committed by Andreas Kling
parent 72e9d024b9
commit 1e9554145e
2 changed files with 4 additions and 1 deletions

View file

@ -58,6 +58,8 @@ SettingsWindow::SettingsWindow(StringView title, ShowDefaultsButton show_default
m_cancel_button = button_container.add<GUI::Button>("Cancel");
m_cancel_button->set_fixed_width(75);
m_cancel_button->on_click = [&](auto) {
for (auto& tab : m_tabs)
tab.cancel_settings();
GUI::Application::the()->quit();
};