aboutsummaryrefslogtreecommitdiff
path: root/src/views.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-02-06 13:30:40 +0000
committerAkshay <[email protected]>2021-02-21 05:13:14 +0000
commit53f7a679a0cf7a510de13d67cf370988f71c0d08 (patch)
treeb43b30df476d76d0a18feb7c6e7e00fd3ac4dae4 /src/views.rs
parent9cdef4e296c77fb94d99553de05ba1aaa6c81ed8 (diff)
deprecate view_month_offset in favor of cursor
Diffstat (limited to 'src/views.rs')
-rw-r--r--src/views.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/views.rs b/src/views.rs
index a306602..b90ce2b 100644
--- a/src/views.rs
+++ b/src/views.rs
@@ -1,6 +1,6 @@
1use cursive::direction::Direction; 1use cursive::direction::Direction;
2use cursive::event::{Event, EventResult, Key}; 2use cursive::event::{Event, EventResult, Key};
3use cursive::theme::{ColorStyle, ColorType, Effect, Style}; 3use cursive::theme::{ColorStyle, Effect, Style};
4use cursive::view::View; 4use cursive::view::View;
5use cursive::{Printer, Vec2}; 5use cursive::{Printer, Vec2};
6 6
@@ -35,13 +35,12 @@ where
35 // .checked_sub_signed(Duration::weeks(4 * self.view_month_offset() as i64)) 35 // .checked_sub_signed(Duration::weeks(4 * self.view_month_offset() as i64))
36 // .unwrap() 36 // .unwrap()
37 // }; 37 // };
38 let now = self.cursor().0; 38 let now = self.inner_data_ref().cursor().0;
39 let is_today = now == Local::now().naive_local().date(); 39 let is_today = now == Local::now().naive_local().date();
40 let year = now.year(); 40 let year = now.year();
41 let month = now.month(); 41 let month = now.month();
42 42
43 let goal_reached_style = Style::from(CONFIGURATION.reached_color()); 43 let goal_reached_style = Style::from(CONFIGURATION.reached_color());
44 let todo_style = Style::from(CONFIGURATION.todo_color());
45 let future_style = Style::from(CONFIGURATION.inactive_color()); 44 let future_style = Style::from(CONFIGURATION.inactive_color());
46 45
47 let strikethrough = Style::from(Effect::Strikethrough); 46 let strikethrough = Style::from(Effect::Strikethrough);
@@ -141,7 +140,7 @@ where
141 } 140 }
142 }; 141 };
143 142
144 match self.view_mode() { 143 match self.inner_data_ref().view_mode() {
145 ViewMode::Day => draw_day(printer), 144 ViewMode::Day => draw_day(printer),
146 ViewMode::Week => draw_week(printer), 145 ViewMode::Week => draw_week(printer),
147 _ => draw_day(printer), 146 _ => draw_day(printer),
@@ -157,7 +156,7 @@ where
157 } 156 }
158 157
159 fn on_event(&mut self, e: Event) -> EventResult { 158 fn on_event(&mut self, e: Event) -> EventResult {
160 let now = self.cursor().0; 159 let now = self.inner_data_mut_ref().cursor().0;
161 if self.is_auto() { 160 if self.is_auto() {
162 return EventResult::Ignored; 161 return EventResult::Ignored;
163 } 162 }