mirror of
https://github.com/transmission/transmission
synced 2025-03-10 06:02:57 +00:00
(gtk) plug a minor leak in the Statistics dialog.
This commit is contained in:
parent
6ef6ac0928
commit
ea7cca30d2
4 changed files with 15 additions and 5 deletions
|
@ -1253,7 +1253,7 @@ torrent_inspector_new ( GtkWindow * parent, TrTorrent * gtor )
|
|||
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK(n),
|
||||
info_page_new (tor),
|
||||
gtk_label_new (_("Info")));
|
||||
gtk_label_new (_("Information")));
|
||||
|
||||
w = file_list_new( gtor );
|
||||
gtk_container_set_border_width( GTK_CONTAINER( w ), GUI_PAD_BIG );
|
||||
|
|
|
@ -218,7 +218,7 @@ static struct {
|
|||
int id;
|
||||
} trLevels[] = {
|
||||
{ N_("Error"), "error", "ERR", TR_MSG_ERR },
|
||||
{ N_("Info"), "info", "INF", TR_MSG_INF },
|
||||
{ N_("Information"), "info", "INF", TR_MSG_INF },
|
||||
{ N_("Debug"), "debug", "DBG", TR_MSG_DBG },
|
||||
};
|
||||
|
||||
|
|
|
@ -58,7 +58,9 @@ updateStats( gpointer gdata )
|
|||
setLabel( ui->one_down_lb, tr_strlsize( buf, one.downloadedBytes, sizeof(buf) ) );
|
||||
setLabel( ui->one_time_lb, tr_strltime( buf, one.secondsActive, sizeof(buf) ) );
|
||||
setLabelFromRatio( ui->one_ratio_lb, one.ratio );
|
||||
setLabel( ui->all_sessions_lb, g_strdup_printf( _("Started %d times"), (int)all.sessionCount ) );
|
||||
|
||||
g_snprintf( buf, sizeof( buf ), _( "Started %d times" ), (int)all.sessionCount );
|
||||
setLabel( ui->all_sessions_lb, buf );
|
||||
setLabel( ui->all_up_lb, tr_strlsize( buf, all.uploadedBytes, sizeof(buf) ) );
|
||||
setLabel( ui->all_down_lb, tr_strlsize( buf, all.downloadedBytes, sizeof(buf) ) );
|
||||
setLabel( ui->all_time_lb, tr_strltime( buf, all.secondsActive, sizeof(buf) ) );
|
||||
|
|
12
gtk/util.c
12
gtk/util.c
|
@ -118,6 +118,7 @@ char*
|
|||
tr_strltime( char * buf, int seconds, size_t buflen )
|
||||
{
|
||||
int hours;
|
||||
int days;
|
||||
|
||||
if( seconds < 0 )
|
||||
seconds = 0;
|
||||
|
@ -135,7 +136,7 @@ tr_strltime( char * buf, int seconds, size_t buflen )
|
|||
return buf;
|
||||
}
|
||||
|
||||
hours = seconds / ( 60 *60 );
|
||||
hours = seconds / ( 60 * 60 );
|
||||
|
||||
if( seconds < ( 60 * 60 * 4 ) )
|
||||
{
|
||||
|
@ -150,7 +151,14 @@ tr_strltime( char * buf, int seconds, size_t buflen )
|
|||
return buf;
|
||||
}
|
||||
|
||||
g_snprintf( buf, buflen, ngettext( "%'d hour", "%'d hours", hours ), hours );
|
||||
if( hours < 24 )
|
||||
{
|
||||
g_snprintf( buf, buflen, ngettext( "%'d hour", "%'d hours", hours ), hours );
|
||||
return buf;
|
||||
}
|
||||
|
||||
days = seconds / ( 60 * 60 * 24 );
|
||||
g_snprintf( buf, buflen, ngettext( "'%d day", "%'d days", days ), days );
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue