Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit b7230c4

Browse files
committed
Display feed and article titles as markup
This makes it so we can use the escaped-HTML output of Htmlclean directly as titles, and things like &lt;pre&gt; will show as <pre> in titles. See #918
1 parent c782ced commit b7230c4

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/Widgets/ArticleRow.vala

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ public class FeedReader.ArticleRow : Gtk.ListBoxRow {
8282
m_unread_stack.set_transition_duration(50);
8383
m_marked_stack.set_transition_duration(50);
8484

85-
m_label = new Gtk.Label(m_article.getTitle());
85+
m_label = new Gtk.Label(null);
86+
m_label.set_markup(m_article.getTitle());
8687
m_label.set_line_wrap_mode(Pango.WrapMode.WORD);
8788
m_label.set_line_wrap(true);
8889
m_label.set_lines(2);
@@ -185,7 +186,8 @@ public class FeedReader.ArticleRow : Gtk.ListBoxRow {
185186
}
186187

187188

188-
var body_label = new Gtk.Label(short_preview);
189+
var body_label = new Gtk.Label(null);
190+
body_label.set_markup(short_preview);
189191
body_label.opacity = 0.7;
190192
body_label.get_style_context().add_class("preview");
191193
body_label.set_alignment(0.0f, 0.0f);
@@ -195,7 +197,11 @@ public class FeedReader.ArticleRow : Gtk.ListBoxRow {
195197
body_label.set_lines(2);
196198

197199
var feed = DataBase.readOnly().read_feed(m_article.getFeedID());
198-
var feedLabel = new Gtk.Label(feed != null ? feed.getTitle() : "");
200+
var feedLabel = new Gtk.Label(null);
201+
if (feed != null)
202+
{
203+
feedLabel.set_markup(feed.getTitle());
204+
}
199205
feedLabel.get_style_context().add_class("preview");
200206
feedLabel.opacity = 0.6;
201207
feedLabel.set_alignment(0.0f, 0.5f);

src/Widgets/FeedRow.vala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ public class FeedReader.FeedRow : Gtk.ListBoxRow {
4646
m_icon = createFavIcon();
4747
m_icon.margin_start = level * 24;
4848

49-
m_label = new Gtk.Label(m_feed.getTitle());
49+
m_label = new Gtk.Label(null);
50+
m_label.set_markup(m_feed.getTitle());
5051
m_label.set_size_request (0, rowhight);
5152
m_label.set_ellipsize (Pango.EllipsizeMode.END);
5253
m_label.set_alignment(0, 0.5f);

0 commit comments

Comments
 (0)