mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-12 09:20:36 +00:00
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:
parent
ce166785d7
commit
1ab510c4bb
Notes:
sideshowbarker
2024-07-17 07:23:15 +09:00
Author: https://github.com/electrikmilk Commit: https://github.com/SerenityOS/serenity/commit/1ab510c4bb Pull-request: https://github.com/SerenityOS/serenity/pull/15141
7 changed files with 25 additions and 0 deletions
BIN
Base/res/icons/16x16/git-directory-open.png
Normal file
BIN
Base/res/icons/16x16/git-directory-open.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 329 B |
BIN
Base/res/icons/16x16/git-directory.png
Normal file
BIN
Base/res/icons/16x16/git-directory.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 484 B |
BIN
Base/res/icons/32x32/git-directory-open.png
Normal file
BIN
Base/res/icons/32x32/git-directory-open.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 857 B |
BIN
Base/res/icons/32x32/git-directory.png
Normal file
BIN
Base/res/icons/32x32/git-directory.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
|
@ -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)) {
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue