1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +00:00

Browser: Load icons at start of program

Previously, Browser loaded icons from the disk every time an icon
was set. In addition to making more calls to the disk and decoding
more images, this makes error propagation impossible. This change
moves all icon loading to the start of the program.
This commit is contained in:
Dylan Katz 2022-01-10 19:06:11 -08:00 committed by Andreas Kling
parent a2a93727db
commit 3919a1dcc0
10 changed files with 101 additions and 35 deletions

View file

@ -5,6 +5,7 @@
*/
#include "WindowActions.h"
#include <Applications/Browser/Browser.h>
#include <LibGUI/Icon.h>
#include <LibGUI/Window.h>
#include <LibGfx/Bitmap.h>
@ -24,7 +25,7 @@ WindowActions::WindowActions(GUI::Window& window)
VERIFY(!s_the);
s_the = this;
m_create_new_tab_action = GUI::Action::create(
"&New Tab", { Mod_Ctrl, Key_T }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
"&New Tab", { Mod_Ctrl, Key_T }, g_icon_bag.new_tab, [this](auto&) {
if (on_create_new_tab)
on_create_new_tab();
},