summaryrefslogtreecommitdiff
path: root/src/contacts-contact.vala
diff options
context:
space:
mode:
authorNiels De Graef <nielsdegraef@gmail.com>2017-12-29 03:04:49 +0100
committerNiels De Graef <nielsdegraef@gmail.com>2017-12-29 03:04:49 +0100
commit0f0dffd4127a0d064b461faf3ace5619e5cb1cf2 (patch)
treee105382a024b6065b05199365a9312c2836305bd /src/contacts-contact.vala
parent210ab552af8ddf40bce1246258b58a34977890c6 (diff)
downloadgnome-contacts-0f0dffd4127a0d064b461faf3ace5619e5cb1cf2.tar.gz
ContactsContact: return early in calc_is_main()
Don't do work if it's not necessary.
Diffstat (limited to 'src/contacts-contact.vala')
-rw-r--r--src/contacts-contact.vala15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index e921b47..aafc14c 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -140,20 +140,15 @@ public class Contacts.Contact : GLib.Object {
return false;
// Mark google contacts not in "My Contacts" as non-main
- if (persona_is_google_other (persona)) {
- return false;
- }
-
- return true;
+ return !persona_is_google_other (persona);
}
private bool calc_is_main () {
- var res = false;
- foreach (var p in individual.personas) {
+ foreach (var p in this.individual.personas)
if (persona_is_main (p))
- res = true;
- }
- return res;
+ return true;
+
+ return false;
}
public Contact (Store store, Individual i) {