[gnome-contacts] writable store is always primary store, clean up APIs
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] writable store is always primary store, clean up APIs
- Date: Wed, 24 Aug 2011 21:04:38 +0000 (UTC)
commit 6d1fd196f404806f421ca495002fff43582df49a
Author: Alexander Larsson <alexl redhat com>
Date: Wed Aug 24 10:23:09 2011 +0200
writable store is always primary store, clean up APIs
src/contacts-contact-pane.vala | 8 ++++----
src/contacts-contact.vala | 22 +++++++++-------------
2 files changed, 13 insertions(+), 17 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index e680eec..7ad70c4 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -763,9 +763,9 @@ public class Contacts.ContactPane : EventBox {
var widgets = new HashMultiMap<Persona?, TextView>();
var main_text = add_note ();
- Persona? writable_persona = selected_contact.find_writable_persona ();
- if (writable_persona == null || writable_persona is NoteDetails)
- widgets.set (writable_persona, main_text);
+ Persona? primary_persona = selected_contact.find_primary_persona ();
+ if (primary_persona == null || primary_persona is NoteDetails)
+ widgets.set (primary_persona, main_text);
else
warning ("Writable store doesn't support notes");
@@ -776,7 +776,7 @@ public class Contacts.ContactPane : EventBox {
if (notes == null)
continue;
foreach (var note in notes.notes) {
- if (persona == writable_persona && !primary_note_seen) {
+ if (persona == primary_persona && !primary_note_seen) {
primary_note_seen = true;
update_note (main_text, note);
} else if (persona.store.is_writeable) {
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index a26a645..31eefd3 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -784,7 +784,7 @@ public class Contacts.Contact : GLib.Object {
}
public async Persona ensure_writable_persona () throws GLib.Error {
- Persona? p = find_writable_persona ();
+ Persona? p = find_primary_persona ();
if (p != null)
return p;
print ("new writable persona: %p\n", p);
@@ -792,22 +792,18 @@ public class Contacts.Contact : GLib.Object {
}
- public Persona? find_writable_persona () {
- var primary_store = store.aggregator.primary_store;
-
- foreach (var persona in individual.personas) {
- if (persona.store == primary_store)
- return persona;
- }
-
- foreach (var persona in individual.personas) {
- if (persona.store.is_writeable)
- return persona;
+ public Persona? find_persona_from_store (PersonaStore store) {
+ foreach (var p in individual.personas) {
+ if (p.store == store)
+ return p;
}
-
return null;
}
+ public Persona? find_primary_persona () {
+ return find_persona_from_store (store.aggregator.primary_store);
+ }
+
public static string format_persona_store_name (PersonaStore store) {
if (store.type_id == "eds") {
if (store.id == "system") {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]