summaryrefslogtreecommitdiff
path: root/src/contacts-contact-pane.vala
diff options
context:
space:
mode:
authorNiels De Graef <nielsdegraef@gmail.com>2022-09-07 08:55:52 +0200
committerNiels De Graef <nielsdegraef@gmail.com>2022-09-08 07:16:50 +0200
commit245d8a48c51b640b292719e600610b54272cad41 (patch)
treef9991f7453a98c688fdb691949c24ded92492798 /src/contacts-contact-pane.vala
parent8bc5e78982cf682bbcb55316ed54c499b9c0f920 (diff)
downloadgnome-contacts-245d8a48c51b640b292719e600610b54272cad41.tar.gz
contact: Don't keep a reference to the store
First, we're only using the `Contacts.Store` to get to the aggregator's primary store, which we can just get from the `Folks.PersonaStore.is_primary_store` property itself. Second, this means we can make the constructor for a `Contact` a bit simpler, as we don't have to actually pass on a `Contacts.Store` reference. Third, this parameterizes `apply_changes()` so that it can choose which PersonaStore to save new details into, which is a step towards being able to configure the address book when you're editing/creating a contact.
Diffstat (limited to 'src/contacts-contact-pane.vala')
-rw-r--r--src/contacts-contact-pane.vala9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 2a16e22..486aa30 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -84,8 +84,9 @@ public class Contacts.ContactPane : Adw.Bin {
return;
}
- if (this.contact == null || this.contact.individual != individual)
- this.contact = new Contact.for_individual (individual, this.store);
+ if (this.contact == null || this.contact.individual != individual) {
+ this.contact = new Contact.for_individual (individual);
+ }
show_contact_sheet (this.contact);
}
@@ -175,7 +176,7 @@ public class Contacts.ContactPane : Adw.Bin {
}
try {
- yield contact.apply_changes ();
+ yield contact.apply_changes (this.store.aggregator.primary_store);
} catch (Error err) {
warning ("Couldn't save changes: %s", err.message);
// XXX do something better here
@@ -195,7 +196,7 @@ public class Contacts.ContactPane : Adw.Bin {
}
public void new_contact () {
- this.contact = new Contact.for_new (this.store);
+ this.contact = new Contact.empty ();
if (this.on_edit_mode)
return;