file_icons: Fall back to the default icon theme for icons (#23196)

This PR updates the various `FileIcons` methods to fall back to the
default icon theme if the active icon theme does not have the desired
icon.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-01-15 17:06:20 -05:00 committed by GitHub
parent 904b367882
commit a8526d9143
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 45 additions and 21 deletions

View file

@ -12,7 +12,7 @@ use util::ResultExt;
use crate::{
read_user_theme, refine_theme_family, Appearance, IconTheme, Theme, ThemeFamily,
ThemeFamilyContent,
ThemeFamilyContent, DEFAULT_ICON_THEME_ID,
};
/// The metadata for a theme.
@ -206,6 +206,11 @@ impl ThemeRegistry {
Ok(())
}
/// Returns the default icon theme.
pub fn default_icon_theme(&self) -> Result<Arc<IconTheme>> {
self.get_icon_theme(DEFAULT_ICON_THEME_ID)
}
/// Returns the icon theme with the specified name.
pub fn get_icon_theme(&self, name: &str) -> Result<Arc<IconTheme>> {
self.state