[gnome-contacts] Use a bool on Contact to detect unedited new contacts
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Use a bool on Contact to detect unedited new contacts
- Date: Wed, 31 Aug 2011 10:16:34 +0000 (UTC)
commit 9dc9f8e25f3295e5cc7d625ac9d666d67b1d4579
Author: Alexander Larsson <alexl redhat com>
Date: Wed Aug 31 11:06:32 2011 +0200
Use a bool on Contact to detect unedited new contacts
This seems cleaner and means we don't have to keep track of
a specific persona that is edited or not.
src/contacts-contact-pane.vala | 5 +++--
src/contacts-contact.vala | 1 +
2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index ed6ec43..06c6a46 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -481,6 +481,7 @@ public class Contacts.ContactPane : Grid {
private async Persona? set_persona_property (Persona persona,
string property_name,
Value value) throws GLib.Error {
+ selected_contact.is_unedited = false;
if (persona is FakePersona) {
var fake = persona as FakePersona;
return yield fake.make_real_and_set (property_name, value);
@@ -1400,13 +1401,13 @@ public class Contacts.ContactPane : Grid {
show_contact (contact);
contact.is_new = true;
- persona.set_data ("contacts-unedited", true);
+ contact.is_unedited = true;
display_edit (contact, persona, true);
list_pane.select_contact (contact, true);
ulong id = 0;
id = this.save_data.connect ( () => {
- if (persona.get_data<bool> ("contacts-unedited") != false) {
+ if (contact.is_unedited) {
editing_persona.store.remove_persona.begin (editing_persona, () => {
});
}
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index c04567b..01a68b5 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -112,6 +112,7 @@ public class Contacts.Contact : GLib.Object {
public string presence_message;
public bool is_phone;
public bool is_new;
+ public bool is_unedited;
struct ContactDataRef {
void *key;
void *data;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]