(gtk) #692: estimated time should be shown in the GUI

This commit is contained in:
Charles Kerr 2008-02-09 16:05:29 +00:00
parent 0df97ab3b5
commit 97ecb5603f
1 changed files with 17 additions and 0 deletions

View File

@ -100,6 +100,23 @@ getProgressString( const tr_info * info, const tr_stat * torStat )
tr_strlsize( buf2, torStat->uploadedEver, sizeof(buf2) ),
tr_strlratio( buf3, torStat->ratio, sizeof( buf3 ) ) );
// add time when downloading
if( torStat->status == TR_STATUS_DOWNLOAD )
{
const int eta = torStat->eta;
GString * gstr = g_string_new( str );
g_string_append( gstr, " - " );
if( eta < 0 )
g_string_append( gstr, _( "Stalled" ) );
else {
char timestr[128];
tr_strltime( timestr, eta, sizeof( timestr ) );
g_string_append_printf( gstr, _( "%s remaining" ), timestr );
}
g_free( str );
str = g_string_free( gstr, FALSE );
}
return str;
}