Eagerly load the active theme and icon theme (#25368)
This PR adds eager loading of the active theme and icon theme set in the user settings. Previously for themes and icon themes that were provided by extensions, we would have to wait until extensions were loaded before we could apply the themes. In some cases this could lead to a visible delay during which time the user would see the default themes, and then switch to their desired themes once extensions had loaded. To avoid this, we now take a fast path of loading the active themes directly from the filesystem so that we can load them as soon as possible. Closes #10173 and #25305. Release Notes: - Added eager loading of the active theme and icon theme. This should address some reports of seeing the default themes briefly on startup.
This commit is contained in:
parent
aba89ba12a
commit
ec56755f9e
2 changed files with 98 additions and 2 deletions
|
@ -442,6 +442,18 @@ impl ExtensionStore {
|
|||
.filter_map(|(name, theme)| theme.extension.as_ref().eq(extension_id).then_some(name))
|
||||
}
|
||||
|
||||
/// Returns the path to the theme file within an extension, if there is an
|
||||
/// extension that provides the theme.
|
||||
pub fn path_to_extension_theme(&self, theme_name: &str) -> Option<PathBuf> {
|
||||
let entry = self.extension_index.themes.get(theme_name)?;
|
||||
|
||||
Some(
|
||||
self.extensions_dir()
|
||||
.join(entry.extension.as_ref())
|
||||
.join(&entry.path),
|
||||
)
|
||||
}
|
||||
|
||||
/// Returns the names of icon themes provided by extensions.
|
||||
pub fn extension_icon_themes<'a>(
|
||||
&'a self,
|
||||
|
@ -459,6 +471,23 @@ impl ExtensionStore {
|
|||
})
|
||||
}
|
||||
|
||||
/// Returns the path to the icon theme file within an extension, if there is
|
||||
/// an extension that provides the icon theme.
|
||||
pub fn path_to_extension_icon_theme(
|
||||
&self,
|
||||
icon_theme_name: &str,
|
||||
) -> Option<(PathBuf, PathBuf)> {
|
||||
let entry = self.extension_index.icon_themes.get(icon_theme_name)?;
|
||||
|
||||
let icon_theme_path = self
|
||||
.extensions_dir()
|
||||
.join(entry.extension.as_ref())
|
||||
.join(&entry.path);
|
||||
let icons_root_path = self.extensions_dir().join(entry.extension.as_ref());
|
||||
|
||||
Some((icon_theme_path, icons_root_path))
|
||||
}
|
||||
|
||||
pub fn fetch_extensions(
|
||||
&self,
|
||||
search: Option<&str>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue