mirror of
https://github.com/transmission/transmission
synced 2024-12-25 09:13:06 +00:00
(trunk) #3185: Number on drop-down menu "Activity" - "Active" seems does not follow a change in torrent status correctly
This commit is contained in:
parent
515ac1be36
commit
c30ed43082
2 changed files with 18 additions and 1 deletions
|
@ -558,6 +558,15 @@ torrentTrackerString( tr_torrent * tor )
|
||||||
return g_string_free( str, FALSE );
|
return g_string_free( str, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
isTorrentActive( tr_torrent * tor )
|
||||||
|
{
|
||||||
|
const tr_stat * st = tr_torrentStat( tor );
|
||||||
|
return ( st->peersSendingToUs > 0 )
|
||||||
|
|| ( st->peersGettingFromUs > 0 )
|
||||||
|
|| ( st->activity == TR_STATUS_CHECK );
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GIO
|
#ifdef HAVE_GIO
|
||||||
|
|
||||||
struct watchdir_file
|
struct watchdir_file
|
||||||
|
@ -785,6 +794,7 @@ tr_core_init( GTypeInstance * instance,
|
||||||
G_TYPE_POINTER, /* tr_torrent* */
|
G_TYPE_POINTER, /* tr_torrent* */
|
||||||
G_TYPE_DOUBLE, /* tr_stat.pieceUploadSpeed_KBps */
|
G_TYPE_DOUBLE, /* tr_stat.pieceUploadSpeed_KBps */
|
||||||
G_TYPE_DOUBLE, /* tr_stat.pieceDownloadSpeed_KBps */
|
G_TYPE_DOUBLE, /* tr_stat.pieceDownloadSpeed_KBps */
|
||||||
|
G_TYPE_BOOLEAN, /* filter.c:ACTIVITY_FILTER_ACTIVE */
|
||||||
G_TYPE_INT, /* tr_stat.activity */
|
G_TYPE_INT, /* tr_stat.activity */
|
||||||
G_TYPE_UCHAR, /* tr_stat.finished */
|
G_TYPE_UCHAR, /* tr_stat.finished */
|
||||||
G_TYPE_CHAR, /* tr_priority_t */
|
G_TYPE_CHAR, /* tr_priority_t */
|
||||||
|
@ -906,6 +916,7 @@ tr_core_add_torrent( TrCore * self,
|
||||||
MC_TORRENT_RAW, tor,
|
MC_TORRENT_RAW, tor,
|
||||||
MC_SPEED_UP, st->pieceUploadSpeed_KBps,
|
MC_SPEED_UP, st->pieceUploadSpeed_KBps,
|
||||||
MC_SPEED_DOWN, st->pieceDownloadSpeed_KBps,
|
MC_SPEED_DOWN, st->pieceDownloadSpeed_KBps,
|
||||||
|
MC_ACTIVE, isTorrentActive( tor ),
|
||||||
MC_ACTIVITY, st->activity,
|
MC_ACTIVITY, st->activity,
|
||||||
MC_FINISHED, st->finished,
|
MC_FINISHED, st->finished,
|
||||||
MC_PRIORITY, tr_torrentGetPriority( tor ),
|
MC_PRIORITY, tr_torrentGetPriority( tor ),
|
||||||
|
@ -1304,6 +1315,7 @@ update_foreach( GtkTreeModel * model,
|
||||||
char * oldTrackers, * newTrackers;
|
char * oldTrackers, * newTrackers;
|
||||||
double oldUpSpeed, newUpSpeed;
|
double oldUpSpeed, newUpSpeed;
|
||||||
double oldDownSpeed, newDownSpeed;
|
double oldDownSpeed, newDownSpeed;
|
||||||
|
gboolean oldActive, newActive;
|
||||||
const tr_stat * st;
|
const tr_stat * st;
|
||||||
TrTorrent * gtor;
|
TrTorrent * gtor;
|
||||||
tr_torrent * tor;
|
tr_torrent * tor;
|
||||||
|
@ -1311,6 +1323,7 @@ update_foreach( GtkTreeModel * model,
|
||||||
/* get the old states */
|
/* get the old states */
|
||||||
gtk_tree_model_get( model, iter,
|
gtk_tree_model_get( model, iter,
|
||||||
MC_TORRENT, >or,
|
MC_TORRENT, >or,
|
||||||
|
MC_ACTIVE, &oldActive,
|
||||||
MC_ACTIVITY, &oldActivity,
|
MC_ACTIVITY, &oldActivity,
|
||||||
MC_FINISHED, &oldFinished,
|
MC_FINISHED, &oldFinished,
|
||||||
MC_PRIORITY, &oldPriority,
|
MC_PRIORITY, &oldPriority,
|
||||||
|
@ -1322,6 +1335,7 @@ update_foreach( GtkTreeModel * model,
|
||||||
/* get the new states */
|
/* get the new states */
|
||||||
tor = tr_torrent_handle( gtor );
|
tor = tr_torrent_handle( gtor );
|
||||||
st = tr_torrentStat( tor );
|
st = tr_torrentStat( tor );
|
||||||
|
newActive = isTorrentActive( tor );
|
||||||
newActivity = st->activity;
|
newActivity = st->activity;
|
||||||
newFinished = st->finished;
|
newFinished = st->finished;
|
||||||
newPriority = tr_torrentGetPriority( tor );
|
newPriority = tr_torrentGetPriority( tor );
|
||||||
|
@ -1331,7 +1345,8 @@ update_foreach( GtkTreeModel * model,
|
||||||
|
|
||||||
/* updating the model triggers off resort/refresh,
|
/* updating the model triggers off resort/refresh,
|
||||||
so don't do it unless something's actually changed... */
|
so don't do it unless something's actually changed... */
|
||||||
if( ( newActivity != oldActivity )
|
if( ( newActive != oldActive )
|
||||||
|
|| ( newActivity != oldActivity )
|
||||||
|| ( newFinished != oldFinished )
|
|| ( newFinished != oldFinished )
|
||||||
|| ( newPriority != oldPriority )
|
|| ( newPriority != oldPriority )
|
||||||
|| gtr_strcmp0( oldTrackers, newTrackers )
|
|| gtr_strcmp0( oldTrackers, newTrackers )
|
||||||
|
@ -1339,6 +1354,7 @@ update_foreach( GtkTreeModel * model,
|
||||||
|| gtr_compare_double( newDownSpeed, oldDownSpeed, 3 ) )
|
|| gtr_compare_double( newDownSpeed, oldDownSpeed, 3 ) )
|
||||||
{
|
{
|
||||||
gtk_list_store_set( GTK_LIST_STORE( model ), iter,
|
gtk_list_store_set( GTK_LIST_STORE( model ), iter,
|
||||||
|
MC_ACTIVE, newActive,
|
||||||
MC_ACTIVITY, newActivity,
|
MC_ACTIVITY, newActivity,
|
||||||
MC_FINISHED, newFinished,
|
MC_FINISHED, newFinished,
|
||||||
MC_PRIORITY, newPriority,
|
MC_PRIORITY, newPriority,
|
||||||
|
|
|
@ -195,6 +195,7 @@ enum
|
||||||
MC_TORRENT_RAW,
|
MC_TORRENT_RAW,
|
||||||
MC_SPEED_UP,
|
MC_SPEED_UP,
|
||||||
MC_SPEED_DOWN,
|
MC_SPEED_DOWN,
|
||||||
|
MC_ACTIVE,
|
||||||
MC_ACTIVITY,
|
MC_ACTIVITY,
|
||||||
MC_FINISHED,
|
MC_FINISHED,
|
||||||
MC_PRIORITY,
|
MC_PRIORITY,
|
||||||
|
|
Loading…
Reference in a new issue