summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-30 20:27:01 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-30 20:27:01 -0800
commitdf0ea072920668de4517ad85c742c7169bd24f22 (patch)
tree27d5a5bfa96fb7bc7155b5dea988e048ae0ad27e /gtk-gui.c
parent96db56f89c76ffc2ede8605f4b0febb0c2261c5a (diff)
downloadsubsurface-df0ea072920668de4517ad85c742c7169bd24f22.tar.gz
Fix nickname saving in XML file to deal with utf8 characters
This makes the whole code much cleaner and simpler. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 60a1f18d3..a6ed46942 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -44,6 +44,7 @@ struct dcnicknamelist {
const char *model;
uint32_t deviceid;
struct dcnicknamelist *next;
+ gboolean saved;
};
static struct dcnicknamelist *nicknamelist;
char *nicknamestring;
@@ -2078,6 +2079,29 @@ const char *get_dc_nickname(const char *model, uint32_t deviceid)
return NULL;
}
+gboolean dc_was_saved(struct divecomputer *dc)
+{
+ struct dcnicknamelist *nn_entry = get_dc_nicknameentry(dc->model, dc->deviceid);
+ return nn_entry && nn_entry->saved;
+}
+
+void mark_dc_saved(struct divecomputer *dc)
+{
+ struct dcnicknamelist *nn_entry = get_dc_nicknameentry(dc->model, dc->deviceid);
+ if (nn_entry)
+ nn_entry->saved = TRUE;
+}
+
+void clear_dc_saved_status()
+{
+ struct dcnicknamelist *nn_entry = nicknamelist;
+
+ while (nn_entry) {
+ nn_entry->saved = FALSE;
+ nn_entry = nn_entry->next;
+ }
+}
+
/* do we have a DIFFERENT divecomputer of the same model? */
static struct dcnicknamelist *get_different_dc_nicknameentry(const char *model, int deviceid)
{