[gnome-maps] PlaceBubble: Use the title as a hyperlink
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] PlaceBubble: Use the title as a hyperlink
- Date: Thu, 22 Jun 2017 10:37:24 +0000 (UTC)
commit 120c3b4251d3b2232921a0b0a734930e24baf377
Author: Robert Ancell <robert ancell canonical com>
Date: Wed May 31 11:07:06 2017 +1200
PlaceBubble: Use the title as a hyperlink
Use the title as a hyperlink instead of putting it in expanded content which is
hidden by default.
https://bugzilla.gnome.org/show_bug.cgi?id=762491
data/ui/place-bubble.ui | 1 +
src/placeBubble.js | 13 +++++++------
2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/data/ui/place-bubble.ui b/data/ui/place-bubble.ui
index 6a93a97..a8c00ea 100644
--- a/data/ui/place-bubble.ui
+++ b/data/ui/place-bubble.ui
@@ -30,6 +30,7 @@
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="vexpand">True</property>
+ <property name="use_markup">True</property>
<style>
<class name="bubble-title"/>
</style>
diff --git a/src/placeBubble.js b/src/placeBubble.js
index 783c51d..da4e449 100644
--- a/src/placeBubble.js
+++ b/src/placeBubble.js
@@ -165,11 +165,6 @@ const PlaceBubble = new Lang.Class({
}
}
- if (place.website) {
- expandedContent.push({ linkText: _("Website"),
- linkUrl: place.website });
- }
-
if (place.wiki) {
let link = this._formatWikiLink(place.wiki);
expandedContent.push({ linkText: _("Wikipedia"),
@@ -238,7 +233,13 @@ const PlaceBubble = new Lang.Class({
this._attachContent(content, expandedContent);
- this._title.label = formatter.title;
+ let title = GLib.markup_escape_text(formatter.title, -1);
+ if (place.website) {
+ let uri = GLib.markup_escape_text(place.website, -1);
+ this._title.label = '<a href="%s">%s</a>'.format(uri, title);
+ } else {
+ this._title.label = title;
+ }
this._expandButton.visible = expandedContent.length > 0;
this._stack.visible_child = this._gridContent;
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]