1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-20 21:26:53 +00:00

(trunk gtk) tinker with compact mode a little bit

This commit is contained in:
Charles Kerr 2010-03-20 14:53:08 +00:00
parent 1ef87cdb54
commit dcc7b0de56
3 changed files with 31 additions and 11 deletions

View file

@ -147,17 +147,18 @@ getShortTransferString( const tr_torrent * tor,
tr_strlspeed( upStr, uploadSpeed, sizeof( upStr ) );
if( haveDown && haveUp )
/* Translators: "speed|" is here for disambiguation.
* Please remove it from your translation.
* %1$s is the download speed
%2$s is the upload speed */
g_snprintf( buf, buflen, Q_( "speed|Down: %1$s, Up: %2$s" ), downStr, upStr );
/* 1==down speed, 2==down arrow, 3==up speed, 4==down arrow */
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 )
/* download speed */
g_snprintf( buf, buflen, _( "Down: %s" ), downStr );
/* bandwidth speed + unicode arrow */
g_snprintf( buf, buflen, _( "%1$s %2$s" ),
gtr_get_unicode_string( GTR_UNICODE_DOWN ), downStr );
else if( haveUp )
/* upload speed */
g_snprintf( buf, buflen, _( "Up: %s" ), upStr );
/* bandwidth speed + unicode arrow */
g_snprintf( buf, buflen, _( "%1$s %2$s" ),
gtr_get_unicode_string( GTR_UNICODE_UP ), upStr );
else if( tr_torrentHasMetadata( tor ) )
/* the torrent isn't uploading or downloading */
g_strlcpy( buf, _( "Idle" ), buflen );
@ -198,7 +199,7 @@ getShortStatusString( const tr_torrent * tor,
if( torStat->activity != TR_STATUS_DOWNLOAD )
{
tr_strlratio( buf, torStat->ratio, sizeof( buf ) );
g_string_append_printf( gstr, _( "Ratio: %s" ), buf );
g_string_append_printf( gstr, _( "Ratio %s" ), buf );
g_string_append( gstr, ", " );
}
getShortTransferString( tor, torStat, uploadSpeed, downloadSpeed, buf, sizeof( buf ) );

View file

@ -88,11 +88,21 @@ gtr_lockfile( const char * filename )
****
***/
const char*
gtr_get_unicode_string( int i )
{
switch( i ) {
case GTR_UNICODE_UP: return "\xE2\x86\x91";
case GTR_UNICODE_DOWN: return "\xE2\x86\x93";
case GTR_UNICODE_INF: return "\xE2\x88\x9E";
default: return "err";
}
}
char*
tr_strlratio( char * buf, double ratio, size_t buflen )
{
return tr_strratio( buf, buflen, ratio, "\xE2\x88\x9E" );
return tr_strratio( buf, buflen, ratio, gtr_get_unicode_string( GTR_UNICODE_INF ) );
}
#define KILOBYTE_FACTOR 1024.0

View file

@ -21,6 +21,15 @@
#define UNUSED G_GNUC_UNUSED
#endif
enum
{
GTR_UNICODE_UP,
GTR_UNICODE_DOWN,
GTR_UNICODE_INF
};
const char * gtr_get_unicode_string( int );
/* return a human-readable string for the size given in bytes. */
char* tr_strlsize( char * buf, guint64 size, size_t buflen );