prearing for refactor
This commit is contained in:
parent
b32b469f0f
commit
d0d2aaeb60
|
@ -1,46 +1,36 @@
|
||||||
use gtk::glib::Object;
|
|
||||||
|
|
||||||
pub struct Card {
|
pub struct Card {
|
||||||
image_path: Option<String>,
|
image_path: Option<String>,
|
||||||
hieroglyph: Option<String>,
|
hieroglyph: Option<String>,
|
||||||
reading: Option<String>,
|
reading: Option<String>,
|
||||||
translation: Option<String>,
|
translation: Option<String>,
|
||||||
|
is_learning: Option<bool>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Card {
|
impl Card {
|
||||||
|
pub fn new(image_path: Option<String>, hieroglyph: Option<String>, reading: Option<String>, translation: Option<String>, is_learning: Option<bool>) -> Card {
|
||||||
pub fn new(image_path: Option<String>, hieroglyph: Option<String>, reading: Option<String>, translation: Option<String>) -> Card {
|
|
||||||
Card {
|
Card {
|
||||||
image_path, hieroglyph, reading, translation
|
image_path, hieroglyph, reading, translation, is_learning
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn image_path(&self) -> Option<&String> {
|
pub fn image_path(&self) -> Option<String> {
|
||||||
match &self.image_path {
|
self.image_path.clone()
|
||||||
Some(v) => Some(&v),
|
|
||||||
None => None,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hieroglyp(&self) -> Option<&String> {
|
pub fn hieroglyp(&self) -> Option<String> {
|
||||||
match &self.image_path {
|
self.hieroglyph.clone()
|
||||||
Some(v) => Some(&v),
|
|
||||||
None => None,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reading(&self) -> Option<&String> {
|
pub fn reading(&self) -> Option<String> {
|
||||||
match &self.reading {
|
self.reading.clone()
|
||||||
Some(v) => Some(&v),
|
|
||||||
None => None,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn translation(&self) -> Option<&String> {
|
pub fn translation(&self) -> Option<String> {
|
||||||
match &self.translation {
|
self.translation.clone()
|
||||||
Some(v) => Some(&v),
|
}
|
||||||
None => None,
|
|
||||||
}
|
pub fn is_learning(&self) -> Option<bool> {
|
||||||
|
self.is_learning.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue