aboutsummaryrefslogtreecommitdiff
path: root/src/gui/form/utils.rs
blob: d0b48068456f08f032c6e9c93e8df0ce2d5d1376 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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_default())
}

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()
}