mod imp;
use glib::Object;
use gtk::glib;
use crate::card::Card;

glib::wrapper! {
    pub struct CardGObject(ObjectSubclass<imp::CardGObject>);
}

impl CardGObject {
    pub fn new(c: Option<Card>) -> Self {
        match c {
            Some(c) => {
                Object::builder()
                .property("imagepath", c.image_path().unwrap())
                .property("hieroglyph", c.hieroglyph().unwrap())
                .property("reading", c.reading().unwrap())
                .property("translation", c.translation().unwrap())
                .property("islearning", c.is_learning().unwrap())
                .build()
            },
            None => Object::builder().build()
        }
        
    }
}