]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Don't print a total weight of 0 in the weight column
authorDirk Hohndel <dirk@hohndel.org>
Fri, 10 Aug 2012 20:43:16 +0000 (13:43 -0700)
committerDirk Hohndel <dirk@hohndel.org>
Fri, 10 Aug 2012 20:43:16 +0000 (13:43 -0700)
For consistency with the rest of the dive_list we should interpret "no
weight systems recorded" as "no information" and therefore print nothing
instead of printing a total weight of "0" for these dives.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
divelist.c

index ce61d20d16d75fd835a8f0777bd2685dac998763..1d31da5676311c3e4eb0e126303a3d4a1e137c08 100644 (file)
@@ -294,7 +294,10 @@ static void weight_data_func(GtkTreeViewColumn *col,
        gtk_tree_model_get(model, iter, DIVE_INDEX, &indx, -1);
        dive = get_dive(indx);
        value = get_weight_units(total_weight(dive), &decimals, NULL);
-       snprintf(buffer, sizeof(buffer), "%.*f", decimals, value);
+       if (value == 0.0)
+               *buffer = '\0';
+       else
+               snprintf(buffer, sizeof(buffer), "%.*f", decimals, value);
 
        g_object_set(renderer, "text", buffer, NULL);
 }