Revert "theme: Turn ThemeRegistry into a trait (#20076)" (#20094)

This PR reverts #20076 to turn the `ThemeRegistry` back into a regular
struct again.

It doesn't actually help us by having it behind a trait.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-11-01 15:34:20 -04:00 committed by GitHub
parent 4084ba36f9
commit 273173ec8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 89 additions and 151 deletions

View file

@ -407,7 +407,7 @@ fn main() {
app_state.client.clone(),
app_state.node_runtime.clone(),
app_state.languages.clone(),
<dyn ThemeRegistry>::global(cx),
ThemeRegistry::global(cx),
cx,
);
recent_projects::init(cx);
@ -1160,9 +1160,8 @@ fn load_user_themes_in_background(fs: Arc<dyn fs::Fs>, cx: &mut AppContext) {
cx.spawn({
let fs = fs.clone();
|cx| async move {
if let Some(theme_registry) = cx
.update(|cx| <dyn ThemeRegistry>::global(cx).clone())
.log_err()
if let Some(theme_registry) =
cx.update(|cx| ThemeRegistry::global(cx).clone()).log_err()
{
let themes_dir = paths::themes_dir().as_ref();
match fs
@ -1201,9 +1200,8 @@ fn watch_themes(fs: Arc<dyn fs::Fs>, cx: &mut AppContext) {
while let Some(paths) = events.next().await {
for event in paths {
if fs.metadata(&event.path).await.ok().flatten().is_some() {
if let Some(theme_registry) = cx
.update(|cx| <dyn ThemeRegistry>::global(cx).clone())
.log_err()
if let Some(theme_registry) =
cx.update(|cx| ThemeRegistry::global(cx).clone()).log_err()
{
if let Some(()) = theme_registry
.load_user_theme(&event.path, fs.clone())

View file

@ -1139,7 +1139,7 @@ mod tests {
path::{Path, PathBuf},
time::Duration,
};
use theme::{RealThemeRegistry, ThemeRegistry, ThemeSettings};
use theme::{ThemeRegistry, ThemeSettings};
use workspace::{
item::{Item, ItemHandle},
open_new, open_paths, pane, NewFile, OpenVisible, SaveIntent, SplitDirection,
@ -3419,7 +3419,7 @@ mod tests {
.unwrap(),
])
.unwrap();
let themes = RealThemeRegistry::default();
let themes = ThemeRegistry::default();
settings::init(cx);
theme::init(theme::LoadThemes::JustBase, cx);