about summary refs log tree commit diff
path: root/src/ui
diff options
context:
space:
mode:
authorRicky Kresslein <rk@lakoliu.com>2022-04-06 20:54:49 +0200
committerRicky Kresslein <rk@lakoliu.com>2022-04-06 20:54:49 +0200
commitb816f3c91691d7dc521927cd4109861ca6d7dde8 (patch)
tree24d310b9457a5292a4b8bb9115b6a5d97ac94c06 /src/ui
parent348146370674616aeda897b127abf7e2614509b8 (diff)
downloadFurtherance-b816f3c91691d7dc521927cd4109861ca6d7dde8.tar.zst
Show error toast if user tries to duplicate task while timer is running
Diffstat (limited to 'src/ui')
-rwxr-xr-xsrc/ui/window.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ui/window.rs b/src/ui/window.rs
index acf77c9..baca851 100755
--- a/src/ui/window.rs
+++ b/src/ui/window.rs
@@ -20,7 +20,7 @@ use gtk::subclass::prelude::*;
 use gtk::{gio, glib, CompositeTemplate};
 use glib::{clone, timeout_add_local};
 use std::time::Duration;
-use std::sync::{Arc, Mutex};
+use std::sync::Mutex;
 use std::rc::Rc;
 use std::cell::RefCell;
 use chrono::{DateTime, Local, Duration as ChronDur};
@@ -102,7 +102,7 @@ impl FurtheranceWindow {
             .expect("Failed to create FurtheranceWindow")
     }
 
-    pub fn inapp_notification(&self, text: &str) {
+    pub fn display_toast(&self, text: &str) {
         // Display in-app notifications
         let imp = imp::FurtheranceWindow::from_instance(self);
         let toast = adw::Toast::new(text);
@@ -336,6 +336,8 @@ impl FurtheranceWindow {
         if !*imp.running.lock().unwrap() {
             imp.task_input.set_text(&task_name_text);
             imp.start_button.emit_clicked();
+        } else {
+            self.display_toast("Stop the timer to duplicate a task.");
         }
     }
 }