mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
init header components
This commit is contained in:
parent
0759f14843
commit
0c8684491b
7 changed files with 210 additions and 1 deletions
49
src/app/browser/header/subject/description.rs
Normal file
49
src/app/browser/header/subject/description.rs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
use gtk::Label;
|
||||
use gtk::prelude::WidgetExt;
|
||||
|
||||
pub fn new() -> Label
|
||||
{
|
||||
let description = Label::builder()
|
||||
|
||||
.css_classes(
|
||||
[
|
||||
"subtitle"
|
||||
]
|
||||
)
|
||||
|
||||
.single_line_mode(
|
||||
true
|
||||
)
|
||||
|
||||
.ellipsize(
|
||||
gtk::pango::EllipsizeMode::End
|
||||
)
|
||||
|
||||
.build();
|
||||
|
||||
update(
|
||||
&description,
|
||||
"" // @TODO
|
||||
);
|
||||
|
||||
return description;
|
||||
}
|
||||
|
||||
pub fn update(
|
||||
description: &Label,
|
||||
text: &str
|
||||
) {
|
||||
description.set_text(
|
||||
text
|
||||
);
|
||||
|
||||
if text.is_empty()
|
||||
{
|
||||
description.hide();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
description.show();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue