From 81439edf8797bfae8de04e8c39b58a6f02c17207 Mon Sep 17 00:00:00 2001 From: Jeena Date: Sun, 22 Mar 2026 00:40:20 +0000 Subject: [PATCH] sidebar: use Pango markup for bold, fix zoom CSS specificity --- src/app.rs | 3 --- src/article_row.rs | 15 +++++++-------- src/window.rs | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/app.rs b/src/app.rs index 6d4e591..8e966e9 100644 --- a/src/app.rs +++ b/src/app.rs @@ -71,9 +71,6 @@ mod imp { .sidebar-content row:selected { background-color: alpha(@window_fg_color, 0.22); } - .unread-title { - font-weight: bold; - } .article-title { font-size: 1.05em; }" diff --git a/src/article_row.rs b/src/article_row.rs index 2e6a6a2..23c6c1b 100644 --- a/src/article_row.rs +++ b/src/article_row.rs @@ -68,24 +68,23 @@ mod imp { impl ArticleRow { pub fn bind(&self, obj: &ArticleObject) { let article = obj.article(); - self.feed_title_label.set_text(&article.feed_title); - self.title_label.set_text(&article.title); self.excerpt_label.set_text(&article.excerpt); self.date_label.set_text(&relative_time(article.published)); drop(article); - // Register the style handler first, then fire it immediately so - // the initial state uses the exact same code path as later changes. + // Register handler first, then trigger it for the initial state. + // Using Pango markup for bold avoids CSS specificity issues. let title_label = self.title_label.clone(); let id = obj.connect_notify_local(Some("unread"), move |obj, _| { - let unread = obj.article().unread; - if unread { + let article = obj.article(); + let escaped = glib::markup_escape_text(&article.title); + if article.unread { title_label.remove_css_class("dim-label"); - title_label.add_css_class("unread-title"); + title_label.set_markup(&format!("{escaped}")); } else { title_label.add_css_class("dim-label"); - title_label.remove_css_class("unread-title"); + title_label.set_markup(&escaped); } }); *self.unread_handler.borrow_mut() = Some((obj.clone(), id)); diff --git a/src/window.rs b/src/window.rs index f4905d5..683e046 100644 --- a/src/window.rs +++ b/src/window.rs @@ -831,7 +831,7 @@ pub mod imp { fn update_sidebar_zoom(&self, level: f64) { if let Some(css) = self.sidebar_zoom_css.get() { css.load_from_string(&format!( - ".sidebar-content label {{ font-size: {level}em; }}" + ".sidebar-content {{ font-size: {level}em; }}" )); } }