[gnome-contacts] contacts: Pass store as parameter to create_primary_persona_from_store



commit d891e08ff4e6eaae70012b44cf121a6bb7641ce3
Author: Florian MÃllner <fmuellner gnome org>
Date:   Tue Jun 26 23:12:11 2012 +0200

    contacts: Pass store as parameter to create_primary_persona_from_store
    
    Contact currently references App in a couple of places, which
    means the class depends on pretty much any other class. In order
    to reuse the Contact class in the shell search provider (which will
    be a separate executable), reduce the Contact class' dependencies.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679002

 src/contacts-contact.vala            |    5 ++---
 src/contacts-linking.vala            |    2 +-
 src/contacts-new-contact-dialog.vala |    2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index e821888..36cf1e0 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -1267,9 +1267,8 @@ public class Contacts.Contact : GLib.Object  {
     return null;
   }
 
-  public static async Persona? create_primary_persona_for_details (HashTable<string, Value?> details) throws GLib.Error {
-    var primary_store = App.app.contacts_store.aggregator.primary_store;
-    var p = yield primary_store.add_persona_from_details (details);
+  public static async Persona? create_primary_persona_for_details (Folks.PersonaStore store, HashTable<string, Value?> details) throws GLib.Error {
+    var p = yield store.add_persona_from_details (details);
     if (p != null && persona_is_google (p)) {
       var g = p as GroupDetails;
       yield g.change_group (eds_personal_google_group_name (), true);
diff --git a/src/contacts-linking.vala b/src/contacts-linking.vala
index e2bf76b..1f2ce09 100644
--- a/src/contacts-linking.vala
+++ b/src/contacts-linking.vala
@@ -584,7 +584,7 @@ namespace Contacts {
 	var v = Value (typeof (string));
 	v.set_string (main.display_name);
 	details.set ("full-name", v);
-	write_persona = yield Contact.create_primary_persona_for_details (details);
+	write_persona = yield Contact.create_primary_persona_for_details (App.app.contacts_store.aggregator.primary_store, details);
 	operation.added_persona (write_persona);
 	linkables = main_linkables;
 	if (other_linkables != null)
diff --git a/src/contacts-new-contact-dialog.vala b/src/contacts-new-contact-dialog.vala
index 90ca42d..816c863 100644
--- a/src/contacts-new-contact-dialog.vala
+++ b/src/contacts-new-contact-dialog.vala
@@ -325,7 +325,7 @@ public class Contacts.NewContactDialog : Dialog {
       return;
     }
 
-    Contact.create_primary_persona_for_details.begin (details, (obj, res) => {
+    Contact.create_primary_persona_for_details.begin (App.app.contacts_store.aggregator.primary_store, details, (obj, res) => {
 	Persona? persona = null;
 	Dialog dialog = null;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]