From dcc7b0de564a8521cbbcc4ac70c7b710ffaac97c Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sat, 20 Mar 2010 14:53:08 +0000 Subject: [PATCH] (trunk gtk) tinker with compact mode a little bit --- gtk/torrent-cell-renderer.c | 21 +++++++++++---------- gtk/util.c | 12 +++++++++++- gtk/util.h | 9 +++++++++ 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/gtk/torrent-cell-renderer.c b/gtk/torrent-cell-renderer.c index c21bbd4c1..e296e0e73 100644 --- a/gtk/torrent-cell-renderer.c +++ b/gtk/torrent-cell-renderer.c @@ -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 ) ); diff --git a/gtk/util.c b/gtk/util.c index 79a38ff96..f867405ba 100644 --- a/gtk/util.c +++ b/gtk/util.c @@ -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 diff --git a/gtk/util.h b/gtk/util.h index 157a49c5f..ee2609d66 100644 --- a/gtk/util.h +++ b/gtk/util.h @@ -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 ); -- 2.40.0