[gnome-contacts] Store: remove the changed signal.
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Store: remove the changed signal.
- Date: Sun, 8 Apr 2018 13:01:05 +0000 (UTC)
commit c3bfdb64172e791d63bcee161416b32c17250c1d
Author: Niels De Graef <nielsdegraef gmail com>
Date: Sun Apr 8 11:34:22 2018 +0200
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.
src/contacts-store.vala | 18 +-----------------
1 file changed, 1 insertion(+), 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));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]