aboutsummaryrefslogtreecommitdiff
path: root/src/gui/form/utils.rs
diff options
context:
space:
mode:
authorJoris2022-03-19 22:03:58 +0100
committerJoris2022-03-19 22:03:58 +0100
commit35cc74578e969bae4812afd2ff041eba3746142d (patch)
treec0ef18d3c81554f0e70c91fcb1006d587470365c /src/gui/form/utils.rs
parent199624dc03ead28ddc7454147457512d9568c593 (diff)
downloadcalendar-35cc74578e969bae4812afd2ff041eba3746142d.tar.gz
calendar-35cc74578e969bae4812afd2ff041eba3746142d.tar.bz2
calendar-35cc74578e969bae4812afd2ff041eba3746142d.zip
Allow to repeat an event until a specific date
Also provide a shortcut to modify a repetead event from a specific occurence. This set the end repetition date under the hood and create a new repeated event.
Diffstat (limited to 'src/gui/form/utils.rs')
-rw-r--r--src/gui/form/utils.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gui/form/utils.rs b/src/gui/form/utils.rs
new file mode 100644
index 0000000..5cf59e3
--- /dev/null
+++ b/src/gui/form/utils.rs
@@ -0,0 +1,21 @@
+use gtk4 as gtk;
+
+use chrono::NaiveTime;
+
+use crate::model::time;
+
+pub fn time_entry(time: Option<NaiveTime>) -> gtk::Entry {
+ entry(&time.map(time::pprint).unwrap_or_else(|| "".to_string()))
+}
+
+pub fn entry(text: &str) -> gtk::Entry {
+ gtk::Entry::builder().text(text).margin_bottom(10).build()
+}
+
+pub fn label(text: &str) -> gtk::Label {
+ gtk::Label::builder()
+ .label(text)
+ .halign(gtk::Align::Start)
+ .margin_bottom(5)
+ .build()
+}