From e9568564d65778bce7e6dec003541bae0a8d6aef Mon Sep 17 00:00:00 2001 From: Ricky Kresslein Date: Sun, 11 Sep 2022 15:20:41 +0200 Subject: #86: Prefill task name in edit --- src/ui/task_details.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/ui/task_details.rs b/src/ui/task_details.rs index e6077f6..2c05619 100755 --- a/src/ui/task_details.rs +++ b/src/ui/task_details.rs @@ -57,6 +57,7 @@ mod imp { pub all_task_ids: RefCell>, pub this_day: RefCell, pub orig_tags: RefCell, + pub orig_name_with_tags: RefCell, } #[glib::object_subclass] @@ -114,6 +115,7 @@ impl FurTaskDetails { let this_day_str = DateTime::parse_from_rfc3339(&task_group[0].start_time).unwrap(); *imp.this_day.borrow_mut() = this_day_str.format("%F").to_string(); *imp.orig_tags.borrow_mut() = task_group[0].tags.clone(); + *imp.orig_name_with_tags.borrow_mut() = task_group[0].task_name.clone() + " #" + &task_group[0].tags.clone(); for task in task_group.clone() { imp.all_task_ids.borrow_mut().push(task.id); @@ -508,6 +510,8 @@ impl FurTaskDetails { let message_area = dialog.message_area().downcast::().unwrap(); let new_name_entry = gtk::Entry::new(); new_name_entry.set_placeholder_text(Some(&gettext("New Name #tags"))); + let imp3 = imp::FurTaskDetails::from_instance(&this); + new_name_entry.set_text(&imp3.orig_name_with_tags.borrow().to_string()); let cant_be_empty = gtk::Label::new(Some(&gettext("Task name cannot be empty."))); cant_be_empty.add_css_class("error_message"); cant_be_empty.hide(); -- cgit 1.4.1