]> git.tdb.fi Git - ext/subsurface.git/commitdiff
multi-dive editing: don't change fields that weren't changed for the master dive
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Aug 2012 14:39:50 +0000 (07:39 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Aug 2012 14:39:50 +0000 (07:39 -0700)
Commit 2f773b97e042 ("multi-dive editing: don't change already set data
for other dives") didn't get the multi-dive editing quite right: even if
one of the dives in the list of changed dives has an empty field, we
should *not* fill it with the edit data unless that edit data was
actually changed.

So compare the new data with the original master data, and if they
match, do nothing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
info.c

diff --git a/info.c b/info.c
index 846d51efc29062412dfe2c5da3656961d9e49476..5a620e751694a40ea8f1569a894ed6af4af6812a 100644 (file)
--- a/info.c
+++ b/info.c
@@ -83,6 +83,9 @@ static char *get_combo_box_entry_text(GtkComboBoxEntry *combo_box, char **textp,
        new = gtk_entry_get_text(entry);
        while (isspace(*new))
                new++;
        new = gtk_entry_get_text(entry);
        while (isspace(*new))
                new++;
+       /* If the master string didn't change, don't change other dives either! */
+       if (!text_changed(master,new))
+               return NULL;
        if (!text_changed(old,new))
                return NULL;
        free(old);
        if (!text_changed(old,new))
                return NULL;
        free(old);