mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
update struct member name
This commit is contained in:
parent
0c98b869d3
commit
c97222d68c
8 changed files with 48 additions and 48 deletions
|
|
@ -3,33 +3,33 @@ use gtk::prelude::WidgetExt;
|
|||
use gtk::{pango::EllipsizeMode, Label};
|
||||
|
||||
pub struct Description {
|
||||
widget: Label,
|
||||
gobject: Label,
|
||||
}
|
||||
|
||||
impl Description {
|
||||
// Construct
|
||||
pub fn new() -> Self {
|
||||
let widget = Label::builder()
|
||||
let gobject = Label::builder()
|
||||
.css_classes(["subtitle"])
|
||||
.single_line_mode(true)
|
||||
.ellipsize(EllipsizeMode::End)
|
||||
.visible(false)
|
||||
.build();
|
||||
|
||||
Self { widget }
|
||||
Self { gobject }
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn update(&self, text: Option<GString>) {
|
||||
match text {
|
||||
Some(value) => self.widget.set_text(&value),
|
||||
None => self.widget.set_text(""), // @TODO
|
||||
Some(value) => self.gobject.set_text(&value),
|
||||
None => self.gobject.set_text(""), // @TODO
|
||||
};
|
||||
self.widget.set_visible(!self.widget.text().is_empty());
|
||||
self.gobject.set_visible(!self.gobject.text().is_empty());
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn widget(&self) -> &Label {
|
||||
&self.widget
|
||||
pub fn gobject(&self) -> &Label {
|
||||
&self.gobject
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,20 +3,20 @@ use gtk::{glib::GString, pango::EllipsizeMode, Label};
|
|||
const DEFAULT_TEXT: &str = "Yoda"; // @TODO
|
||||
|
||||
pub struct Title {
|
||||
widget: Label,
|
||||
gobject: Label,
|
||||
}
|
||||
|
||||
impl Title {
|
||||
// Construct
|
||||
pub fn new() -> Self {
|
||||
let widget = gtk::Label::builder()
|
||||
let gobject = gtk::Label::builder()
|
||||
.css_classes(["title"])
|
||||
.single_line_mode(true)
|
||||
.ellipsize(EllipsizeMode::End)
|
||||
.label(DEFAULT_TEXT)
|
||||
.build();
|
||||
|
||||
Self { widget }
|
||||
Self { gobject }
|
||||
}
|
||||
|
||||
// Actions
|
||||
|
|
@ -31,11 +31,11 @@ impl Title {
|
|||
|
||||
name.push(GString::from(DEFAULT_TEXT));
|
||||
|
||||
self.widget.set_text(&name.join(" - "));
|
||||
self.gobject.set_text(&name.join(" - "));
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn widget(&self) -> &Label {
|
||||
&self.widget
|
||||
pub fn gobject(&self) -> &Label {
|
||||
&self.gobject
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue