[gnome-contacts] Don't leave leftover empty contacts when creating new one and not editing



commit 3cc4ff7ef7243b628c07a24c5d4c018d5e0719c0
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Aug 26 10:54:05 2011 +0200

    Don't leave leftover empty contacts when creating new one and not editing

 src/contacts-contact-pane.vala |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index c8333cc..5d54b79 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -371,6 +371,7 @@ public class Contacts.ContactPane : EventBox {
 	  }
 	});
     } else {
+      editing_persona.set_data ("contacts-unedited", null);
       editing_persona.set (property_name, detail_set);
     }
   }
@@ -1116,7 +1117,17 @@ public class Contacts.ContactPane : EventBox {
 	}
 
 	show_contact (contact);
+	persona.set_data ("contacts-unedited", true);
 	display_edit (contact, persona, true);
+
+	ulong id = 0;
+	id = this.save_data.connect ( () => {
+	    if (persona.get_data<bool> ("contacts-unedited") != false) {
+	      editing_persona.store.remove_persona.begin (editing_persona, () => {
+		});
+	    }
+	    this.disconnect (id);
+	  });
       });
 
   }



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