Base+LibGUI: Add Git folder icons

This adds icons for folder paths ending in ".git". This adds 16x16 and
32x32 versions of a folder with a Git logo for both the closed and open
versions of the folder icon.
This commit is contained in:
electrikmilk 2022-09-05 19:14:59 -04:00 committed by Sam Atkins
parent ce166785d7
commit 1ab510c4bb
Notes: sideshowbarker 2024-07-17 07:23:15 +09:00
7 changed files with 25 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -31,6 +31,8 @@ static Icon s_inaccessible_directory_icon;
static Icon s_desktop_directory_icon;
static Icon s_home_directory_icon;
static Icon s_home_directory_open_icon;
static Icon s_git_directory_icon;
static Icon s_git_directory_open_icon;
static Icon s_file_icon;
static Icon s_symlink_icon;
static Icon s_socket_icon;
@ -77,6 +79,8 @@ static void initialize_if_needed()
s_inaccessible_directory_icon = Icon::default_icon("filetype-folder-inaccessible"sv);
s_home_directory_icon = Icon::default_icon("home-directory"sv);
s_home_directory_open_icon = Icon::default_icon("home-directory-open"sv);
s_git_directory_icon = Icon::default_icon("git-directory"sv);
s_git_directory_open_icon = Icon::default_icon("git-directory-open"sv);
s_desktop_directory_icon = Icon::default_icon("desktop"sv);
s_file_icon = Icon::default_icon("filetype-unknown"sv);
s_symlink_icon = Icon::default_icon("filetype-symlink"sv);
@ -123,6 +127,18 @@ Icon FileIconProvider::home_directory_open_icon()
return s_home_directory_open_icon;
}
Icon FileIconProvider::git_directory_icon()
{
initialize_if_needed();
return s_git_directory_icon;
}
Icon FileIconProvider::git_directory_open_icon()
{
initialize_if_needed();
return s_git_directory_open_icon;
}
Icon FileIconProvider::filetype_image_icon()
{
initialize_filetype_image_icon_if_needed();
@ -229,6 +245,8 @@ Icon FileIconProvider::icon_for_path(String const& path, mode_t mode)
return s_desktop_directory_icon;
if (access(path.characters(), R_OK | X_OK) < 0)
return s_inaccessible_directory_icon;
if (path.ends_with(".git"sv))
return s_git_directory_icon;
return s_directory_icon;
}
if (S_ISLNK(mode)) {

View file

@ -23,6 +23,8 @@ public:
static Icon directory_open_icon();
static Icon home_directory_icon();
static Icon home_directory_open_icon();
static Icon git_directory_icon();
static Icon git_directory_open_icon();
static Icon desktop_directory_icon();
};

View file

@ -615,6 +615,11 @@ Icon FileSystemModel::icon_for(Node const& node) const
return FileIconProvider::home_directory_open_icon();
return FileIconProvider::home_directory_icon();
}
if (node.full_path().ends_with(".git"sv)) {
if (node.is_selected())
return FileIconProvider::git_directory_open_icon();
return FileIconProvider::git_directory_icon();
}
if (node.full_path() == Core::StandardPaths::desktop_directory())
return FileIconProvider::desktop_directory_icon();
if (node.is_selected() && node.is_accessible_directory)