sidebar: use CSS class for bold unread title

This commit is contained in:
Jeena 2026-03-21 12:51:49 +00:00
parent a77fa3ae03
commit 3bcd6af23c
2 changed files with 7 additions and 10 deletions

View file

@ -70,6 +70,9 @@ mod imp {
}
.sidebar-content row:selected {
background-color: alpha(@window_fg_color, 0.22);
}
.unread-title {
font-weight: bold;
}"
);
gtk4::style_context_add_provider_for_display(

View file

@ -83,10 +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()));
title_label.add_css_class("unread-title");
} else {
title_label.add_css_class("dim-label");
title_label.set_attributes(None);
title_label.remove_css_class("unread-title");
}
});
*self.unread_handler.borrow_mut() = Some((obj.clone(), id));
@ -104,21 +104,15 @@ 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()));
self.title_label.add_css_class("unread-title");
} else {
self.title_label.add_css_class("dim-label");
self.title_label.set_attributes(None);
self.title_label.remove_css_class("unread-title");
}
}
}
}
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)