diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/preferences_window.rs | 5 | ||||
-rw-r--r-- | src/ui/window.rs | 19 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/ui/preferences_window.rs b/src/ui/preferences_window.rs index 756e3ad..1b827fe 100644 --- a/src/ui/preferences_window.rs +++ b/src/ui/preferences_window.rs @@ -229,6 +229,11 @@ impl FurPreferencesWindow { window.reset_history_box(); }); + imp.autocomplete_switch.connect_active_notify(move |switch| { + let window = FurtheranceWindow::default(); + window.reset_autocomplete(); + }); + imp.pomodoro_expander .connect_enable_expansion_notify(move |_| { let window = FurtheranceWindow::default(); diff --git a/src/ui/window.rs b/src/ui/window.rs index 6160bdc..8591038 100644 --- a/src/ui/window.rs +++ b/src/ui/window.rs @@ -163,6 +163,15 @@ impl FurtheranceWindow { imp.history_box.create_tasks_page(); } + pub fn reset_autocomplete(&self) { + let imp = imp::FurtheranceWindow::from_obj(self); + if settings_manager::get_bool("autocomplete") { + imp.task_input.set_completion(Some(&FurtheranceWindow::create_autocomplete())); + } else { + imp.task_input.set_completion(None); + } + } + fn setup_widgets(&self) { let imp = imp::FurtheranceWindow::from_obj(self); @@ -214,10 +223,12 @@ impl FurtheranceWindow { imp2.start_button.set_sensitive(true); } - if task_input.text().len() >= FurtheranceWindow::MIN_PREFIX_LENGTH.try_into().unwrap() { - let task_autocomplete = task_input.completion().unwrap(); - let model = Self::update_list_model(task_name.to_string(), split_tags).unwrap(); - task_autocomplete.set_model(Some(&model)); + if settings_manager::get_bool("autocomplete") { + if task_input.text().len() >= FurtheranceWindow::MIN_PREFIX_LENGTH.try_into().unwrap() { + let task_autocomplete = task_input.completion().unwrap(); + let model = Self::update_list_model(task_name.to_string(), split_tags).unwrap(); + task_autocomplete.set_model(Some(&model)); + } } })); |