[gnome-contacts/new-design: 2/6] Just show domain name as short for of links
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts/new-design: 2/6] Just show domain name as short for of links
- Date: Wed, 7 Dec 2011 21:00:48 +0000 (UTC)
commit 78af92019b4f067122a8d4027b1ebac28ba9b246
Author: Alexander Larsson <alexl redhat com>
Date: Wed Dec 7 12:41:47 2011 +0100
Just show domain name as short for of links
src/contacts-contact.vala | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index 30cac49..dfafff9 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -913,6 +913,19 @@ public class Contacts.Contact : GLib.Object {
if (/https?:\/\/twitter.com\/#!\/[a-zA-Z0-9]+$/.match(uri))
return _("Twitter");
+ if (uri.ascii_ncasecmp ("http:", 5) == 0 ||
+ uri.ascii_ncasecmp ("https:", 5) == 0) {
+ var start = uri.index_of (":");
+ start++;
+ while (uri[start] == '/')
+ start++;
+ var last = uri.index_of ("/", start);
+ if (last < 0)
+ last = uri.length;
+
+ return uri[start:last];
+ }
+
return uri;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]