From 8d2abc05f60cb9a5ec79db9a215fe8aa97e0c311 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 21 Dec 2012 20:00:20 -0800 Subject: Remove nickname from divecomputer data structure Having it there with the model information seemed to make sense but on second thought it's the wrong spot to keep that information, especially since we were storing it in the XML file in every single dive. This change removes the nickname member from the divecomputer and makes the rest of the code reasonably self consistent. It does not add much of the new code for the new design to handle nicknames. Signed-off-by: Dirk Hohndel --- profile.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'profile.c') diff --git a/profile.c b/profile.c index 4244b47c7..566b64fc0 100644 --- a/profile.c +++ b/profile.c @@ -1796,6 +1796,7 @@ void plot(struct graphics_context *gc, struct dive *dive, scale_mode_t scale) struct plot_info *pi; struct divecomputer *dc = &dive->dc; cairo_rectangle_t *drawing_area = &gc->drawing_area; + const char *nickname; plot_set_scale(scale); @@ -1878,10 +1879,12 @@ void plot(struct graphics_context *gc, struct dive *dive, scale_mode_t scale) cairo_stroke(gc->cr); /* Put the dive computer name in the lower left corner */ - if (dc->nickname || dc->model) { + nickname = get_dc_nickname(dc->deviceid); + if (!nickname || *nickname == '\0') + nickname = dc->model; + if (nickname) { static const text_render_options_t computer = {10, TIME_TEXT, LEFT, MIDDLE}; - plot_text(gc, &computer, 0, 1, "%s", - dc->nickname && *dc->nickname ? dc->nickname : dc->model); + plot_text(gc, &computer, 0, 1, "%s", nickname); } if (PP_GRAPHS_ENABLED) { -- cgit v1.2.3-70-g09d2