[gnome-contacts/new-design] Avoid saving changes when exiting edit more if nothing changed
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts/new-design] Avoid saving changes when exiting edit more if nothing changed
- Date: Thu, 15 Dec 2011 09:38:41 +0000 (UTC)
commit 03aac95b23de8c6c8ab8734daeb859f615bcd9ea
Author: Alexander Larsson <alexl redhat com>
Date: Tue Dec 13 22:29:10 2011 +0100
Avoid saving changes when exiting edit more if nothing changed
src/contacts-contact-pane.vala | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 20b6aab..b48769b 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -673,7 +673,8 @@ public abstract class Contacts.DataFieldRow : FieldRow {
public abstract void update ();
public virtual void pack_edit_widgets () {
}
- public virtual void finish_edit_widgets (bool save) {
+ public virtual bool finish_edit_widgets (bool save) {
+ return false;
}
public void enter_edit_mode () {
@@ -698,7 +699,7 @@ public abstract class Contacts.DataFieldRow : FieldRow {
}
public void exit_edit_mode (bool save) {
- finish_edit_widgets (save);
+ var changed = finish_edit_widgets (save);
foreach (var w in this.get_children ()) {
if (!w.get_data<bool> ("original-widget"))
@@ -709,7 +710,7 @@ public abstract class Contacts.DataFieldRow : FieldRow {
this.show_all ();
this.set_can_focus (true);
- if (save)
+ if (save && changed)
field_set.save ();
}
}
@@ -748,11 +749,13 @@ class Contacts.LinkFieldRow : DataFieldRow {
});
}
- public override void finish_edit_widgets (bool save) {
+ public override bool finish_edit_widgets (bool save) {
var old_details = details;
- if (save)
+ var changed = entry.get_text () != details.value;
+ if (save && changed)
details = new UrlFieldDetails (entry.get_text (), old_details.parameters);
entry = null;
+ return changed;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]