settings_ui: Add theme settings controls (#15115)

This PR adds settings controls for the theme settings.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-07-24 16:25:52 -04:00 committed by GitHub
parent 325e6b9fef
commit 740c444089
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 392 additions and 156 deletions

View file

@ -20,14 +20,18 @@ pub trait EditableSettingControl: RenderOnce {
/// Applies the given setting file to the settings file contents.
///
/// This will be called when writing the setting value back to the settings file.
fn apply(settings: &mut <Self::Settings as Settings>::FileContent, value: Self::Value);
fn apply(
settings: &mut <Self::Settings as Settings>::FileContent,
value: Self::Value,
cx: &AppContext,
);
/// Writes the given setting value to the settings files.
fn write(value: Self::Value, cx: &AppContext) {
let fs = <dyn Fs>::global(cx);
update_settings_file::<Self::Settings>(fs, cx, move |settings, _cx| {
Self::apply(settings, value);
update_settings_file::<Self::Settings>(fs, cx, move |settings, cx| {
Self::apply(settings, value, cx);
});
}
}