about summary refs log tree commit diff
path: root/src/ui/tasks_group.rs
diff options
context:
space:
mode:
authorRicky Kresslein <rk@lakoliu.com>2022-04-14 17:44:21 +0300
committerRicky Kresslein <rk@lakoliu.com>2022-04-14 17:44:21 +0300
commiteb80833b5d736180baa49c7f3787fe30eba161db (patch)
treef4fbc30b8f80002a57176d9d77a414160b16f5c0 /src/ui/tasks_group.rs
parentdd7f8f8a6462b81cadf9f5f2a0b2a31757c59c18 (diff)
downloadFurtherance-eb80833b5d736180baa49c7f3787fe30eba161db.tar.zst
Add daily time sums (Issue #17)
Diffstat (limited to 'src/ui/tasks_group.rs')
-rwxr-xr-xsrc/ui/tasks_group.rs7
1 files changed, 7 insertions, 0 deletions
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<gtk::Box>,
+
         pub models: RefCell<Vec<gtk::SortListModel>>,
+        pub day_total_time: RefCell<i64>,
     }
 
     #[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()
     }
 }