diff --git a/data/ui/article_row.blp b/data/ui/article_row.blp
index ea4c08d..07c4cbe 100644
--- a/data/ui/article_row.blp
+++ b/data/ui/article_row.blp
@@ -32,6 +32,7 @@ template $ArticleRow : Gtk.Box {
wrap: true;
lines: 2;
ellipsize: end;
+ styles ["article-title"]
}
Label excerpt_label {
diff --git a/data/ui/article_row.ui b/data/ui/article_row.ui
index e159ff1..d5eeab9 100644
--- a/data/ui/article_row.ui
+++ b/data/ui/article_row.ui
@@ -46,6 +46,9 @@ corresponding .blp file and regenerate this file with blueprint-compiler.
true
2
3
+
diff --git a/src/app.rs b/src/app.rs
index 6e287f0..6d4e591 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -73,6 +73,9 @@ mod imp {
}
.unread-title {
font-weight: bold;
+ }
+ .article-title {
+ font-size: 1.05em;
}"
);
gtk4::style_context_add_provider_for_display(
diff --git a/src/article_row.rs b/src/article_row.rs
index d8877ce..2e6a6a2 100644
--- a/src/article_row.rs
+++ b/src/article_row.rs
@@ -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");
- }
- }
}
}