diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2012-12-12 20:26:29 -1000 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-12-13 21:33:30 -1000 |
commit | 713a4fcff6a580aab4a5036a5c3603ebce7ee830 (patch) | |
tree | b47b4bd29cc692b1dfaa6890d108b422d1066ffa /profile.c | |
parent | aba65736eb8cb85fa9bfa953095eab21f0668904 (diff) | |
download | subsurface-713a4fcff6a580aab4a5036a5c3603ebce7ee830.tar.gz |
Add the ability to set a nickname for a dive computer
We maintain a list of dive computers that we know about (by deviceid) and
their nicknames in our config. If the user downloads dive from a dive
computer that we haven't seen before, we give them the option to set a
nickname for that dive computer. That nickname is displayed in the profile
(and stored in the XML file, assuming it is not the same as the model).
This implementation attempts to make sure that it correctly deals with
utf8 nicknames.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r-- | profile.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1857,9 +1857,10 @@ 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->model) { + if (dc->nickname || dc->model) { static const text_render_options_t computer = {10, TIME_TEXT, LEFT, MIDDLE}; - plot_text(gc, &computer, 0, 1, "%s", dc->model); + plot_text(gc, &computer, 0, 1, "%s", + dc->nickname && *dc->nickname ? dc->nickname : dc->model); } if (PP_GRAPHS_ENABLED) { |