summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelectrikmilk <brandonjordan124@gmail.com>2022-09-05 19:14:59 -0400
committerSam Atkins <atkinssj@gmail.com>2022-09-06 07:38:09 +0100
commit1ab510c4bbf66d4ca9d5ec3f3ad285249c4bc3ea (patch)
tree8cbfc1df081205b88a48fbbe2ba42fe740a1332a
parentce166785d7670f0e03e15508f42e74e314358b48 (diff)
downloadserenity-1ab510c4bbf66d4ca9d5ec3f3ad285249c4bc3ea.zip
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.
-rw-r--r--Base/res/icons/16x16/git-directory-open.pngbin0 -> 329 bytes
-rw-r--r--Base/res/icons/16x16/git-directory.pngbin0 -> 484 bytes
-rw-r--r--Base/res/icons/32x32/git-directory-open.pngbin0 -> 857 bytes
-rw-r--r--Base/res/icons/32x32/git-directory.pngbin0 -> 1291 bytes
-rw-r--r--Userland/Libraries/LibGUI/FileIconProvider.cpp18
-rw-r--r--Userland/Libraries/LibGUI/FileIconProvider.h2
-rw-r--r--Userland/Libraries/LibGUI/FileSystemModel.cpp5
7 files changed, 25 insertions, 0 deletions
diff --git a/Base/res/icons/16x16/git-directory-open.png b/Base/res/icons/16x16/git-directory-open.png
new file mode 100644
index 0000000000..af9a76b0c9
--- /dev/null
+++ b/Base/res/icons/16x16/git-directory-open.png
Binary files differ
diff --git a/Base/res/icons/16x16/git-directory.png b/Base/res/icons/16x16/git-directory.png
new file mode 100644
index 0000000000..249fdef1a7
--- /dev/null
+++ b/Base/res/icons/16x16/git-directory.png
Binary files differ
diff --git a/Base/res/icons/32x32/git-directory-open.png b/Base/res/icons/32x32/git-directory-open.png
new file mode 100644
index 0000000000..8f33264901
--- /dev/null
+++ b/Base/res/icons/32x32/git-directory-open.png
Binary files differ
diff --git a/Base/res/icons/32x32/git-directory.png b/Base/res/icons/32x32/git-directory.png
new file mode 100644
index 0000000000..9e4f3e6be6
--- /dev/null
+++ b/Base/res/icons/32x32/git-directory.png
Binary files differ
diff --git a/Userland/Libraries/LibGUI/FileIconProvider.cpp b/Userland/Libraries/LibGUI/FileIconProvider.cpp
index 7684d52fe2..dc3970d649 100644
--- a/Userland/Libraries/LibGUI/FileIconProvider.cpp
+++ b/Userland/Libraries/LibGUI/FileIconProvider.cpp
@@ -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)) {
diff --git a/Userland/Libraries/LibGUI/FileIconProvider.h b/Userland/Libraries/LibGUI/FileIconProvider.h
index 89aa8a3709..d799dcd023 100644
--- a/Userland/Libraries/LibGUI/FileIconProvider.h
+++ b/Userland/Libraries/LibGUI/FileIconProvider.h
@@ -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();
};
diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp
index 35e8432712..bce06b87db 100644
--- a/Userland/Libraries/LibGUI/FileSystemModel.cpp
+++ b/Userland/Libraries/LibGUI/FileSystemModel.cpp
@@ -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)