(trunk libT) Remove tr_torrentNext() from the public libT API (wereHamster)

This commit is contained in:
Charles Kerr 2009-01-13 16:39:19 +00:00
parent db58b89f6e
commit 08403324bd
6 changed files with 23 additions and 21 deletions

View File

@ -237,12 +237,8 @@ refreshTorrentActions( struct cbdata * data )
}
{
tr_torrent * tor = NULL;
tr_session * session = tr_core_session( data->core );
int activeCount = 0;
while(( tor = tr_torrentNext( session, tor )))
if( TR_STATUS_IS_ACTIVE( tr_torrentGetActivity( tor )))
++activeCount;
int activeCount = tr_sessionGetActiveTorrentCount( session );
action_sensitize( "pause-all-torrents", activeCount != 0 );
}
}

View File

@ -15,6 +15,7 @@
#include <gio/gio.h>
#endif
#include <glib/gi18n.h>
#include "conf.h"
#include "notify.h"
#include "tr-prefs.h"
#include "util.h"

View File

@ -1207,13 +1207,9 @@ maybeInhibitHibernation( TrCore * core )
/* always allow hibernation when all the torrents are paused */
if( inhibit ) {
gboolean active = FALSE;
tr_session * session = tr_core_session( core );
tr_torrent * tor = NULL;
while(( tor = tr_torrentNext( session, tor )))
if(( active = ( tr_torrentGetActivity( tor ) != TR_STATUS_STOPPED )))
break;
if( !active )
tr_session * session = tr_core_session( core );
if( tr_sessionGetActiveTorrentCount( session ) == 0 )
inhibit = FALSE;
}

View File

@ -1399,3 +1399,15 @@ tr_sessionSetProxyPassword( tr_session * session,
}
}
int
tr_sessionGetActiveTorrentCount( tr_session * session )
{
int ret;
tr_torrent * tor;
while(( tor = tr_torrentNext( session, tor )))
if( tr_torrentGetActivity( tor ) != TR_STATUS_STOPPED )
++ret;
return ret;
}

View File

@ -111,6 +111,10 @@ int tr_torrentPromoteTracker( tr_torrent * tor,
time_t* tr_torrentGetMTimes( const tr_torrent * tor,
size_t * setmeCount );
tr_torrent* tr_torrentNext( tr_session * session,
tr_torrent * current );
typedef enum
{
TR_VERIFY_NONE,

View File

@ -563,6 +563,8 @@ tr_torrent ** tr_sessionLoadTorrents( tr_session * session,
tr_ctor * ctor,
int * setmeCount );
int tr_sessionGetActiveTorrentCount( tr_session * session );
/** @} */
/**
@ -817,15 +819,6 @@ typedef int tr_fileFunc( const char * filename );
*/
void tr_torrentDeleteLocalData( tr_torrent * torrent, tr_fileFunc fileFunc );
/**
* @brief Iterate through the torrents.
*
* Pass in a NULL pointer to get the first torrent.
*/
tr_torrent* tr_torrentNext( tr_session * session,
tr_torrent * current );
uint64_t tr_torrentGetBytesLeftToAllocate( const tr_torrent * torrent );
/**