sidebar: bold title for unread articles

This commit is contained in:
Jeena 2026-03-21 12:49:58 +00:00
parent 03b1936740
commit a77fa3ae03

View file

@ -83,8 +83,10 @@ mod imp {
let unread = obj.article().unread; let unread = obj.article().unread;
if unread { if unread {
title_label.remove_css_class("dim-label"); title_label.remove_css_class("dim-label");
title_label.set_attributes(Some(&bold_attrs()));
} else { } else {
title_label.add_css_class("dim-label"); title_label.add_css_class("dim-label");
title_label.set_attributes(None);
} }
}); });
*self.unread_handler.borrow_mut() = Some((obj.clone(), id)); *self.unread_handler.borrow_mut() = Some((obj.clone(), id));
@ -102,13 +104,21 @@ mod imp {
fn update_read_style(&self, unread: bool) { fn update_read_style(&self, unread: bool) {
if unread { if unread {
self.title_label.remove_css_class("dim-label"); self.title_label.remove_css_class("dim-label");
self.title_label.set_attributes(Some(&bold_attrs()));
} else { } else {
self.title_label.add_css_class("dim-label"); 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 { fn relative_time(unix: i64) -> String {
let now = std::time::SystemTime::now() let now = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH) .duration_since(std::time::UNIX_EPOCH)