]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Show dive number (if it exists) in the location note
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 11 Sep 2011 18:54:55 +0000 (11:54 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 11 Sep 2011 18:54:55 +0000 (11:54 -0700)
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
info.c

diff --git a/info.c b/info.c
index 9cb048b808fbba20b8ed5b1daa0bfc4a700abaa8..32b830dd883d0b346728e0bcea97e4afd444b103 100644 (file)
--- a/info.c
+++ b/info.c
@@ -51,6 +51,7 @@ void show_dive_info(struct dive *dive)
        struct tm *tm;
        char buffer[80];
        char *text;
+       int len;
 
        if (!dive) {
                gtk_label_set_text(GTK_LABEL(divedate), "no dive");
@@ -115,7 +116,12 @@ void show_dive_info(struct dive *dive)
 
        text = dive->location ? : "";
        gtk_entry_set_text(location, text);
-       gtk_label_set_text(GTK_LABEL(locationnote), text);
+
+       len = 0;
+       if (dive->nr)
+               len = snprintf(buffer, sizeof(buffer), "%d. ", dive->nr);
+       snprintf(buffer+len, sizeof(buffer)-len, "%s", text);
+       gtk_label_set_text(GTK_LABEL(locationnote), buffer);
 
        text = dive->notes ? : "";
        gtk_text_buffer_set_text(notes, text, -1);