summaryrefslogtreecommitdiff
path: root/src/contacts-contact-pane.vala
diff options
context:
space:
mode:
authorErick Pérez Castellanos <erick.red@gmail.com>2014-06-07 09:35:36 -0400
committerErick Pérez Castellanos <erick.red@gmail.com>2014-06-07 09:35:36 -0400
commit07c015655bfbb9656b5df5bc0472ab68b32cc61a (patch)
tree44c76657551cbd9e9ebfb57f4aa8c1b25fd77820 /src/contacts-contact-pane.vala
parentcbb437071eb3192b8a2e08ee57a948ea061e6a73 (diff)
downloadgnome-contacts-07c015655bfbb9656b5df5bc0472ab68b32cc61a.tar.gz
edit-mode: added [Cancel] button
build: moved a bunch of constraints to use gproperty bindings
Diffstat (limited to 'src/contacts-contact-pane.vala')
-rw-r--r--src/contacts-contact-pane.vala54
1 files changed, 28 insertions, 26 deletions
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 01ae08f..8dd633e 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -425,7 +425,7 @@ public class Contacts.ContactPane : Notebook {
set_current_page (0);
}
- public void set_edit_mode (bool on_edit) {
+ public void set_edit_mode (bool on_edit, bool drop_changes = false) {
if (on_edit == on_edit_mode)
return;
@@ -450,31 +450,33 @@ public class Contacts.ContactPane : Notebook {
} else {
on_edit_mode = false;
/* saving changes */
- foreach (var prop in editor.properties_changed ().entries) {
- Contact.set_persona_property.begin (prop.value.persona, prop.key, prop.value.value,
- (obj, result) => {
- try {
- Contact.set_persona_property.end (result);
- } catch (Error e2) {
- App.app.show_message (e2.message);
- update_sheet ();
- }
- });
- }
-
- if (editor.name_changed ()) {
- var v = editor.get_full_name_value ();
- Contact.set_individual_property.begin (contact,
- "full-name", v,
- (obj, result) => {
- try {
- Contact.set_individual_property.end (result);
- } catch (Error e) {
- App.app.show_message (e.message);
- /* FIXME: add this back */
- /* l.set_markup (Markup.printf_escaped ("<span font='16'>%s</span>", contact.display_name)); */
- }
- });
+ if (!drop_changes) {
+ foreach (var prop in editor.properties_changed ().entries) {
+ Contact.set_persona_property.begin (prop.value.persona, prop.key, prop.value.value,
+ (obj, result) => {
+ try {
+ Contact.set_persona_property.end (result);
+ } catch (Error e2) {
+ App.app.show_message (e2.message);
+ update_sheet ();
+ }
+ });
+ }
+
+ if (editor.name_changed ()) {
+ var v = editor.get_full_name_value ();
+ Contact.set_individual_property.begin (contact,
+ "full-name", v,
+ (obj, result) => {
+ try {
+ Contact.set_individual_property.end (result);
+ } catch (Error e) {
+ App.app.show_message (e.message);
+ /* FIXME: add this back */
+ /* l.set_markup (Markup.printf_escaped ("<span font='16'>%s</span>", contact.display_name)); */
+ }
+ });
+ }
}
editor.clear ();