[gnome-contacts] Contacts.Contact: use Individual for display_name



commit 3a55dc2657a98b2d3e1950832c5db0e43b9b2ce3
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Wed Dec 27 12:09:54 2017 +0100

    Contacts.Contact: use Individual for display_name
    
    It's already in Folks, so it's better to let them do it.

 src/contacts-contact.vala |   48 +--------------------------------------------
 1 files changed, 1 insertions(+), 47 deletions(-)
---
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index ae0604e..83053be 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -71,23 +71,7 @@ public class Contacts.Contact : GLib.Object  {
   }
 
   public string display_name {
-    get {
-      unowned string? name = individual.full_name;
-      if (is_set (name))
-       return name;
-      unowned string? alias = individual.alias;
-      if (is_set (alias))
-       return alias;
-      unowned string? nickname = individual.nickname;
-      if (is_set (nickname))
-       return nickname;
-      foreach (var email in individual.email_addresses) {
-       string? e = email.value;
-       if (is_set (e))
-         return email.value;
-      }
-      return "";
-    }
+    get { return this.individual.display_name; }
   }
 
   public static bool persona_has_writable_property (Persona persona, string property) {
@@ -103,36 +87,6 @@ public class Contacts.Contact : GLib.Object  {
     return false;
   }
 
-  public static string get_display_name_for_persona (Persona persona) {
-    var name_details = persona as NameDetails;
-    var alias_details = persona as AliasDetails;
-    var email_details = persona as EmailDetails;
-
-    if (name_details != null) {
-      unowned string? name = name_details.full_name;
-      if (is_set (name))
-       return name;
-    }
-    if (alias_details != null) {
-      unowned string? alias = alias_details.alias;
-      if (is_set (alias))
-       return alias;
-    }
-    if (name_details != null) {
-      unowned string? nickname = name_details.nickname;
-      if (is_set (nickname))
-       return nickname;
-    }
-    if (email_details != null) {
-      foreach (var email in email_details.email_addresses) {
-       string e = email.value;
-       if (is_set (e))
-         return e;
-      }
-    }
-    return "";
-  }
-
   public unichar initial_letter {
     get {
       string name = display_name;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]