title_bar_settings.rs

 1use db::anyhow;
 2use schemars::JsonSchema;
 3use serde::{Deserialize, Serialize};
 4use settings::{Settings, SettingsSources};
 5
 6#[derive(Copy, Clone, Serialize, Deserialize, JsonSchema, Debug)]
 7#[serde(default)]
 8pub struct TitleBarSettings {
 9    /// Whether to show the branch icon beside branch switcher in the title bar.
10    ///
11    /// Default: false
12    pub show_branch_icon: bool,
13    /// Whether to show onboarding banners in the title bar.
14    ///
15    /// Default: true
16    pub show_onboarding_banner: bool,
17    /// Whether to show user avatar in the title bar.
18    ///
19    /// Default: true
20    pub show_user_picture: bool,
21    /// Whether to show the branch name button in the titlebar.
22    ///
23    /// Default: true
24    pub show_branch_name: bool,
25    /// Whether to show the project host and name in the titlebar.
26    ///
27    /// Default: true
28    pub show_project_items: bool,
29    /// Whether to show the sign in button in the title bar.
30    ///
31    /// Default: true
32    pub show_sign_in: bool,
33}
34
35impl Default for TitleBarSettings {
36    fn default() -> Self {
37        Self {
38            show_branch_icon: false,
39            show_onboarding_banner: true,
40            show_user_picture: true,
41            show_branch_name: true,
42            show_project_items: true,
43            show_sign_in: true,
44        }
45    }
46}
47
48impl Settings for TitleBarSettings {
49    const KEY: Option<&'static str> = Some("title_bar");
50
51    type FileContent = Self;
52
53    fn load(sources: SettingsSources<Self::FileContent>, _: &mut gpui::App) -> anyhow::Result<Self>
54    where
55        Self: Sized,
56    {
57        sources.json_merge()
58    }
59
60    fn import_from_vscode(_: &settings::VsCodeSettings, _: &mut Self::FileContent) {}
61}