sidebar: bold title for unread articles
This commit is contained in:
parent
03b1936740
commit
a77fa3ae03
1 changed files with 10 additions and 0 deletions
|
|
@ -83,8 +83,10 @@ mod imp {
|
|||
let unread = obj.article().unread;
|
||||
if unread {
|
||||
title_label.remove_css_class("dim-label");
|
||||
title_label.set_attributes(Some(&bold_attrs()));
|
||||
} else {
|
||||
title_label.add_css_class("dim-label");
|
||||
title_label.set_attributes(None);
|
||||
}
|
||||
});
|
||||
*self.unread_handler.borrow_mut() = Some((obj.clone(), id));
|
||||
|
|
@ -102,13 +104,21 @@ mod imp {
|
|||
fn update_read_style(&self, unread: bool) {
|
||||
if unread {
|
||||
self.title_label.remove_css_class("dim-label");
|
||||
self.title_label.set_attributes(Some(&bold_attrs()));
|
||||
} else {
|
||||
self.title_label.add_css_class("dim-label");
|
||||
self.title_label.set_attributes(None);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn bold_attrs() -> gtk4::pango::AttrList {
|
||||
let list = gtk4::pango::AttrList::new();
|
||||
list.insert(gtk4::pango::AttrInt::new_weight(gtk4::pango::Weight::Bold));
|
||||
list
|
||||
}
|
||||
|
||||
fn relative_time(unix: i64) -> String {
|
||||
let now = std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue