summaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-21 20:00:20 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-21 20:58:47 -0800
commit8d2abc05f60cb9a5ec79db9a215fe8aa97e0c311 (patch)
tree1a3d4fe6f9abc3206cdf8a115edb954842e64e29 /profile.c
parenteb3e879030b0a29cc3f40d8df3e3eb6f7120c9ea (diff)
downloadsubsurface-8d2abc05f60cb9a5ec79db9a215fe8aa97e0c311.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c9
1 files changed, 6 insertions, 3 deletions
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) {