summary refs log tree commit diff
path: root/src/components/preferences.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/preferences.rs')
-rw-r--r--src/components/preferences.rs21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/components/preferences.rs b/src/components/preferences.rs
index 09fbdf7..f1f37f9 100644
--- a/src/components/preferences.rs
+++ b/src/components/preferences.rs
@@ -13,7 +13,8 @@ struct LanguageModelPreferencesWidgets {
 
     general_group: adw::PreferencesGroup,
     llm_endpoint: adw::EntryRow,
-
+    smart_summary_show_warning: adw::SwitchRow,
+    
     smart_summary_group: adw::PreferencesGroup,
     smart_summary_model: adw::EntryRow,
     smart_summary_system_prompt: adw::EntryRow,
@@ -36,7 +37,9 @@ impl LanguageModelPreferencesWidgets {
             .title(gettext("General"))
             .build();
         let llm_endpoint = adw::EntryRow::new();
+        let smart_summary_show_warning = adw::SwitchRow::new();
         general_group.add(&llm_endpoint);
+        general_group.add(&smart_summary_show_warning);
         page.add(&general_group);
 
         let smart_summary_group = adw::PreferencesGroup::builder()
@@ -57,6 +60,7 @@ impl LanguageModelPreferencesWidgets {
 
             general_group,
             llm_endpoint,
+            smart_summary_show_warning,
 
             smart_summary_group,
             smart_summary_model,
@@ -67,14 +71,15 @@ impl LanguageModelPreferencesWidgets {
 
         let schema = settings.settings_schema().unwrap();
 
-        for (row, key) in [
-            (&widgets.llm_endpoint, "llm-endpoint"),
-            (&widgets.smart_summary_model, "smart-summary-model"),
-            (&widgets.smart_summary_system_prompt, "smart-summary-system-prompt"),
-            (&widgets.smart_summary_prompt_prefix, "smart-summary-prompt-prefix"),
-            (&widgets.smart_summary_prompt_suffix, "smart-summary-prompt-suffix"),
+        for (row, key, property) in [
+            (widgets.llm_endpoint.upcast_ref::<adw::PreferencesRow>(), "llm-endpoint", "text"),
+            (widgets.smart_summary_show_warning.upcast_ref::<_>(), "smart-summary-show-warning", "active"),
+            (widgets.smart_summary_model.upcast_ref::<_>(), "smart-summary-model", "text"),
+            (widgets.smart_summary_system_prompt.upcast_ref::<_>(), "smart-summary-system-prompt", "text"),
+            (widgets.smart_summary_prompt_prefix.upcast_ref::<_>(), "smart-summary-prompt-prefix", "text"),
+            (widgets.smart_summary_prompt_suffix.upcast_ref::<_>(), "smart-summary-prompt-suffix", "text"),
         ] {
-            settings.bind(key, row, "text")
+            settings.bind(key, row, property)
                 .get()
                 .set()
                 .build();