From eb80833b5d736180baa49c7f3787fe30eba161db Mon Sep 17 00:00:00 2001 From: Ricky Kresslein Date: Thu, 14 Apr 2022 17:44:21 +0300 Subject: Add daily time sums (Issue #17) --- src/ui/tasks_group.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/ui/tasks_group.rs') diff --git a/src/ui/tasks_group.rs b/src/ui/tasks_group.rs index 564ecb0..d6da39c 100755 --- a/src/ui/tasks_group.rs +++ b/src/ui/tasks_group.rs @@ -33,7 +33,9 @@ mod imp { pub struct FurTasksGroup { #[template_child] pub listbox_box: TemplateChild, + pub models: RefCell>, + pub day_total_time: RefCell, } #[glib::object_subclass] @@ -99,13 +101,18 @@ impl FurTasksGroup { for same_name in tasks_by_name { let listbox_row = FurTaskRow::new(); listbox_row.set_row_labels(same_name); + *imp.day_total_time.borrow_mut() += listbox_row.get_total_time(); listbox.append(&listbox_row); } listbox.connect_row_activated(move |_, row| { row.activate_action("task-row.open-details", None).unwrap(); }); + } + pub fn get_total_day_time(&self) -> i64 { + let imp = imp::FurTasksGroup::from_instance(&self); + *imp.day_total_time.borrow() } } -- cgit 1.4.1