prearing for refactor

This commit is contained in:
leca 2024-04-17 22:56:00 +03:00
parent b32b469f0f
commit d0d2aaeb60
1 changed files with 15 additions and 25 deletions

View File

@ -1,46 +1,36 @@
use gtk::glib::Object;
pub struct Card {
image_path: Option<String>,
hieroglyph: Option<String>,
reading: Option<String>,
translation: Option<String>,
is_learning: Option<bool>
}
impl Card {
pub fn new(image_path: Option<String>, hieroglyph: Option<String>, reading: Option<String>, translation: Option<String>) -> Card {
pub fn new(image_path: Option<String>, hieroglyph: Option<String>, reading: Option<String>, translation: Option<String>, is_learning: Option<bool>) -> Card {
Card {
image_path, hieroglyph, reading, translation
image_path, hieroglyph, reading, translation, is_learning
}
}
pub fn image_path(&self) -> Option<&String> {
match &self.image_path {
Some(v) => Some(&v),
None => None,
}
pub fn image_path(&self) -> Option<String> {
self.image_path.clone()
}
pub fn hieroglyp(&self) -> Option<&String> {
match &self.image_path {
Some(v) => Some(&v),
None => None,
}
pub fn hieroglyp(&self) -> Option<String> {
self.hieroglyph.clone()
}
pub fn reading(&self) -> Option<&String> {
match &self.reading {
Some(v) => Some(&v),
None => None,
}
pub fn reading(&self) -> Option<String> {
self.reading.clone()
}
pub fn translation(&self) -> Option<&String> {
match &self.translation {
Some(v) => Some(&v),
None => None,
}
pub fn translation(&self) -> Option<String> {
self.translation.clone()
}
pub fn is_learning(&self) -> Option<bool> {
self.is_learning.clone()
}
}