about summary refs log tree commit diff
path: root/src/ui/window.rs
diff options
context:
space:
mode:
authorRicky Kresslein <ricky@kressle.in>2022-02-20 12:59:46 +0100
committerRicky Kresslein <ricky@kressle.in>2022-02-20 12:59:46 +0100
commit379561117862952d567bfdbf0700b5c7f470a1a8 (patch)
treee8ff9e5081109c87426eb35c5ade0407e4908419 /src/ui/window.rs
parent1f46e93625cff30eaf63258fcabe4ddc0c243136 (diff)
downloadFurtherance-379561117862952d567bfdbf0700b5c7f470a1a8.tar.zst
- Added Preferences
- Added idle notify to preferences
- Bug fix: if user deleted first task none would show
Diffstat (limited to 'src/ui/window.rs')
-rw-r--r--src/ui/window.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ui/window.rs b/src/ui/window.rs
index 965f0f3..3106306 100644
--- a/src/ui/window.rs
+++ b/src/ui/window.rs
@@ -30,6 +30,7 @@ use once_cell::unsync::OnceCell;
 use crate::ui::FurHistoryBox;
 use crate::FurtheranceApplication;
 use crate::database;
+use crate::settings_manager;
 
 mod imp {
     use super::*;
@@ -111,7 +112,9 @@ impl FurtheranceWindow {
         // Update watch time while timer is running
         let imp = imp::FurtheranceWindow::from_instance(self);
         imp.watch.set_text(text);
-        self.check_user_idle();
+        if settings_manager::get_bool("notify-of-idle") {
+            self.check_user_idle();
+        }
     }
 
     fn activate_task_input(&self, sensitive: bool) {
@@ -213,7 +216,9 @@ impl FurtheranceWindow {
 
     fn setup_settings(&self) {
         let imp = imp::FurtheranceWindow::from_instance(self);
-        imp.notify_of_idle.set(300).expect("Failed to set notify_of_idle");
+        // Get user setting idle-time in minutes and convert it to seconds
+        imp.notify_of_idle.set((settings_manager::get_int("idle-time") * 60) as u64)
+            .expect("Failed to set notify_of_idle");
         self.reset_vars();
 
         // Enter starts timer