diff options
author | Alexander Larsson <alexl@redhat.com> | 2012-02-01 12:03:20 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2012-02-01 12:03:20 +0100 |
commit | c45ce1c5567f95e9cb752b587c81b8284c33408f (patch) | |
tree | 912a646723a16f0b34b2db195d67e9bf0ed71db5 /src | |
parent | 6fb1c5228c72857b91235b91c56adcfecb15d44a (diff) | |
download | gnome-contacts-c45ce1c5567f95e9cb752b587c81b8284c33408f.tar.gz |
Revert back to real data on error setting property
Diffstat (limited to 'src')
-rw-r--r-- | src/contacts-contact-pane.vala | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala index 88b099a..31f399a 100644 --- a/src/contacts-contact-pane.vala +++ b/src/contacts-contact-pane.vala @@ -411,13 +411,26 @@ public abstract class Contacts.FieldSet : Grid { saving = false; } catch (PropertyError e1) { warning ("Unable to edit property '%s': %s", property_name, e1.message); + refresh_from_persona (); } catch (Error e2) { warning ("Unable to create writeable persona: %s", e2.message); + refresh_from_persona (); } - }); } } + + public void refresh_from_persona () { + this.clear (); + this.populate (); + + if (this.is_empty ()) + this.remove_from_sheet (); + else { + this.show_all (); + this.add_to_sheet (); + } + } } public abstract class Contacts.DataFieldRow : FieldRow { @@ -1408,15 +1421,7 @@ public class Contacts.PersonaSheet : Grid { var name = pspec.get_name (); foreach (var field_set in field_sets) { if (field_set.reads_param (name) && !field_set.saving) { - field_set.clear (); - field_set.populate (); - - if (field_set.is_empty ()) - field_set.remove_from_sheet (); - else { - field_set.show_all (); - field_set.add_to_sheet (); - } + field_set.refresh_from_persona (); } } } |