Start using the SettingsStore in the app

This commit is contained in:
Max Brunsfeld
2023-05-10 12:59:24 -07:00
parent 316f791a77
commit 9a6a2d9d27
17 changed files with 530 additions and 1049 deletions
+13 -2
View File
@@ -20,15 +20,26 @@ pub struct ThemeRegistry {
next_theme_id: AtomicUsize,
}
#[cfg(any(test, feature = "test-support"))]
pub const EMPTY_THEME_NAME: &'static str = "empty-theme";
impl ThemeRegistry {
pub fn new(source: impl AssetSource, font_cache: Arc<FontCache>) -> Arc<Self> {
Arc::new(Self {
let this = Arc::new(Self {
assets: Box::new(source),
themes: Default::default(),
theme_data: Default::default(),
next_theme_id: Default::default(),
font_cache,
})
});
#[cfg(any(test, feature = "test-support"))]
this.themes.lock().insert(
EMPTY_THEME_NAME.to_string(),
gpui::fonts::with_font_cache(this.font_cache.clone(), || Arc::new(Theme::default())),
);
this
}
pub fn list(&self, staff: bool) -> impl Iterator<Item = ThemeMeta> + '_ {