mirror of
https://github.com/transmission/transmission
synced 2025-03-03 10:15:45 +00:00
(gtk) #1355: transmission blocks hibernation when torrents are paused
This commit is contained in:
parent
9d7ef3bf38
commit
f18c4fbbaf
1 changed files with 8 additions and 6 deletions
|
@ -1179,14 +1179,16 @@ maybeInhibitHibernation( TrCore * core )
|
|||
{
|
||||
gboolean inhibit = pref_flag_get( PREF_KEY_INHIBIT_HIBERNATION );
|
||||
|
||||
if( inhibit )
|
||||
{
|
||||
/* don't inhibit if we've got active torrents */
|
||||
/* always allow hibernation when all the torrents are paused */
|
||||
if( inhibit ) {
|
||||
gboolean active = FALSE;
|
||||
tr_handle * session = tr_core_handle( core );
|
||||
tr_torrent * tor = NULL;
|
||||
while( ( tor = tr_torrentNext( session, tor ) ) )
|
||||
if( tr_torrentGetStatus( tor ) != TR_STATUS_STOPPED )
|
||||
inhibit = FALSE;
|
||||
while(( tor = tr_torrentNext( session, tor )))
|
||||
if(( active = ( tr_torrentGetStatus( tor ) != TR_STATUS_STOPPED )))
|
||||
break;
|
||||
if( !active )
|
||||
inhibit = FALSE;
|
||||
}
|
||||
|
||||
tr_core_set_hibernation_allowed( core, !inhibit );
|
||||
|
|
Loading…
Reference in a new issue