(gtk) #1355: transmission blocks hibernation when torrents are paused

This commit is contained in:
Charles Kerr 2008-10-20 16:22:33 +00:00
parent 9d7ef3bf38
commit f18c4fbbaf
1 changed files with 8 additions and 6 deletions

View File

@ -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 );