{
int ret = 0;
tr_torrent *ta, *tb;
- const tr_stat *sa, *sb;
double aUp, aDown, bUp, bDown;
gtk_tree_model_get (m, a, MC_SPEED_UP, &aUp,
MC_SPEED_DOWN, &bDown,
MC_TORRENT, &tb,
-1);
- sa = tr_torrentStatCached (ta);
- sb = tr_torrentStatCached (tb);
+
+ ret = compare_double (aUp+aDown, bUp+bDown);
if (!ret)
- ret = compare_double (aUp+aDown, bUp+bDown);
- if (!ret)
- ret = compare_uint64 (sa->uploadedEver, sb->uploadedEver);
+ {
+ const tr_stat * const sa = tr_torrentStatCached (ta);
+ const tr_stat * const sb = tr_torrentStatCached (tb);
+ ret = compare_uint64 (sa->peersSendingToUs + sa->peersGettingFromUs,
+ sb->peersSendingToUs + sb->peersGettingFromUs);
+ }
+
if (!ret)
- ret = compare_by_queue (m, a, b, user_data);
+ ret = compare_by_activity (m, a, b, user_data);
return ret;
}
break;
case SortMode :: SORT_BY_ACTIVITY:
if( !val ) val = compare( a->downloadSpeed() + a->uploadSpeed(), b->downloadSpeed() + b->uploadSpeed() );
- if( !val ) val = compare( a->uploadedEver(), b->uploadedEver() );
+ if( !val ) val = compare( a->peersWeAreUploadingTo() + a->webseedsWeAreDownloadingFrom(),
+ b->peersWeAreUploadingTo() + b->webseedsWeAreDownloadingFrom());
// fall through
case SortMode :: SORT_BY_STATE:
- if( !val ) val = compare( a->hasError(), b->hasError() );
+ if( !val ) val = -compare( a->isPaused(), b->isPaused() );
if( !val ) val = compare( a->getActivity(), b->getActivity() );
if( !val ) val = -compare( a->queuePosition(), b->queuePosition() );
+ if( !val ) val = compare( a->hasError(), b->hasError() );
// fall through
case SortMode :: SORT_BY_PROGRESS:
if( !val ) val = compare( a->percentComplete(), b->percentComplete() );