mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
apply rustfmt
This commit is contained in:
parent
e6e81e846a
commit
f8d938a8af
24 changed files with 253 additions and 611 deletions
|
|
@ -1,49 +1,27 @@
|
|||
use gtk::Label;
|
||||
use gtk::prelude::WidgetExt;
|
||||
use gtk::Label;
|
||||
|
||||
pub fn new() -> Label
|
||||
{
|
||||
pub fn new() -> Label {
|
||||
let description = Label::builder()
|
||||
|
||||
.css_classes(
|
||||
[
|
||||
"subtitle"
|
||||
]
|
||||
)
|
||||
|
||||
.single_line_mode(
|
||||
true
|
||||
)
|
||||
|
||||
.ellipsize(
|
||||
gtk::pango::EllipsizeMode::End
|
||||
)
|
||||
|
||||
.css_classes(["subtitle"])
|
||||
.single_line_mode(true)
|
||||
.ellipsize(gtk::pango::EllipsizeMode::End)
|
||||
.build();
|
||||
|
||||
update(
|
||||
&description,
|
||||
"" // @TODO
|
||||
"", // @TODO
|
||||
);
|
||||
|
||||
return description;
|
||||
description
|
||||
}
|
||||
|
||||
pub fn update(
|
||||
description: &Label,
|
||||
text: &str
|
||||
) {
|
||||
description.set_text(
|
||||
text
|
||||
);
|
||||
pub fn update(description: &Label, text: &str) {
|
||||
description.set_text(text);
|
||||
|
||||
if text.is_empty()
|
||||
{
|
||||
if text.is_empty() {
|
||||
description.hide();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
description.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,50 +1,23 @@
|
|||
use gtk::Label;
|
||||
|
||||
pub fn new() -> Label
|
||||
{
|
||||
pub fn new() -> Label {
|
||||
let title = Label::builder()
|
||||
|
||||
.css_classes(
|
||||
[
|
||||
"title"
|
||||
]
|
||||
)
|
||||
|
||||
.single_line_mode(
|
||||
true
|
||||
)
|
||||
|
||||
.ellipsize(
|
||||
gtk::pango::EllipsizeMode::End
|
||||
)
|
||||
|
||||
.css_classes(["title"])
|
||||
.single_line_mode(true)
|
||||
.ellipsize(gtk::pango::EllipsizeMode::End)
|
||||
.build();
|
||||
|
||||
update(
|
||||
&title,
|
||||
"Welcome"
|
||||
);
|
||||
update(&title, "Welcome");
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
pub fn update(
|
||||
title: &Label,
|
||||
text: &str
|
||||
) {
|
||||
pub fn update(title: &Label, text: &str) {
|
||||
let default_text = "Yoda"; // @TODO
|
||||
|
||||
if text.is_empty()
|
||||
{
|
||||
title.set_text(
|
||||
default_text
|
||||
);
|
||||
if text.is_empty() {
|
||||
title.set_text(default_text);
|
||||
} else {
|
||||
title.set_text(&format!("{} - {}", text, default_text));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
title.set_text(
|
||||
&format!("{} - {}", text, default_text)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue