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 | |
parent | 3a62029deed211095bdd2c4a830870c84bd73693 (diff) | |
download | serenity-dc696ba85c2bf359da389db521fd136c2e4e7ee2.zip |
LibGUI: Show a special icon for the home directory in FileSystemModel
-rw-r--r-- | Libraries/LibGUI/FileSystemModel.cpp | 8 | ||||
-rw-r--r-- | Libraries/LibGUI/FileSystemModel.h | 2 |
2 files changed, 10 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; } diff --git a/Libraries/LibGUI/FileSystemModel.h b/Libraries/LibGUI/FileSystemModel.h index 2dd020de29..3c4a81c4d4 100644 --- a/Libraries/LibGUI/FileSystemModel.h +++ b/Libraries/LibGUI/FileSystemModel.h @@ -183,6 +183,8 @@ private: GUI::Icon m_directory_icon; GUI::Icon m_directory_open_icon; + GUI::Icon m_home_directory_icon; + GUI::Icon m_home_directory_open_icon; GUI::Icon m_file_icon; GUI::Icon m_symlink_icon; GUI::Icon m_socket_icon; |