aboutsummaryrefslogtreecommitdiff
path: root/src/app/impl_self.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/impl_self.rs')
-rw-r--r--src/app/impl_self.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/app/impl_self.rs b/src/app/impl_self.rs
index c2a24cf..744f906 100644
--- a/src/app/impl_self.rs
+++ b/src/app/impl_self.rs
@@ -5,7 +5,6 @@ use std::io::prelude::*;
5use std::path::PathBuf; 5use std::path::PathBuf;
6use std::sync::mpsc::channel; 6use std::sync::mpsc::channel;
7use std::time::Duration; 7use std::time::Duration;
8use std::sync::{RwLock, Arc};
9 8
10use chrono::Local; 9use chrono::Local;
11use cursive::direction::Absolute; 10use cursive::direction::Absolute;
@@ -30,7 +29,7 @@ impl App {
30 _file_watcher: watcher, 29 _file_watcher: watcher,
31 file_event_recv: rx, 30 file_event_recv: rx,
32 view_month_offset: 0, 31 view_month_offset: 0,
33 message: Arc::new(RwLock::new("Type :add <habit-name> <goal> to get started, Ctrl-L to dismiss".into())), 32 message: "Type :add <habit-name> <goal> to get started, Ctrl-L to dismiss".into(),
34 }; 33 };
35 } 34 }
36 35
@@ -42,7 +41,7 @@ impl App {
42 let old_len = self.habits.len(); 41 let old_len = self.habits.len();
43 self.habits.retain(|h| h.name() != name); 42 self.habits.retain(|h| h.name() != name);
44 if old_len == self.habits.len() { 43 if old_len == self.habits.len() {
45 self.message.write().unwrap() 44 self.message
46 .set_message(format!("Could not delete habit `{}`", name)) 45 .set_message(format!("Could not delete habit `{}`", name))
47 } 46 }
48 } 47 }
@@ -115,7 +114,7 @@ impl App {
115 } 114 }
116 115
117 pub fn clear_message(&mut self) { 116 pub fn clear_message(&mut self) {
118 self.message.write().unwrap().clear(); 117 self.message.clear();
119 } 118 }
120 119
121 pub fn status(&self) -> StatusLine { 120 pub fn status(&self) -> StatusLine {
@@ -237,8 +236,8 @@ impl App {
237 Command::Blank => {} 236 Command::Blank => {}
238 }, 237 },
239 Err(e) => { 238 Err(e) => {
240 self.message.write().unwrap().set_message(e.to_string()); 239 self.message.set_message(e.to_string());
241 self.message.write().unwrap().set_kind(MessageKind::Error); 240 self.message.set_kind(MessageKind::Error);
242 } 241 }
243 } 242 }
244 } 243 }