[gnome-contacts] Cleanup: remove Contact.get_first_string



commit d4455c68ced391e4b773de371fe4799f6e097a99
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Mon Aug 28 11:52:19 2017 +0200

    Cleanup: remove Contact.get_first_string

 src/contacts-contact.vala |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index 07b6bdc..a8577ae 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -333,21 +333,14 @@ public class Contacts.Contact : GLib.Object  {
     return true;
   }
 
-  static string? get_first_string (Collection<string>? collection) {
-    if (collection != null) {
-      var i = collection.iterator();
-      if (i.next())
-       return i.get();
-    }
-    return null;
-  }
-
   private static bool has_pref (AbstractFieldDetails details) {
-    if (get_first_string (details.get_parameter_values ("x-evolution-ui-slot")) == "1")
+    var evolution_pref = details.get_parameter_values ("x-evolution-ui-slot");
+    if (evolution_pref != null && Utils.get_first (evolution_pref) == "1")
       return true;
-    foreach (var param in details.parameters.get ("type")) {
+
+    foreach (var param in details.parameters["type"]) {
       if (param.ascii_casecmp ("PREF") == 0)
-       return true;
+        return true;
     }
     return false;
   }


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