sidebar: fix unread bold via notify, larger title font, sidebar zoom
This commit is contained in:
parent
c19c2cbd1d
commit
b63549ae0a
4 changed files with 10 additions and 12 deletions
|
|
@ -32,6 +32,7 @@ template $ArticleRow : Gtk.Box {
|
||||||
wrap: true;
|
wrap: true;
|
||||||
lines: 2;
|
lines: 2;
|
||||||
ellipsize: end;
|
ellipsize: end;
|
||||||
|
styles ["article-title"]
|
||||||
}
|
}
|
||||||
|
|
||||||
Label excerpt_label {
|
Label excerpt_label {
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,9 @@ corresponding .blp file and regenerate this file with blueprint-compiler.
|
||||||
<property name="wrap">true</property>
|
<property name="wrap">true</property>
|
||||||
<property name="lines">2</property>
|
<property name="lines">2</property>
|
||||||
<property name="ellipsize">3</property>
|
<property name="ellipsize">3</property>
|
||||||
|
<style>
|
||||||
|
<class name="article-title"/>
|
||||||
|
</style>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,9 @@ mod imp {
|
||||||
}
|
}
|
||||||
.unread-title {
|
.unread-title {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.article-title {
|
||||||
|
font-size: 1.05em;
|
||||||
}"
|
}"
|
||||||
);
|
);
|
||||||
gtk4::style_context_add_provider_for_display(
|
gtk4::style_context_add_provider_for_display(
|
||||||
|
|
|
||||||
|
|
@ -73,11 +73,10 @@ mod imp {
|
||||||
self.title_label.set_text(&article.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));
|
||||||
|
|
||||||
self.update_read_style(article.unread);
|
|
||||||
drop(article);
|
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 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 unread = obj.article().unread;
|
||||||
|
|
@ -90,6 +89,7 @@ mod imp {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
*self.unread_handler.borrow_mut() = Some((obj.clone(), id));
|
*self.unread_handler.borrow_mut() = Some((obj.clone(), id));
|
||||||
|
obj.notify("unread");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unbind(&self) {
|
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue