sidebar: use Pango markup for bold, fix zoom CSS specificity
This commit is contained in:
parent
e5f2d5c941
commit
81439edf87
3 changed files with 8 additions and 12 deletions
|
|
@ -71,9 +71,6 @@ mod imp {
|
||||||
.sidebar-content row:selected {
|
.sidebar-content row:selected {
|
||||||
background-color: alpha(@window_fg_color, 0.22);
|
background-color: alpha(@window_fg_color, 0.22);
|
||||||
}
|
}
|
||||||
.unread-title {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
.article-title {
|
.article-title {
|
||||||
font-size: 1.05em;
|
font-size: 1.05em;
|
||||||
}"
|
}"
|
||||||
|
|
|
||||||
|
|
@ -68,24 +68,23 @@ mod imp {
|
||||||
impl ArticleRow {
|
impl ArticleRow {
|
||||||
pub fn bind(&self, obj: &ArticleObject) {
|
pub fn bind(&self, obj: &ArticleObject) {
|
||||||
let article = obj.article();
|
let article = obj.article();
|
||||||
|
|
||||||
self.feed_title_label.set_text(&article.feed_title);
|
self.feed_title_label.set_text(&article.feed_title);
|
||||||
self.title_label.set_text(&article.title);
|
|
||||||
self.excerpt_label.set_text(&article.excerpt);
|
self.excerpt_label.set_text(&article.excerpt);
|
||||||
self.date_label.set_text(&relative_time(article.published));
|
self.date_label.set_text(&relative_time(article.published));
|
||||||
drop(article);
|
drop(article);
|
||||||
|
|
||||||
// Register the style handler first, then fire it immediately so
|
// Register handler first, then trigger it for the initial state.
|
||||||
// the initial state uses the exact same code path as later changes.
|
// Using Pango markup for bold avoids CSS specificity issues.
|
||||||
let title_label = self.title_label.clone();
|
let title_label = self.title_label.clone();
|
||||||
let id = obj.connect_notify_local(Some("unread"), move |obj, _| {
|
let id = obj.connect_notify_local(Some("unread"), move |obj, _| {
|
||||||
let unread = obj.article().unread;
|
let article = obj.article();
|
||||||
if unread {
|
let escaped = glib::markup_escape_text(&article.title);
|
||||||
|
if article.unread {
|
||||||
title_label.remove_css_class("dim-label");
|
title_label.remove_css_class("dim-label");
|
||||||
title_label.add_css_class("unread-title");
|
title_label.set_markup(&format!("<b>{escaped}</b>"));
|
||||||
} else {
|
} else {
|
||||||
title_label.add_css_class("dim-label");
|
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));
|
*self.unread_handler.borrow_mut() = Some((obj.clone(), id));
|
||||||
|
|
|
||||||
|
|
@ -831,7 +831,7 @@ pub mod imp {
|
||||||
fn update_sidebar_zoom(&self, level: f64) {
|
fn update_sidebar_zoom(&self, level: f64) {
|
||||||
if let Some(css) = self.sidebar_zoom_css.get() {
|
if let Some(css) = self.sidebar_zoom_css.get() {
|
||||||
css.load_from_string(&format!(
|
css.load_from_string(&format!(
|
||||||
".sidebar-content label {{ font-size: {level}em; }}"
|
".sidebar-content {{ font-size: {level}em; }}"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue