diff options
author | Niels De Graef <nielsdegraef@gmail.com> | 2018-04-08 11:34:22 +0200 |
---|---|---|
committer | Niels De Graef <nielsdegraef@gmail.com> | 2018-04-08 15:00:17 +0200 |
commit | c3bfdb64172e791d63bcee161416b32c17250c1d (patch) | |
tree | f9bef7960c85f070e833d07a87fabe324ed5815f | |
parent | 89e0b0fc909132aba68a40e1a0eabe4d425bc8c6 (diff) | |
download | gnome-contacts-c3bfdb64172e791d63bcee161416b32c17250c1d.tar.gz |
Store: remove the changed signal.
We only use this for the find_contact method, which on its own is only
called when the program is started. As such, the likelihood that a
contact changed between startup and at the end of searching is
negligible. Removing this also takes away some overhead in both
performance and memory usage.
-rw-r--r-- | src/contacts-store.vala | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/contacts-store.vala b/src/contacts-store.vala index 1638031..3b75a88 100644 --- a/src/contacts-store.vala +++ b/src/contacts-store.vala @@ -1,4 +1,3 @@ -/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 8 -*- */ /* * Copyright (C) 2011 Alexander Larsson <alexl@redhat.com> * @@ -21,7 +20,6 @@ using Folks; using Gee; public class Contacts.Store : GLib.Object { - public signal void changed (Contact c); public signal void added (Contact c); public signal void removed (Contact c); public signal void quiescent (); @@ -240,10 +238,6 @@ public class Contacts.Store : GLib.Object { } } - private void contact_changed_cb (Contact c) { - changed (c); - } - public delegate bool ContactMatcher (Contact c); public async Contact? find_contact (ContactMatcher matcher) { foreach (var c in contacts) { @@ -254,14 +248,8 @@ public class Contacts.Store : GLib.Object { return null; Contact? matched = null; - ulong id1, id2, id3; + ulong id2, id3; SourceFunc callback = find_contact.callback; - id1 = this.changed.connect ( (c) => { - if (matcher (c)) { - matched = c; - callback (); - } - }); id2 = this.added.connect ( (c) => { if (matcher (c)) { matched = c; @@ -272,7 +260,6 @@ public class Contacts.Store : GLib.Object { callback(); }); yield; - this.disconnect (id1); this.disconnect (id2); this.disconnect (id3); return matched; @@ -292,13 +279,10 @@ public class Contacts.Store : GLib.Object { private void add (Contact c) { contacts.add (c); - c.changed.connect (contact_changed_cb); added (c); } private void remove (Contact c) { - c.changed.disconnect (contact_changed_cb); - var i = contacts.index_of (c); if (i != contacts.size - 1) contacts.set (i, contacts.get (contacts.size - 1)); |