[folks] eds: Check property values have changed before committing them to EDS
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] eds: Check property values have changed before committing them to EDS
- Date: Thu, 14 Feb 2013 17:40:47 +0000 (UTC)
commit fcc7bc4421bf6071061acca427faf0ae4c63c91b
Author: Philip Withnall <philip tecnocode co uk>
Date: Tue Feb 12 00:39:32 2013 +0000
eds: Check property values have changed before committing them to EDS
This prevents timeouts when waiting for EDS to notify us of property changes,
since it wonât notify for non-changed properties. It also saves a D-Bus round
trip in the case the folks property setter is called with an unchanged value.
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=692951
NEWS | 2 +
backends/eds/lib/edsf-persona-store.vala | 32 ++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index a84dfa9..1518d83 100644
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,8 @@ Bugs fixed:
â Bug 692122 â build: Don't use make functions for defining TESTS
â Bug 693435 â eds test: create-remove-stores fails sporadically
â Bug 673918 â Port to newer libgee
+â Bug 692951 â Detail saving times out if the data sent is the same as the one
+ already in EDS
API changes:
â Add Backend.enable_persona_store and disable_persona_store.
diff --git a/backends/eds/lib/edsf-persona-store.vala b/backends/eds/lib/edsf-persona-store.vala
index c4652c4..9cef837 100644
--- a/backends/eds/lib/edsf-persona-store.vala
+++ b/backends/eds/lib/edsf-persona-store.vala
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 Collabora Ltd.
+ * Copyright (C) 2013 Philip Withnall
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -1553,6 +1554,9 @@ public class Edsf.PersonaStore : Folks.PersonaStore
_("Local IDs are not writeable on this contact."));
}
+ if (Folks.Internal.equal_sets<string> (local_ids, persona.local_ids))
+ return;
+
this._set_contact_local_ids (persona.contact, local_ids);
yield this._commit_modified_property (persona, "local-ids");
}
@@ -1579,6 +1583,9 @@ public class Edsf.PersonaStore : Folks.PersonaStore
_("The contact cannot be marked as favourite."));
}
+ if (is_favourite == persona.is_favourite)
+ return;
+
this._set_contact_is_favourite (persona.contact, is_favourite);
/* If this is a Google Contacts address book, change the user's membership
* of the âStarred in Androidâ group accordingly. See: bgo#661490. */
@@ -1659,6 +1666,10 @@ public class Edsf.PersonaStore : Folks.PersonaStore
_("E-mail addresses are not writeable on this contact."));
}
+ if (Folks.Internal.equal_sets<EmailFieldDetails> (emails,
+ persona.email_addresses))
+ return;
+
this._set_contact_attributes_string (persona.contact, emails,
"EMAIL", E.ContactField.EMAIL);
yield this._commit_modified_property (persona, "email-addresses");
@@ -1673,6 +1684,10 @@ public class Edsf.PersonaStore : Folks.PersonaStore
_("Phone numbers are not writeable on this contact."));
}
+ if (Folks.Internal.equal_sets<PhoneFieldDetails> (phones,
+ persona.phone_numbers))
+ return;
+
this._set_contact_attributes_string (persona.contact, phones, "TEL",
E.ContactField.TEL);
yield this._commit_modified_property (persona, "phone-numbers");
@@ -1687,6 +1702,10 @@ public class Edsf.PersonaStore : Folks.PersonaStore
_("Postal addresses are not writeable on this contact."));
}
+ if (Folks.Internal.equal_sets<PostalAddressFieldDetails> (postal_fds,
+ persona.postal_addresses))
+ return;
+
this._set_contact_postal_addresses (persona.contact, postal_fds);
yield this._commit_modified_property (persona, "postal-addresses");
}
@@ -1798,6 +1817,9 @@ public class Edsf.PersonaStore : Folks.PersonaStore
_("Notes are not writeable on this contact."));
}
+ if (Folks.Internal.equal_sets<NoteFieldDetails> (notes, persona.notes))
+ return;
+
this._set_contact_notes (persona.contact, notes);
yield this._commit_modified_property (persona, "notes");
}
@@ -2061,6 +2083,9 @@ public class Edsf.PersonaStore : Folks.PersonaStore
_("Groups are not writeable on this contact."));
}
+ if (Folks.Internal.equal_sets<string> (groups, persona.groups))
+ return;
+
this._set_contact_groups (persona.contact, groups, persona.is_favourite);
yield this._commit_modified_property (persona, "groups");
}
@@ -2073,6 +2098,10 @@ public class Edsf.PersonaStore : Folks.PersonaStore
throw new PropertyError.NOT_WRITEABLE (_("My Contacts is only available for Google Contacts"));
}
+ if (Folks.Internal.equal_sets<string> (system_groups,
+ persona.system_groups))
+ return;
+
this._set_contact_system_groups (persona.contact, system_groups);
yield this._commit_modified_property (persona, "system-groups");
}
@@ -2140,6 +2169,9 @@ public class Edsf.PersonaStore : Folks.PersonaStore
_("Gender is not writeable on this contact."));
}
+ if (gender == persona.gender)
+ return;
+
this._set_contact_gender (persona.contact, gender);
yield this._commit_modified_property (persona, "gender");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]