mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
separate modules to submodule components
This commit is contained in:
parent
2c389abdfd
commit
e45b7f0a4a
13 changed files with 167 additions and 71 deletions
|
|
@ -13,8 +13,12 @@ impl Description {
|
|||
}
|
||||
|
||||
// Actions
|
||||
pub fn update(&self, text: &str) {
|
||||
self.widget.update(text);
|
||||
pub fn set_text(&self, text: &str) {
|
||||
self.widget.gtk().set_text(text);
|
||||
}
|
||||
|
||||
pub fn update(&self) {
|
||||
self.widget.update();
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -11,20 +11,15 @@ impl Description {
|
|||
.css_classes(["subtitle"])
|
||||
.single_line_mode(true)
|
||||
.ellipsize(gtk::pango::EllipsizeMode::End)
|
||||
.visible(false)
|
||||
.build();
|
||||
|
||||
Self { gtk }
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn update(&self, text: &str) {
|
||||
self.gtk.set_text(text);
|
||||
|
||||
if text.is_empty() {
|
||||
self.gtk.hide();
|
||||
} else {
|
||||
self.gtk.show();
|
||||
}
|
||||
pub fn update(&self) {
|
||||
self.gtk.set_visible(self.gtk.text().is_empty());
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
const DEFAULT_TEXT: &str = "Yoda";
|
||||
|
||||
pub struct Title {
|
||||
gtk: gtk::Label,
|
||||
}
|
||||
|
|
@ -9,6 +11,7 @@ impl Title {
|
|||
.css_classes(["title"])
|
||||
.single_line_mode(true)
|
||||
.ellipsize(gtk::pango::EllipsizeMode::End)
|
||||
.label(DEFAULT_TEXT)
|
||||
.build();
|
||||
|
||||
Self { gtk }
|
||||
|
|
@ -16,12 +19,10 @@ impl Title {
|
|||
|
||||
// Actions
|
||||
pub fn update(&self, text: &str) {
|
||||
let default_text = "Yoda"; // @TODO
|
||||
|
||||
if text.is_empty() {
|
||||
self.gtk.set_text(default_text);
|
||||
self.gtk.set_text(DEFAULT_TEXT);
|
||||
} else {
|
||||
self.gtk.set_text(&format!("{} - {}", text, default_text));
|
||||
self.gtk.set_text(&format!("{} - {}", text, DEFAULT_TEXT));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ impl Subject {
|
|||
pub fn new(title: >k::Label, description: >k::Label) -> Subject {
|
||||
let gtk = gtk::Box::builder()
|
||||
.orientation(gtk::Orientation::Vertical)
|
||||
.valign(gtk::Align::Center)
|
||||
.build();
|
||||
|
||||
gtk.append(title);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue