Initial
This commit is contained in:
commit
d7e8932a38
9
build.rs
Normal file
9
build.rs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
use gtk::gio;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
gio::compile_resources(
|
||||||
|
"src",
|
||||||
|
"src/gtimelog4.gresource.xml",
|
||||||
|
"gtimelog4.gresource",
|
||||||
|
);
|
||||||
|
}
|
||||||
47
src/timeentry.rs
Normal file
47
src/timeentry.rs
Normal file
@ -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<RefCell<rtimelog::store::Entry>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
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<imp::TimeEntry>);
|
||||||
|
}
|
||||||
|
|
||||||
|
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<rtimelog::store::Entry> for TimeEntry {
|
||||||
|
fn from(entry: Entry) -> Self {
|
||||||
|
TimeEntry::new(entry)
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user