Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T04:02:03.184Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

editable_setting_control.rs

31 lines · 971 B · rust
1use fs::Fs;
2use gpui::{App, RenderOnce, SharedString};
3
4use crate::{settings_content::SettingsContent, update_settings_file};
5
6/// A UI control that can be used to edit a setting.
7pub trait EditableSettingControl: RenderOnce {
8    /// The type of the setting value.
9    type Value: Send;
10
11    /// Returns the name of this setting.
12    fn name(&self) -> SharedString;
13
14    /// Reads the setting value from the settings.
15    fn read(cx: &App) -> Self::Value;
16
17    /// Applies the given setting file to the settings file contents.
18    ///
19    /// This will be called when writing the setting value back to the settings file.
20    fn apply(settings: &mut SettingsContent, value: Self::Value, cx: &App);
21
22    /// Writes the given setting value to the settings files.
23    fn write(value: Self::Value, cx: &App) {
24        let fs = <dyn Fs>::global(cx);
25
26        update_settings_file(fs, cx, move |settings, cx| {
27            Self::apply(settings, value, cx);
28        });
29    }
30}
31
Served at tenant.openagents/omega Member data and write actions are omitted.