make tr_stat.everUploaded a tertiary sort key when sorting by progress.

This commit is contained in:
Charles Kerr 2007-10-16 14:32:16 +00:00
parent 99ddcb8f36
commit 825e1d9334
1 changed files with 8 additions and 1 deletions

View File

@ -203,19 +203,23 @@ compareProgress( GtkTreeModel * model,
GtkTreeIter * b,
gpointer user_data UNUSED )
{
int ia, ib;
gfloat rateUpA, rateUpB;
gfloat rateDownA, rateDownB;
gfloat percentDoneA, percentDoneB;
int ia, ib;
guint64 uploadedEverA, uploadedEverB;
gtk_tree_model_get( model, a, MC_PROG_D, &percentDoneA,
MC_DRATE, &rateDownA,
MC_URATE, &rateUpA,
MC_UP, &uploadedEverA,
-1 );
gtk_tree_model_get( model, b, MC_PROG_D, &percentDoneB,
MC_DRATE, &rateDownB,
MC_URATE, &rateUpB,
MC_UP, &uploadedEverB,
-1 );
ia = (int)( 100.0 * percentDoneA );
ib = (int)( 100.0 * percentDoneB );
if( ia != ib )
@ -226,6 +230,9 @@ compareProgress( GtkTreeModel * model,
if( ia != ib )
return ia - ib;
if( uploadedEverA != uploadedEverB )
return uploadedEverA < uploadedEverB ? -1 : 1;
return 0;
}