[geary/cherry-pick-db289898] Merge branch 'link_preview' into 'mainline'
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/cherry-pick-db289898] Merge branch 'link_preview' into 'mainline'
- Date: Sun, 17 Nov 2019 00:53:30 +0000 (UTC)
commit 0282eb9fd4244fb9a8b17ec953f8f98656d7773d
Author: Michael Gratton <mike vee net>
Date: Sun Nov 17 00:52:20 2019 +0000
Merge branch 'link_preview' into 'mainline'
Shorten long URLs in conversation viewer link preview tooltips
Closes #356
See merge request GNOME/geary!364
(cherry picked from commit db289898296db392f24eaef42f215dedd59a3853)
b2f71792 Link preview popup is way too big
026cbe4e Link preview popup is way too big
7d2579f3 Move function to short url from conversation-message to a more generic
src/client/conversation-viewer/conversation-message.vala | 2 +-
src/client/util/util-email.vala | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/client/conversation-viewer/conversation-message.vala
b/src/client/conversation-viewer/conversation-message.vala
index dc249191..4129c20c 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -1148,7 +1148,7 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
WebKit.HitTestResult hit_test,
uint modifiers) {
this.body_container.set_tooltip_text(
- hit_test.context_is_link() ? hit_test.get_link_uri() : null
+ hit_test.context_is_link() ? Util.Email.shorten_url(hit_test.get_link_uri()) : null
);
this.body_container.trigger_tooltip_query();
}
diff --git a/src/client/util/util-email.vala b/src/client/util/util-email.vala
index 17b2bcb5..bebd43bc 100644
--- a/src/client/util/util-email.vala
+++ b/src/client/util/util-email.vala
@@ -261,4 +261,14 @@ namespace Util.Email {
return body_text;
}
+
+ private string shorten_url(string url) {
+ string new_url = "";
+ if (url.length < 90) {
+ new_url = url;
+ } else {
+ new_url = url.substring(0,40) + "..." + url.substring(-40);
+ }
+ return new_url;
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]