call_settings.rs

 1use anyhow::Result;
 2use gpui::App;
 3use schemars::JsonSchema;
 4use serde::{Deserialize, Serialize};
 5use settings::{Settings, SettingsKey, SettingsSources, SettingsUi};
 6use util::MergeFrom;
 7
 8#[derive(Deserialize, Debug)]
 9pub struct CallSettings {
10    pub mute_on_join: bool,
11    pub share_on_join: bool,
12}
13
14impl Settings for CallSettings {
15    fn from_defaults(content: &settings::SettingsContent, cx: &mut App) -> Self {
16        let call = content.call.unwrap();
17        CallSettings {
18            mute_on_join: call.mute_on_join.unwrap(),
19            share_on_join: call.share_on_join.unwrap(),
20        }
21    }
22
23    fn refine(&mut self, content: &settings::SettingsContent, cx: &mut App) {
24        if let Some(call) = content.call.clone() {
25            self.mute_on_join.merge_from(call.mute_on_join);
26            self.share_on_join.merge_from(call.share_on_join);
27        }
28    }
29
30    fn import_from_vscode(
31        _vscode: &settings::VsCodeSettings,
32        _current: &settings::SettingsContent,
33    ) {
34    }
35}