[gnome-contacts] Contact: don't needlessly lookup the types of all fields.



commit e7960b06652703e3d51e53cb675cb0bb0d45a915
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Sat Mar 31 11:48:48 2018 +0200

    Contact: don't needlessly lookup the types of all fields.
    
    This shoudln't be necessary and actually seems to cause some memory
    leakage.

 src/contacts-contact.vala | 13 -------------
 src/contacts-types.vala   |  5 -----
 2 files changed, 18 deletions(-)
---
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index 7f332a7..6c52deb 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -133,8 +133,6 @@ public class Contacts.Contact : GLib.Object  {
 
     is_main = calc_is_main ();
 
-    update ();
-
     individual.notify.connect(notify_cb);
   }
 
@@ -259,7 +257,6 @@ public class Contacts.Contact : GLib.Object  {
   private bool changed_cb () {
     this.changed_id = 0;
     this.is_main = calc_is_main ();
-    update ();
     changed ();
     return false;
   }
@@ -282,16 +279,6 @@ public class Contacts.Contact : GLib.Object  {
     queue_changed ();
   }
 
-  private void update () {
-    foreach (var email in individual.email_addresses) {
-      TypeSet.general.type_seen (email);
-    }
-
-    foreach (var phone in individual.phone_numbers) {
-      TypeSet.phone.type_seen (phone);
-    }
-  }
-
   /* We claim something is "removable" if at least one persona is removable,
      that will typically unlink the rest. */
   public bool can_remove_personas () {
diff --git a/src/contacts-types.vala b/src/contacts-types.vala
index de8344d..9affca6 100644
--- a/src/contacts-types.vala
+++ b/src/contacts-types.vala
@@ -209,11 +209,6 @@ public class Contacts.TypeSet : Object  {
     }
   }
 
-
-  public void type_seen (AbstractFieldDetails detail) {
-    lookup_type (detail, null);
-  }
-
   public string format_type (AbstractFieldDetails detail) {
     if (detail.parameters.contains (X_GOOGLE_LABEL)) {
       return Utils.get_first<string> (detail.parameters.get (X_GOOGLE_LABEL));


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