mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
Taskbar: Propagate more errors on widget population
This commit is contained in:
parent
10626e6c6c
commit
352c1fec2d
1 changed files with 10 additions and 14 deletions
|
@ -68,40 +68,36 @@ TaskbarWindow::TaskbarWindow()
|
||||||
set_title("Taskbar");
|
set_title("Taskbar");
|
||||||
|
|
||||||
on_screen_rects_change(GUI::Desktop::the().rects(), GUI::Desktop::the().main_screen_index());
|
on_screen_rects_change(GUI::Desktop::the().rects(), GUI::Desktop::the().main_screen_index());
|
||||||
|
|
||||||
auto& main_widget = set_main_widget<TaskbarWidget>();
|
|
||||||
main_widget.set_layout<GUI::HorizontalBoxLayout>();
|
|
||||||
main_widget.layout()->set_margins({ 2, 3, 0, 3 });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<void> TaskbarWindow::populate_taskbar()
|
ErrorOr<void> TaskbarWindow::populate_taskbar()
|
||||||
{
|
{
|
||||||
if (!main_widget())
|
auto main_widget = TRY(try_set_main_widget<TaskbarWidget>());
|
||||||
return Error::from_string_literal("TaskbarWindow::populate_taskbar: main_widget is not set");
|
(void)TRY(main_widget->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||||
|
main_widget->layout()->set_margins({ 2, 3, 0, 3 });
|
||||||
|
|
||||||
m_quick_launch = TRY(Taskbar::QuickLaunchWidget::create());
|
m_quick_launch = TRY(Taskbar::QuickLaunchWidget::create());
|
||||||
main_widget()->add_child(*m_quick_launch);
|
TRY(main_widget->try_add_child(*m_quick_launch));
|
||||||
|
|
||||||
m_task_button_container = main_widget()->add<GUI::Widget>();
|
m_task_button_container = TRY(main_widget->try_add<GUI::Widget>());
|
||||||
m_task_button_container->set_layout<GUI::HorizontalBoxLayout>();
|
(void)TRY(m_task_button_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||||
m_task_button_container->layout()->set_spacing(3);
|
m_task_button_container->layout()->set_spacing(3);
|
||||||
|
|
||||||
m_default_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png"sv));
|
m_default_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png"sv));
|
||||||
|
|
||||||
m_applet_area_container = main_widget()->add<GUI::Frame>();
|
m_applet_area_container = TRY(main_widget->try_add<GUI::Frame>());
|
||||||
m_applet_area_container->set_frame_thickness(1);
|
m_applet_area_container->set_frame_thickness(1);
|
||||||
m_applet_area_container->set_frame_shape(Gfx::FrameShape::Box);
|
m_applet_area_container->set_frame_shape(Gfx::FrameShape::Box);
|
||||||
m_applet_area_container->set_frame_shadow(Gfx::FrameShadow::Sunken);
|
m_applet_area_container->set_frame_shadow(Gfx::FrameShadow::Sunken);
|
||||||
|
|
||||||
m_clock_widget = main_widget()->add<Taskbar::ClockWidget>();
|
m_clock_widget = TRY(main_widget->try_add<Taskbar::ClockWidget>());
|
||||||
|
|
||||||
m_show_desktop_button = GUI::Button::construct();
|
m_show_desktop_button = TRY(main_widget->try_add<GUI::Button>());
|
||||||
m_show_desktop_button->set_tooltip("Show Desktop");
|
m_show_desktop_button->set_tooltip("Show Desktop");
|
||||||
m_show_desktop_button->set_icon(GUI::Icon::default_icon("desktop"sv).bitmap_for_size(16));
|
m_show_desktop_button->set_icon(TRY(GUI::Icon::try_create_default_icon("desktop"sv)).bitmap_for_size(16));
|
||||||
m_show_desktop_button->set_button_style(Gfx::ButtonStyle::Coolbar);
|
m_show_desktop_button->set_button_style(Gfx::ButtonStyle::Coolbar);
|
||||||
m_show_desktop_button->set_fixed_size(24, 24);
|
m_show_desktop_button->set_fixed_size(24, 24);
|
||||||
m_show_desktop_button->on_click = TaskbarWindow::show_desktop_button_clicked;
|
m_show_desktop_button->on_click = TaskbarWindow::show_desktop_button_clicked;
|
||||||
main_widget()->add_child(*m_show_desktop_button);
|
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue