[geary: 3/4] Move function to short url from conversation-message to a more generic util/email. Changed name of f



commit 7d2579f3ba0b1b7976c5ab37aa342369e1be1910
Author: Mario Ravalli <mario raval li>
Date:   Sun Nov 17 00:42:49 2019 +0100

    Move function to short url from conversation-message to a more generic
    util/email.
    Changed name of function to "shorten_url"

 src/client/conversation-viewer/conversation-message.vala | 12 +-----------
 src/client/util/util-email.vala                          | 10 ++++++++++
 2 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-message.vala 
b/src/client/conversation-viewer/conversation-message.vala
index 2b3f5226..94fcd45a 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -1149,21 +1149,11 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
                                          WebKit.HitTestResult hit_test,
                                          uint modifiers) {
         this.body_container.set_tooltip_text(
-            hit_test.context_is_link() ? this.get_link_uri(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();
     }
 
-    private string get_link_uri(string uri) {
-        string new_uri = "";
-        if (uri.length < 90) {
-            new_uri = uri;
-        } else {
-            new_uri = uri.substring(0,40) + "..." + uri.substring(-40);
-        }
-        return new_uri;
-    }
-
     // Check for possible phishing links, displays a popover if found.
     // If not, lets it go through to the default handler.
     private void on_deceptive_link_clicked(ConversationWebView.DeceptiveText reason,
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]