1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:47:35 +00:00

LibGUI: Convert GRadioButton to ObjectPtr

This commit is contained in:
Andreas Kling 2019-09-21 18:58:03 +02:00
parent 870bc2a4d1
commit f8d751440b
3 changed files with 11 additions and 6 deletions

View file

@ -107,8 +107,8 @@ ObjectPtr<GWindow> create_settings_window(TerminalWidget& terminal, RefPtr<CConf
radio_container->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
radio_container->set_preferred_size(100, 70);
auto* sysbell_radio = new GRadioButton("Use (Audible) System Bell", radio_container);
auto* visbell_radio = new GRadioButton("Use (Visual) Terminal Bell", radio_container);
auto sysbell_radio = GRadioButton::construct("Use (Audible) System Bell", radio_container);
auto visbell_radio = GRadioButton::construct("Use (Visual) Terminal Bell", radio_container);
sysbell_radio->set_checked(terminal.should_beep());
visbell_radio->set_checked(!terminal.should_beep());
sysbell_radio->on_checked = [&terminal](const bool checked) {
@ -181,8 +181,13 @@ int main(int argc, char** argv)
auto app_menu = make<GMenu>("Terminal");
app_menu->add_action(GAction::create("Settings...", load_png("/res/icons/gear16.png"),
[&](const GAction&) {
if (!settings_window)
if (!settings_window) {
settings_window = create_settings_window(*terminal, config);
settings_window->on_close_request = [&] {
settings_window = nullptr;
return GWindow::CloseRequestDecision::Close;
};
}
settings_window->show();
settings_window->move_to_front();
}));