sidebar: fix unread bold via notify, larger title font, sidebar zoom

This commit is contained in:
Jeena 2026-03-22 00:34:51 +00:00
parent c19c2cbd1d
commit b63549ae0a
4 changed files with 10 additions and 12 deletions

View file

@ -32,6 +32,7 @@ template $ArticleRow : Gtk.Box {
wrap: true;
lines: 2;
ellipsize: end;
styles ["article-title"]
}
Label excerpt_label {

View file

@ -46,6 +46,9 @@ corresponding .blp file and regenerate this file with blueprint-compiler.
<property name="wrap">true</property>
<property name="lines">2</property>
<property name="ellipsize">3</property>
<style>
<class name="article-title"/>
</style>
</object>
</child>
<child>

View file

@ -73,6 +73,9 @@ mod imp {
}
.unread-title {
font-weight: bold;
}
.article-title {
font-size: 1.05em;
}"
);
gtk4::style_context_add_provider_for_display(

View file

@ -73,11 +73,10 @@ mod imp {
self.title_label.set_text(&article.title);
self.excerpt_label.set_text(&article.excerpt);
self.date_label.set_text(&relative_time(article.published));
self.update_read_style(article.unread);
drop(article);
// Watch for unread state changes
// Register the style handler first, then fire it immediately so
// the initial state uses the exact same code path as later changes.
let title_label = self.title_label.clone();
let id = obj.connect_notify_local(Some("unread"), move |obj, _| {
let unread = obj.article().unread;
@ -90,6 +89,7 @@ mod imp {
}
});
*self.unread_handler.borrow_mut() = Some((obj.clone(), id));
obj.notify("unread");
}
pub fn unbind(&self) {
@ -101,15 +101,6 @@ mod imp {
}
}
fn update_read_style(&self, unread: bool) {
if unread {
self.title_label.remove_css_class("dim-label");
self.title_label.add_css_class("unread-title");
} else {
self.title_label.add_css_class("dim-label");
self.title_label.remove_css_class("unread-title");
}
}
}
}