Add setting to disable all AI features (#34896)

https://github.com/user-attachments/assets/674bba41-40ac-4a98-99e4-0b47f9097b6a


Release Notes:

- Added setting to disable all AI features
This commit is contained in:
Richard Feldman 2025-07-22 11:32:39 -04:00 committed by GitHub
parent 939f9fffa3
commit 96f9942791
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 308 additions and 68 deletions

View file

@ -242,6 +242,7 @@ struct PanelEntry {
pub struct PanelButtons {
dock: Entity<Dock>,
_settings_subscription: Subscription,
}
impl Dock {
@ -373,6 +374,12 @@ impl Dock {
})
}
pub fn first_enabled_panel_idx_excluding(&self, exclude_name: &str, cx: &App) -> Option<usize> {
self.panel_entries.iter().position(|entry| {
entry.panel.persistent_name() != exclude_name && entry.panel.enabled(cx)
})
}
fn active_panel_entry(&self) -> Option<&PanelEntry> {
self.active_panel_index
.and_then(|index| self.panel_entries.get(index))
@ -833,7 +840,11 @@ impl Render for Dock {
impl PanelButtons {
pub fn new(dock: Entity<Dock>, cx: &mut Context<Self>) -> Self {
cx.observe(&dock, |_, _, cx| cx.notify()).detach();
Self { dock }
let settings_subscription = cx.observe_global::<SettingsStore>(|_, cx| cx.notify());
Self {
dock,
_settings_subscription: settings_subscription,
}
}
}