diff options
author | Andreas Kling <kling@serenityos.org> | 2020-07-19 21:37:19 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-19 21:37:19 +0200 |
commit | dc696ba85c2bf359da389db521fd136c2e4e7ee2 (patch) | |
tree | af0637005c2689c1b949d78ae1a8b74ad6301eed /Libraries/LibGUI/FileSystemModel.cpp | |
parent | 3a62029deed211095bdd2c4a830870c84bd73693 (diff) | |
download | serenity-dc696ba85c2bf359da389db521fd136c2e4e7ee2.zip |
LibGUI: Show a special icon for the home directory in FileSystemModel
Diffstat (limited to 'Libraries/LibGUI/FileSystemModel.cpp')
-rw-r--r-- | Libraries/LibGUI/FileSystemModel.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Libraries/LibGUI/FileSystemModel.cpp b/Libraries/LibGUI/FileSystemModel.cpp index bff0f5857e..3eaccb90e5 100644 --- a/Libraries/LibGUI/FileSystemModel.cpp +++ b/Libraries/LibGUI/FileSystemModel.cpp @@ -29,6 +29,7 @@ #include <AK/StringBuilder.h> #include <LibCore/DirIterator.h> #include <LibCore/File.h> +#include <LibCore/StandardPaths.h> #include <LibGUI/FileSystemModel.h> #include <LibGUI/Painter.h> #include <LibGfx/Bitmap.h> @@ -205,6 +206,8 @@ FileSystemModel::FileSystemModel(const StringView& root_path, Mode mode) { m_directory_icon = Icon::default_icon("filetype-folder"); m_directory_open_icon = Icon::default_icon("filetype-folder-open"); + m_home_directory_icon = Icon::default_icon("home-directory"); + m_home_directory_open_icon = Icon::default_icon("home-directory-open"); m_file_icon = Icon::default_icon("filetype-unknown"); m_symlink_icon = Icon::default_icon("filetype-symlink"); m_socket_icon = Icon::default_icon("filetype-socket"); @@ -486,6 +489,11 @@ Icon FileSystemModel::icon_for(const Node& node) const } if (node.is_directory()) { + if (node.full_path(*this) == Core::StandardPaths::home_directory()) { + if (node.is_selected()) + return m_home_directory_open_icon; + return m_home_directory_icon; + } if (node.is_selected()) return m_directory_open_icon; } |