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

Taskbar: Propagate errors while loading bmp

This commit is contained in:
ericLemanissier 2022-12-22 07:23:13 +01:00 committed by Sam Atkins
parent 2e1f7c5ac8
commit 7fa78b2456

View file

@ -10,6 +10,7 @@
#include "TaskbarWindow.h"
#include <AK/Debug.h>
#include <AK/QuickSort.h>
#include <AK/Try.h>
#include <LibConfig/Client.h>
#include <LibCore/ConfigFile.h>
#include <LibCore/EventLoop.h>
@ -116,7 +117,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window)
Vector<DeprecatedString> const sorted_app_categories = TRY(discover_apps_and_categories());
auto system_menu = TRY(GUI::Menu::try_create("\xE2\x9A\xA1")); // HIGH VOLTAGE SIGN
system_menu->add_action(GUI::Action::create("&About SerenityOS", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/ladyball.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
system_menu->add_action(GUI::Action::create("&About SerenityOS", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/ladyball.png"sv)), [&](auto&) {
GUI::Process::spawn_or_show_error(&window, "/bin/About"sv);
}));
@ -225,7 +226,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window)
g_themes_group.set_unchecking_allowed(false);
g_themes_menu = &system_menu->add_submenu("&Themes");
g_themes_menu->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/themes.png"sv).release_value_but_fixme_should_propagate_errors());
g_themes_menu->set_icon(TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/themes.png"sv)));
g_themes = TRY(Gfx::list_installed_system_themes());
auto current_theme_name = GUI::ConnectionToWindowServer::the().get_system_theme();
@ -258,15 +259,15 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window)
}
};
system_menu->add_action(GUI::Action::create("&Settings", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-settings.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
system_menu->add_action(GUI::Action::create("&Settings", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-settings.png"sv)), [&](auto&) {
GUI::Process::spawn_or_show_error(&window, "/bin/Settings"sv);
}));
system_menu->add_separator();
system_menu->add_action(GUI::Action::create("&Help", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
system_menu->add_action(GUI::Action::create("&Help", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png"sv)), [&](auto&) {
GUI::Process::spawn_or_show_error(&window, "/bin/Help"sv);
}));
system_menu->add_action(GUI::Action::create("&Run...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-run.png"sv).release_value_but_fixme_should_propagate_errors(), [](auto&) {
system_menu->add_action(GUI::Action::create("&Run...", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-run.png"sv)), [](auto&) {
posix_spawn_file_actions_t spawn_actions;
posix_spawn_file_actions_init(&spawn_actions);
auto home_directory = Core::StandardPaths::home_directory();
@ -284,7 +285,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window)
posix_spawn_file_actions_destroy(&spawn_actions);
}));
system_menu->add_separator();
system_menu->add_action(GUI::Action::create("E&xit...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/power.png"sv).release_value_but_fixme_should_propagate_errors(), [](auto&) {
system_menu->add_action(GUI::Action::create("E&xit...", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/power.png"sv)), [](auto&) {
auto command = ShutdownDialog::show();
if (command.size() == 0)