On 10.08.2016 19:23, Robert Carter wrote:
> Did you try something like?
>
> default:
>          tmp_buf = { 0 );
>       //VIK_UNITS_SPEED_KILOMETRES_PER_HOUR:
>       if ( ts.max_speed > 0 )
>               g_snprintf ( tmp_buf, sizeof(tmp_buf), _("%.2f km/h"),
> (double)VIK_MPS_TO_KPH(ts.max_speed) );
>          if (tmp_buf[0] != '\0')
>       gtk_label_set_text ( GTK_LABEL(content[cnt++]), tmp_buf );
>

I see what you are trying to do, but that's still not good, because now 
this code creates a GTK label - or not (there is "content[cnt++]" in the 
new 'if'). We would end up with N or N-1 GTK labels.

What we want is something like this:

default:
        //VIK_UNITS_SPEED_KILOMETRES_PER_HOUR:
        if ( ts.max_speed > 0 )
                g_snprintf ( tmp_buf, sizeof(tmp_buf), _("%.2f km/h"),
(double)VIK_MPS_TO_KPH(ts.max_speed) );
        else
                g_snprintf ( tmp_buf, sizeof(tmp_buf), _("---"));

        gtk_label_set_text ( GTK_LABEL(content[cnt++]), tmp_buf );

This is how it's done for other statistics items.
The whole switch statement handling speed statistics item (for different 
speed units) should be updated along these lines.

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/

Reply via email to