mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-09 20:52:54 +00:00
GFileSystemModel: Don't reload icons every time they are requested.
This was really slugging up the interactive resizing. :^)
This commit is contained in:
parent
73f3e05ebb
commit
6ab55801e2
Notes:
sideshowbarker
2024-07-19 14:53:33 +09:00
Author: https://github.com/awesomekling
Commit: 6ab55801e2
2 changed files with 10 additions and 3 deletions
LibGUI
|
@ -129,6 +129,9 @@ GFileSystemModel::GFileSystemModel(const String& root_path, Mode mode)
|
|||
: m_root_path(FileSystemPath(root_path).string())
|
||||
, m_mode(mode)
|
||||
{
|
||||
m_open_folder_icon = GIcon::default_icon("filetype-folder-open");
|
||||
m_closed_folder_icon = GIcon::default_icon("filetype-folder");
|
||||
m_file_icon = GIcon::default_icon("filetype-unknown");
|
||||
update();
|
||||
}
|
||||
|
||||
|
@ -188,10 +191,10 @@ GVariant GFileSystemModel::data(const GModelIndex& index, Role role) const
|
|||
if (role == GModel::Role::Icon) {
|
||||
if (node.type == Node::Directory) {
|
||||
if (selected_index() == index)
|
||||
return GIcon::default_icon("filetype-folder-open");
|
||||
return GIcon::default_icon("filetype-folder");
|
||||
return m_open_folder_icon;
|
||||
return m_closed_folder_icon;
|
||||
}
|
||||
return GIcon::default_icon("filetype-unknown");
|
||||
return m_file_icon;
|
||||
}
|
||||
return { };
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue