make tr_stat.everUploaded a tertiary sort key when sorting by progress.
This commit is contained in:
parent
99ddcb8f36
commit
825e1d9334
|
@ -203,19 +203,23 @@ compareProgress( GtkTreeModel * model,
|
||||||
GtkTreeIter * b,
|
GtkTreeIter * b,
|
||||||
gpointer user_data UNUSED )
|
gpointer user_data UNUSED )
|
||||||
{
|
{
|
||||||
|
int ia, ib;
|
||||||
gfloat rateUpA, rateUpB;
|
gfloat rateUpA, rateUpB;
|
||||||
gfloat rateDownA, rateDownB;
|
gfloat rateDownA, rateDownB;
|
||||||
gfloat percentDoneA, percentDoneB;
|
gfloat percentDoneA, percentDoneB;
|
||||||
int ia, ib;
|
guint64 uploadedEverA, uploadedEverB;
|
||||||
|
|
||||||
gtk_tree_model_get( model, a, MC_PROG_D, &percentDoneA,
|
gtk_tree_model_get( model, a, MC_PROG_D, &percentDoneA,
|
||||||
MC_DRATE, &rateDownA,
|
MC_DRATE, &rateDownA,
|
||||||
MC_URATE, &rateUpA,
|
MC_URATE, &rateUpA,
|
||||||
|
MC_UP, &uploadedEverA,
|
||||||
-1 );
|
-1 );
|
||||||
gtk_tree_model_get( model, b, MC_PROG_D, &percentDoneB,
|
gtk_tree_model_get( model, b, MC_PROG_D, &percentDoneB,
|
||||||
MC_DRATE, &rateDownB,
|
MC_DRATE, &rateDownB,
|
||||||
MC_URATE, &rateUpB,
|
MC_URATE, &rateUpB,
|
||||||
|
MC_UP, &uploadedEverB,
|
||||||
-1 );
|
-1 );
|
||||||
|
|
||||||
ia = (int)( 100.0 * percentDoneA );
|
ia = (int)( 100.0 * percentDoneA );
|
||||||
ib = (int)( 100.0 * percentDoneB );
|
ib = (int)( 100.0 * percentDoneB );
|
||||||
if( ia != ib )
|
if( ia != ib )
|
||||||
|
@ -226,6 +230,9 @@ compareProgress( GtkTreeModel * model,
|
||||||
if( ia != ib )
|
if( ia != ib )
|
||||||
return ia - ib;
|
return ia - ib;
|
||||||
|
|
||||||
|
if( uploadedEverA != uploadedEverB )
|
||||||
|
return uploadedEverA < uploadedEverB ? -1 : 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue