commit d7e8932a3800ac92e245e74d3a07570376da3ebe Author: Günther Wagner Date: Sat Oct 15 17:17:58 2022 +0200 Initial diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..f0228a1 --- /dev/null +++ b/build.rs @@ -0,0 +1,9 @@ +use gtk::gio; + +fn main() { + gio::compile_resources( + "src", + "src/gtimelog4.gresource.xml", + "gtimelog4.gresource", + ); +} diff --git a/src/timeentry.rs b/src/timeentry.rs new file mode 100644 index 0000000..c039525 --- /dev/null +++ b/src/timeentry.rs @@ -0,0 +1,47 @@ +use gtk::glib; +use gtk::subclass::prelude::ObjectSubclassExt; +use rtimelog::store::Entry; + +mod imp { + use std::cell::RefCell; + use std::rc::Rc; + use super::*; + use gtk::subclass::prelude::{ObjectImpl, ObjectSubclass}; + + #[derive(Default)] + pub struct TimeEntry { + pub(crate) entry: Rc>, + } + + impl TimeEntry { + + } + + #[glib::object_subclass] + impl ObjectSubclass for TimeEntry { + const NAME: &'static str = "TimeEntry"; + type Type = super::TimeEntry; + type ParentType = glib::Object; + } + + impl ObjectImpl for TimeEntry {} +} + +glib::wrapper! { + pub struct TimeEntry(ObjectSubclass); +} + +impl TimeEntry { + pub fn new(entry: rtimelog::store::Entry) -> Self { + let obj = glib::Object::new(&[]).expect("Could not create TimeEntry"); + let imp = imp::TimeEntry::from_instance(&obj); + imp.entry.replace(entry); + obj + } +} + +impl From for TimeEntry { + fn from(entry: Entry) -> Self { + TimeEntry::new(entry) + } +} \ No newline at end of file