mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
use modern (2018) pattern for modules
This commit is contained in:
parent
1627902b8f
commit
cdc3fe3388
28 changed files with 0 additions and 0 deletions
|
|
@ -1,46 +0,0 @@
|
|||
mod description;
|
||||
mod title;
|
||||
|
||||
use description::Description;
|
||||
use title::Title;
|
||||
|
||||
use gtk::{glib::GString, prelude::BoxExt, Align, Box, Orientation};
|
||||
|
||||
pub struct Subject {
|
||||
widget: Box,
|
||||
title: Title,
|
||||
description: Description,
|
||||
}
|
||||
|
||||
impl Subject {
|
||||
// Construct
|
||||
pub fn new() -> Self {
|
||||
let title = Title::new();
|
||||
let description = Description::new();
|
||||
|
||||
let widget = Box::builder()
|
||||
.orientation(Orientation::Vertical)
|
||||
.valign(Align::Center)
|
||||
.build();
|
||||
|
||||
widget.append(title.widget());
|
||||
widget.append(description.widget());
|
||||
|
||||
Self {
|
||||
widget,
|
||||
title,
|
||||
description,
|
||||
}
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn update(&self, title: Option<GString>, description: Option<GString>) {
|
||||
self.title.update(title);
|
||||
self.description.update(description);
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn widget(&self) -> &Box {
|
||||
&self.widget
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue