title_bar: Remove dependency on theme_selector
(#21009)
This PR removes the `title_bar` crate's dependency on the `theme_selector`. The `theme_selector::Toggle` action now resides at `zed_actions::theme_selector::Toggle`. Release Notes: - N/A
This commit is contained in:
parent
f62ccf9c8a
commit
6b2f1cc543
8 changed files with 31 additions and 16 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -12410,6 +12410,7 @@ dependencies = [
|
||||||
"ui",
|
"ui",
|
||||||
"util",
|
"util",
|
||||||
"workspace",
|
"workspace",
|
||||||
|
"zed_actions",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -12637,7 +12638,6 @@ dependencies = [
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"story",
|
"story",
|
||||||
"theme",
|
"theme",
|
||||||
"theme_selector",
|
|
||||||
"tree-sitter-md",
|
"tree-sitter-md",
|
||||||
"ui",
|
"ui",
|
||||||
"util",
|
"util",
|
||||||
|
|
|
@ -257,7 +257,7 @@ impl ExtensionsPage {
|
||||||
.update(cx, |workspace, cx| {
|
.update(cx, |workspace, cx| {
|
||||||
theme_selector::toggle(
|
theme_selector::toggle(
|
||||||
workspace,
|
workspace,
|
||||||
&theme_selector::Toggle {
|
&zed_actions::theme_selector::Toggle {
|
||||||
themes_filter: Some(themes),
|
themes_filter: Some(themes),
|
||||||
},
|
},
|
||||||
cx,
|
cx,
|
||||||
|
|
|
@ -25,5 +25,6 @@ theme.workspace = true
|
||||||
ui.workspace = true
|
ui.workspace = true
|
||||||
util.workspace = true
|
util.workspace = true
|
||||||
workspace.workspace = true
|
workspace.workspace = true
|
||||||
|
zed_actions.workspace = true
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
@ -2,25 +2,18 @@ use client::telemetry::Telemetry;
|
||||||
use fs::Fs;
|
use fs::Fs;
|
||||||
use fuzzy::{match_strings, StringMatch, StringMatchCandidate};
|
use fuzzy::{match_strings, StringMatch, StringMatchCandidate};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions, impl_actions, AppContext, DismissEvent, EventEmitter, FocusableView, Render,
|
actions, AppContext, DismissEvent, EventEmitter, FocusableView, Render, UpdateGlobal, View,
|
||||||
UpdateGlobal, View, ViewContext, VisualContext, WeakView,
|
ViewContext, VisualContext, WeakView,
|
||||||
};
|
};
|
||||||
use picker::{Picker, PickerDelegate};
|
use picker::{Picker, PickerDelegate};
|
||||||
use serde::Deserialize;
|
|
||||||
use settings::{update_settings_file, SettingsStore};
|
use settings::{update_settings_file, SettingsStore};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use theme::{Appearance, Theme, ThemeMeta, ThemeRegistry, ThemeSettings};
|
use theme::{Appearance, Theme, ThemeMeta, ThemeRegistry, ThemeSettings};
|
||||||
use ui::{prelude::*, v_flex, ListItem, ListItemSpacing};
|
use ui::{prelude::*, v_flex, ListItem, ListItemSpacing};
|
||||||
use util::ResultExt;
|
use util::ResultExt;
|
||||||
use workspace::{ui::HighlightedLabel, ModalView, Workspace};
|
use workspace::{ui::HighlightedLabel, ModalView, Workspace};
|
||||||
|
use zed_actions::theme_selector::Toggle;
|
||||||
|
|
||||||
#[derive(PartialEq, Clone, Default, Debug, Deserialize)]
|
|
||||||
pub struct Toggle {
|
|
||||||
/// A list of theme names to filter the theme selector down to.
|
|
||||||
pub themes_filter: Option<Vec<String>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl_actions!(theme_selector, [Toggle]);
|
|
||||||
actions!(theme_selector, [Reload]);
|
actions!(theme_selector, [Reload]);
|
||||||
|
|
||||||
pub fn init(cx: &mut AppContext) {
|
pub fn init(cx: &mut AppContext) {
|
||||||
|
|
|
@ -42,7 +42,6 @@ serde.workspace = true
|
||||||
smallvec.workspace = true
|
smallvec.workspace = true
|
||||||
story = { workspace = true, optional = true }
|
story = { workspace = true, optional = true }
|
||||||
theme.workspace = true
|
theme.workspace = true
|
||||||
theme_selector.workspace = true
|
|
||||||
ui.workspace = true
|
ui.workspace = true
|
||||||
util.workspace = true
|
util.workspace = true
|
||||||
vcs_menu.workspace = true
|
vcs_menu.workspace = true
|
||||||
|
|
|
@ -579,7 +579,10 @@ impl TitleBar {
|
||||||
})
|
})
|
||||||
.action("Settings", zed_actions::OpenSettings.boxed_clone())
|
.action("Settings", zed_actions::OpenSettings.boxed_clone())
|
||||||
.action("Key Bindings", Box::new(zed_actions::OpenKeymap))
|
.action("Key Bindings", Box::new(zed_actions::OpenKeymap))
|
||||||
.action("Themes…", theme_selector::Toggle::default().boxed_clone())
|
.action(
|
||||||
|
"Themes…",
|
||||||
|
zed_actions::theme_selector::Toggle::default().boxed_clone(),
|
||||||
|
)
|
||||||
.action("Extensions", zed_actions::Extensions.boxed_clone())
|
.action("Extensions", zed_actions::Extensions.boxed_clone())
|
||||||
.separator()
|
.separator()
|
||||||
.link(
|
.link(
|
||||||
|
@ -615,7 +618,10 @@ impl TitleBar {
|
||||||
ContextMenu::build(cx, |menu, _| {
|
ContextMenu::build(cx, |menu, _| {
|
||||||
menu.action("Settings", zed_actions::OpenSettings.boxed_clone())
|
menu.action("Settings", zed_actions::OpenSettings.boxed_clone())
|
||||||
.action("Key Bindings", Box::new(zed_actions::OpenKeymap))
|
.action("Key Bindings", Box::new(zed_actions::OpenKeymap))
|
||||||
.action("Themes…", theme_selector::Toggle::default().boxed_clone())
|
.action(
|
||||||
|
"Themes…",
|
||||||
|
zed_actions::theme_selector::Toggle::default().boxed_clone(),
|
||||||
|
)
|
||||||
.action("Extensions", zed_actions::Extensions.boxed_clone())
|
.action("Extensions", zed_actions::Extensions.boxed_clone())
|
||||||
.separator()
|
.separator()
|
||||||
.link(
|
.link(
|
||||||
|
|
|
@ -23,7 +23,10 @@ pub fn app_menus() -> Vec<Menu> {
|
||||||
zed_actions::OpenDefaultKeymap,
|
zed_actions::OpenDefaultKeymap,
|
||||||
),
|
),
|
||||||
MenuItem::action("Open Project Settings", super::OpenProjectSettings),
|
MenuItem::action("Open Project Settings", super::OpenProjectSettings),
|
||||||
MenuItem::action("Select Theme...", theme_selector::Toggle::default()),
|
MenuItem::action(
|
||||||
|
"Select Theme...",
|
||||||
|
zed_actions::theme_selector::Toggle::default(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
MenuItem::separator(),
|
MenuItem::separator(),
|
||||||
|
|
|
@ -50,6 +50,19 @@ pub mod command_palette {
|
||||||
actions!(command_palette, [Toggle]);
|
actions!(command_palette, [Toggle]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub mod theme_selector {
|
||||||
|
use gpui::impl_actions;
|
||||||
|
use serde::Deserialize;
|
||||||
|
|
||||||
|
#[derive(PartialEq, Clone, Default, Debug, Deserialize)]
|
||||||
|
pub struct Toggle {
|
||||||
|
/// A list of theme names to filter the theme selector down to.
|
||||||
|
pub themes_filter: Option<Vec<String>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl_actions!(theme_selector, [Toggle]);
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Default, Deserialize, PartialEq)]
|
#[derive(Clone, Default, Deserialize, PartialEq)]
|
||||||
pub struct InlineAssist {
|
pub struct InlineAssist {
|
||||||
pub prompt: Option<String>,
|
pub prompt: Option<String>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue