1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-10 14:13:23 +00:00

(gtk) plug a minor leak in the Statistics dialog.

This commit is contained in:
Charles Kerr 2008-03-08 16:10:13 +00:00
parent 6ef6ac0928
commit ea7cca30d2
4 changed files with 15 additions and 5 deletions

View file

@ -1253,7 +1253,7 @@ torrent_inspector_new ( GtkWindow * parent, TrTorrent * gtor )
gtk_notebook_append_page (GTK_NOTEBOOK(n), gtk_notebook_append_page (GTK_NOTEBOOK(n),
info_page_new (tor), info_page_new (tor),
gtk_label_new (_("Info"))); gtk_label_new (_("Information")));
w = file_list_new( gtor ); w = file_list_new( gtor );
gtk_container_set_border_width( GTK_CONTAINER( w ), GUI_PAD_BIG ); gtk_container_set_border_width( GTK_CONTAINER( w ), GUI_PAD_BIG );

View file

@ -218,7 +218,7 @@ static struct {
int id; int id;
} trLevels[] = { } trLevels[] = {
{ N_("Error"), "error", "ERR", TR_MSG_ERR }, { 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 }, { N_("Debug"), "debug", "DBG", TR_MSG_DBG },
}; };

View file

@ -58,7 +58,9 @@ updateStats( gpointer gdata )
setLabel( ui->one_down_lb, tr_strlsize( buf, one.downloadedBytes, sizeof(buf) ) ); setLabel( ui->one_down_lb, tr_strlsize( buf, one.downloadedBytes, sizeof(buf) ) );
setLabel( ui->one_time_lb, tr_strltime( buf, one.secondsActive, sizeof(buf) ) ); setLabel( ui->one_time_lb, tr_strltime( buf, one.secondsActive, sizeof(buf) ) );
setLabelFromRatio( ui->one_ratio_lb, one.ratio ); 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_up_lb, tr_strlsize( buf, all.uploadedBytes, sizeof(buf) ) );
setLabel( ui->all_down_lb, tr_strlsize( buf, all.downloadedBytes, 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) ) ); setLabel( ui->all_time_lb, tr_strltime( buf, all.secondsActive, sizeof(buf) ) );

View file

@ -118,6 +118,7 @@ char*
tr_strltime( char * buf, int seconds, size_t buflen ) tr_strltime( char * buf, int seconds, size_t buflen )
{ {
int hours; int hours;
int days;
if( seconds < 0 ) if( seconds < 0 )
seconds = 0; seconds = 0;
@ -150,10 +151,17 @@ tr_strltime( char * buf, int seconds, size_t buflen )
return buf; return buf;
} }
if( hours < 24 )
{
g_snprintf( buf, buflen, ngettext( "%'d hour", "%'d hours", hours ), hours ); g_snprintf( buf, buflen, ngettext( "%'d hour", "%'d hours", hours ), hours );
return buf; return buf;
} }
days = seconds / ( 60 * 60 * 24 );
g_snprintf( buf, buflen, ngettext( "'%d day", "%'d days", days ), days );
return buf;
}
char * char *
rfc822date (guint64 epoch_msec) rfc822date (guint64 epoch_msec)