title_bar_settings.rs

 1use db::anyhow;
 2use schemars::JsonSchema;
 3use serde::{Deserialize, Serialize};
 4use settings::{Settings, SettingsSources};
 5
 6#[derive(Deserialize, Debug, Clone, Copy, PartialEq)]
 7pub struct TitleBarSettings {
 8    pub show_branch_icon: bool,
 9}
10
11#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
12pub struct TitleBarSettingsContent {
13    /// Whether to show the branch icon beside branch switcher in the title bar.
14    ///
15    /// Default: false
16    pub show_branch_icon: Option<bool>,
17}
18
19impl Settings for TitleBarSettings {
20    const KEY: Option<&'static str> = Some("title_bar");
21
22    type FileContent = TitleBarSettingsContent;
23
24    fn load(sources: SettingsSources<Self::FileContent>, _: &mut gpui::App) -> anyhow::Result<Self>
25    where
26        Self: Sized,
27    {
28        sources.json_merge()
29    }
30
31    fn import_from_vscode(_: &settings::VsCodeSettings, _: &mut Self::FileContent) {}
32}