mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Save all dive computer nicknames - whether used or not
We used to save dive computer information only if that dive computer was actually used in any of the dives we saved. But we can simplify the code if we just always save any dive computers we know about. And it does allow for some usage cases where you have nicknames for other peoples computers that you may not actively use, but you want to see if you end up loading multiple XML files in one go. So there's just no compelling reason to not just save all the info we have. And this will make it less painful to remove the "use system config for dive computer nicknames", because you can also use this to continue to gather dive computer info in a separate XML file if you want to. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
9acb52b9ee
commit
52050fdc92
5 changed files with 15 additions and 47 deletions
15
gtk-gui.c
15
gtk-gui.c
|
|
@ -1161,7 +1161,6 @@ static void cell_edited_cb(GtkCellRendererText *cell, gchar *path,
|
|||
holdnicknames->firmware = NULL;
|
||||
holdnicknames->nickname = strdup(new_text);
|
||||
holdnicknames->next = NULL;
|
||||
holdnicknames->saved = FALSE;
|
||||
} else {
|
||||
struct device_info * top = NULL;
|
||||
struct device_info * last = holdnicknames;
|
||||
|
|
@ -1172,7 +1171,6 @@ static void cell_edited_cb(GtkCellRendererText *cell, gchar *path,
|
|||
top->firmware = NULL;
|
||||
top->nickname = strdup(new_text);
|
||||
top->next = last;
|
||||
top->saved = FALSE;
|
||||
holdnicknames = top;
|
||||
}
|
||||
}
|
||||
|
|
@ -1921,19 +1919,6 @@ const char *get_dc_nickname(const char *model, uint32_t deviceid)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
gboolean dc_was_saved(struct divecomputer *dc)
|
||||
{
|
||||
struct device_info *nn_entry = get_device_info(dc->model, dc->deviceid);
|
||||
return nn_entry && nn_entry->saved;
|
||||
}
|
||||
|
||||
void mark_dc_saved(struct divecomputer *dc)
|
||||
{
|
||||
struct device_info *nn_entry = get_device_info(dc->model, dc->deviceid);
|
||||
if (nn_entry)
|
||||
nn_entry->saved = TRUE;
|
||||
}
|
||||
|
||||
/* no curly braces or commas, please */
|
||||
static char *cleanedup_nickname(const char *nickname, int len)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue