theme: Implement icon theme reloading (#24449)

Closes #24353 

This PR implements icon theme reload to ensure file icons are properly
updated whenever an icon theme extension is upgraded or uninstalled.

Currently, on both upgrade and uninstall of an icon theme extension the
file icons from the previously installed version will stay visibile and
will not be updated as shown in the linked issue. With this change, file
icons will properly be updated on extension upgrade or reinstall.

The code is primarily a copy for reloading the current color theme
adapted to work for icon themes. Happy for any feedback!


Release Notes:

- Fixed file icons not being properly updated upon icon theme upgrade or
uninstall.
This commit is contained in:
Finn Evers 2025-02-07 17:30:53 +01:00 committed by GitHub
parent 2d57e43e34
commit 144487bf1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 57 additions and 0 deletions

View file

@ -118,6 +118,8 @@ pub trait ExtensionThemeProxy: Send + Sync + 'static {
icons_root_dir: PathBuf,
fs: Arc<dyn Fs>,
) -> Task<Result<()>>;
fn reload_current_icon_theme(&self, cx: &mut App);
}
impl ExtensionThemeProxy for ExtensionHostProxy {
@ -185,6 +187,14 @@ impl ExtensionThemeProxy for ExtensionHostProxy {
proxy.load_icon_theme(icon_theme_path, icons_root_dir, fs)
}
fn reload_current_icon_theme(&self, cx: &mut App) {
let Some(proxy) = self.theme_proxy.read().clone() else {
return;
};
proxy.reload_current_icon_theme(cx)
}
}
pub trait ExtensionGrammarProxy: Send + Sync + 'static {