1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:57:44 +00:00

Calendar: Promote view_type ActionGroup to CalendarWidget's member

Otherwise, it would get destroyed after exiting the create() function.
This commit is contained in:
0GreenClover0 2023-08-13 20:49:34 +02:00 committed by Jelle Raaijmakers
parent bb23ee3521
commit 340230f6bf
2 changed files with 7 additions and 4 deletions

View file

@ -49,11 +49,12 @@ ErrorOr<NonnullRefPtr<CalendarWidget>> CalendarWidget::create(GUI::Window* paren
view_month_action->set_checked(true);
auto view_year_action = TRY(widget->create_view_year_action());
auto view_type_action_group = make<GUI::ActionGroup>();
view_type_action_group->set_exclusive(true);
view_type_action_group->add_action(*view_month_action);
view_type_action_group->add_action(*view_year_action);
widget->m_view_type_action_group = make<GUI::ActionGroup>();
widget->m_view_type_action_group->set_exclusive(true);
widget->m_view_type_action_group->add_action(*view_month_action);
widget->m_view_type_action_group->add_action(*view_year_action);
auto default_view = Config::read_string("Calendar"sv, "View"sv, "DefaultView"sv, "Month"sv);
if (default_view == "Year")
view_year_action->set_checked(true);