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    pub show_onboarding_banner: bool,
10    pub show_user_picture: bool,
11}
12
13#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
14pub struct TitleBarSettingsContent {
15    /// Whether to show the branch icon beside branch switcher in the title bar.
16    ///
17    /// Default: false
18    pub show_branch_icon: Option<bool>,
19    /// Whether to show onboarding banners in the title bar.
20    ///
21    /// Default: true
22    pub show_onboarding_banner: Option<bool>,
23    /// Whether to show user avatar in the title bar.
24    ///
25    /// Default: true
26    pub show_user_picture: Option<bool>,
27}
28
29impl Settings for TitleBarSettings {
30    const KEY: Option<&'static str> = Some("title_bar");
31
32    type FileContent = TitleBarSettingsContent;
33
34    fn load(sources: SettingsSources<Self::FileContent>, _: &mut gpui::App) -> anyhow::Result<Self>
35    where
36        Self: Sized,
37    {
38        sources.json_merge()
39    }
40
41    fn import_from_vscode(_: &settings::VsCodeSettings, _: &mut Self::FileContent) {}
42}