summaryrefslogtreecommitdiff
path: root/Userland/Applications/Calendar
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-07-21 18:02:15 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-21 18:02:15 +0200
commitc7d891765cc87ec04f8d332b93fc7c3f82521d7f (patch)
tree9d414d3ad62e0193b1b6fb0d12079e11e96e69b1 /Userland/Applications/Calendar
parentf0409081f562b635de3a23d7babbc7348cbb970c (diff)
downloadserenity-c7d891765cc87ec04f8d332b93fc7c3f82521d7f.zip
LibGfx: Use "try_" prefix for static factory functions
Also mark them as [[nodiscard]].
Diffstat (limited to 'Userland/Applications/Calendar')
-rw-r--r--Userland/Applications/Calendar/main.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/Userland/Applications/Calendar/main.cpp b/Userland/Applications/Calendar/main.cpp
index 3d0a2885b1..f12bf47690 100644
--- a/Userland/Applications/Calendar/main.cpp
+++ b/Userland/Applications/Calendar/main.cpp
@@ -54,7 +54,7 @@ int main(int argc, char** argv)
auto toolbar = main_widget.find_descendant_of_type_named<GUI::Toolbar>("toolbar");
auto calendar = main_widget.find_descendant_of_type_named<GUI::Calendar>("calendar");
- auto prev_date_action = GUI::Action::create({}, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"), [&](const GUI::Action&) {
+ auto prev_date_action = GUI::Action::create({}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"), [&](const GUI::Action&) {
unsigned view_month = calendar->view_month();
unsigned view_year = calendar->view_year();
if (calendar->mode() == GUI::Calendar::Month) {
@@ -69,7 +69,7 @@ int main(int argc, char** argv)
calendar->update_tiles(view_year, view_month);
});
- auto next_date_action = GUI::Action::create({}, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"), [&](const GUI::Action&) {
+ auto next_date_action = GUI::Action::create({}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"), [&](const GUI::Action&) {
unsigned view_month = calendar->view_month();
unsigned view_year = calendar->view_year();
if (calendar->mode() == GUI::Calendar::Month) {
@@ -84,22 +84,22 @@ int main(int argc, char** argv)
calendar->update_tiles(view_year, view_month);
});
- auto add_event_action = GUI::Action::create("&Add Event", {}, Gfx::Bitmap::load_from_file("/res/icons/16x16/add-event.png"), [&](const GUI::Action&) {
+ auto add_event_action = GUI::Action::create("&Add Event", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/add-event.png"), [&](const GUI::Action&) {
AddEventDialog::show(calendar->selected_date(), window);
});
- auto jump_to_action = GUI::Action::create("Jump to &Today", {}, Gfx::Bitmap::load_from_file("/res/icons/16x16/calendar-date.png"), [&](const GUI::Action&) {
+ auto jump_to_action = GUI::Action::create("Jump to &Today", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/calendar-date.png"), [&](const GUI::Action&) {
calendar->set_selected_date(Core::DateTime::now());
calendar->update_tiles(Core::DateTime::now().year(), Core::DateTime::now().month());
});
- auto view_month_action = GUI::Action::create_checkable("&Month View", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/calendar-month-view.png"), [&](const GUI::Action&) {
+ auto view_month_action = GUI::Action::create_checkable("&Month View", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/calendar-month-view.png"), [&](const GUI::Action&) {
if (calendar->mode() == GUI::Calendar::Year)
calendar->toggle_mode();
});
view_month_action->set_checked(true);
- auto view_year_action = GUI::Action::create_checkable("&Year View", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/icon-view.png"), [&](const GUI::Action&) {
+ auto view_year_action = GUI::Action::create_checkable("&Year View", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/icon-view.png"), [&](const GUI::Action&) {
if (calendar->mode() == GUI::Calendar::Month)
calendar->toggle_mode();
});
@@ -128,7 +128,7 @@ int main(int argc, char** argv)
auto menubar = GUI::Menubar::construct();
auto& file_menu = menubar->add_menu("&File");
- file_menu.add_action(GUI::Action::create("&Add Event", { Mod_Ctrl | Mod_Shift, Key_E }, Gfx::Bitmap::load_from_file("/res/icons/16x16/add-event.png"),
+ file_menu.add_action(GUI::Action::create("&Add Event", { Mod_Ctrl | Mod_Shift, Key_E }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/add-event.png"),
[&](const GUI::Action&) {
AddEventDialog::show(calendar->selected_date(), window);
}));