Revert back to real data on error setting property

This commit is contained in:
Alexander Larsson 2012-02-01 12:03:20 +01:00
parent 6fb1c5228c
commit c45ce1c556

View file

@ -411,13 +411,26 @@ public abstract class Contacts.FieldSet : Grid {
saving = false; saving = false;
} catch (PropertyError e1) { } catch (PropertyError e1) {
warning ("Unable to edit property '%s': %s", property_name, e1.message); warning ("Unable to edit property '%s': %s", property_name, e1.message);
refresh_from_persona ();
} catch (Error e2) { } catch (Error e2) {
warning ("Unable to create writeable persona: %s", e2.message); 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 { public abstract class Contacts.DataFieldRow : FieldRow {
@ -1408,15 +1421,7 @@ public class Contacts.PersonaSheet : Grid {
var name = pspec.get_name (); var name = pspec.get_name ();
foreach (var field_set in field_sets) { foreach (var field_set in field_sets) {
if (field_set.reads_param (name) && !field_set.saving) { if (field_set.reads_param (name) && !field_set.saving) {
field_set.clear (); field_set.refresh_from_persona ();
field_set.populate ();
if (field_set.is_empty ())
field_set.remove_from_sheet ();
else {
field_set.show_all ();
field_set.add_to_sheet ();
}
} }
} }
} }