static char*
getShortTransferString (const tr_torrent  * tor,
                        const tr_stat     * st,
                        double              uploadSpeed_KBps,
                        double              downloadSpeed_KBps,
                        char              * buf,
                        size_t              buflen)
{
  const int haveMeta = tr_torrentHasMetadata (tor);
  const int haveUp = haveMeta && st->peersGettingFromUs > 0;
  const int haveDown = haveMeta && ((st->peersSendingToUs > 0) || (st->webseedsSendingToUs > 0));


  if (haveDown)
    {
      char dnStr[32], upStr[32];
      tr_formatter_speed_KBps (dnStr, downloadSpeed_KBps, sizeof (dnStr));
      tr_formatter_speed_KBps (upStr, uploadSpeed_KBps, sizeof (upStr));

      /* down speed, down symbol, up speed, up symbol */
      g_snprintf (buf, buflen, _("%1$s %2$s  %3$s %4$s"),
                  dnStr,
                  gtr_get_unicode_string (GTR_UNICODE_DOWN),
                  upStr,
                  gtr_get_unicode_string (GTR_UNICODE_UP));
    }
  else if (haveUp)
    {
      char upStr[32];
      tr_formatter_speed_KBps (upStr, uploadSpeed_KBps, sizeof (upStr));

      /* up speed, up symbol */
      g_snprintf (buf, buflen, _("%1$s  %2$s"),
                  upStr,
                  gtr_get_unicode_string (GTR_UNICODE_UP));
    }
  else if (st->isStalled)
    {
      g_strlcpy (buf, _("Stalled"), buflen);
    }
  else
    {
      *buf = '\0';
    }

  return buf;
}
static char*
getShortTransferString( const tr_torrent  * tor,
                        const tr_stat     * st,
                        double              uploadSpeed_KBps,
                        double              downloadSpeed_KBps,
                        char              * buf,
                        size_t              buflen )
{
    char downStr[32], upStr[32];
    const int haveMeta = tr_torrentHasMetadata( tor );
    const int haveUp = haveMeta && st->peersGettingFromUs > 0;
    const int haveDown = haveMeta && ( ( st->peersSendingToUs > 0 ) || ( st->webseedsSendingToUs > 0 ) );

    if( haveDown )
        tr_formatter_speed_KBps( downStr, downloadSpeed_KBps, sizeof( downStr ) );
    if( haveUp )
        tr_formatter_speed_KBps( upStr, uploadSpeed_KBps, sizeof( upStr ) );

    if( haveDown && haveUp )
        /* 1==down arrow, 2==down speed, 3==up arrow, 4==down speed */
        g_snprintf( buf, buflen, _( "%1$s %2$s, %3$s %4$s" ),
                    gtr_get_unicode_string( GTR_UNICODE_DOWN ), downStr,
                    gtr_get_unicode_string( GTR_UNICODE_UP ), upStr );
    else if( haveDown )
        /* bandwidth speed + unicode arrow */
        g_snprintf( buf, buflen, _( "%1$s %2$s" ),
                    gtr_get_unicode_string( GTR_UNICODE_DOWN ), downStr );
    else if( haveUp )
        /* bandwidth speed + unicode arrow */
        g_snprintf( buf, buflen, _( "%1$s %2$s" ),
                    gtr_get_unicode_string( GTR_UNICODE_UP ), upStr );
    else if( st->isStalled )
        g_strlcpy( buf, _( "Stalled" ), buflen );
    else if( haveMeta )
        g_strlcpy( buf, _( "Idle" ), buflen );
    else
        *buf = '\0';

    return buf;
}