mirror of
https://github.com/transmission/transmission
synced 2025-03-11 22:52:53 +00:00
(trunk) patch from wereHamster to finish off tr_handle
This commit is contained in:
parent
94a491aefb
commit
55f263312f
25 changed files with 47 additions and 49 deletions
|
@ -23,7 +23,6 @@
|
|||
*****************************************************************************/
|
||||
|
||||
struct tr_benc;
|
||||
struct tr_handle;
|
||||
|
||||
/**
|
||||
***
|
||||
|
@ -44,7 +43,7 @@ const char* pref_string_get ( const char * key );
|
|||
void pref_string_set ( const char * key, const char * value );
|
||||
void pref_string_set_default( const char * key, const char * value );
|
||||
|
||||
void pref_save ( struct tr_handle * );
|
||||
void pref_save ( tr_session * );
|
||||
struct tr_benc* pref_get_all ( void );
|
||||
|
||||
/**
|
||||
|
|
|
@ -119,7 +119,7 @@ void tr_socketListForEach( tr_socketList * const head,
|
|||
/***********************************************************************
|
||||
* Sockets
|
||||
**********************************************************************/
|
||||
int tr_netOpenTCP( struct tr_handle * session,
|
||||
int tr_netOpenTCP( tr_session * session,
|
||||
const tr_address * addr,
|
||||
tr_port port );
|
||||
|
||||
|
@ -127,10 +127,10 @@ int tr_netBindTCP( const tr_address * addr,
|
|||
tr_port port,
|
||||
tr_bool suppressMsgs );
|
||||
|
||||
int tr_netAccept( struct tr_handle * session,
|
||||
int bound,
|
||||
tr_address * setme_addr,
|
||||
tr_port * setme_port );
|
||||
int tr_netAccept( tr_session * session,
|
||||
int bound,
|
||||
tr_address * setme_addr,
|
||||
tr_port * setme_port );
|
||||
|
||||
int tr_netSetTOS( int s,
|
||||
int tos );
|
||||
|
|
|
@ -55,7 +55,7 @@ struct tr_metainfo_lookup
|
|||
struct tr_address;
|
||||
struct tr_bandwidth;
|
||||
|
||||
struct tr_handle
|
||||
struct tr_session
|
||||
{
|
||||
tr_bool isPortSet;
|
||||
tr_bool isPortRandom;
|
||||
|
|
|
@ -82,10 +82,9 @@ const char* tr_getDefaultConfigDir( const char * appname );
|
|||
const char* tr_getDefaultDownloadDir( void );
|
||||
|
||||
typedef struct tr_ctor tr_ctor;
|
||||
typedef struct tr_handle tr_handle;
|
||||
typedef struct tr_info tr_info;
|
||||
typedef struct tr_torrent tr_torrent;
|
||||
typedef tr_handle tr_session;
|
||||
typedef struct tr_session tr_session;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
@interface BadgeView : NSView
|
||||
{
|
||||
tr_handle * fLib;
|
||||
tr_session * fLib;
|
||||
|
||||
NSDictionary * fAttributes;
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
|||
BOOL fQuitting;
|
||||
}
|
||||
|
||||
- (id) initWithFrame: (NSRect) frame lib: (tr_handle *) lib;
|
||||
- (id) initWithFrame: (NSRect) frame lib: (tr_session *) lib;
|
||||
|
||||
- (BOOL) setRatesWithDownload: (CGFloat) downloadRate upload: (CGFloat) uploadRate;
|
||||
- (void) setQuitting;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
@implementation BadgeView
|
||||
|
||||
- (id) initWithFrame: (NSRect) frame lib: (tr_handle *) lib
|
||||
- (id) initWithFrame: (NSRect) frame lib: (tr_session *) lib
|
||||
{
|
||||
if ((self = [super initWithFrame: frame]))
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
@interface Badger : NSObject
|
||||
{
|
||||
tr_handle * fLib;
|
||||
tr_session * fLib;
|
||||
|
||||
NSUInteger fCompleted;
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
|||
BOOL fSpeedBadge, fQuittingTiger;
|
||||
}
|
||||
|
||||
- (id) initWithLib: (tr_handle *) lib;
|
||||
- (id) initWithLib: (tr_session *) lib;
|
||||
|
||||
- (void) updateBadge;
|
||||
- (void) incrementCompleted;
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
@implementation Badger
|
||||
|
||||
- (id) initWithLib: (tr_handle *) lib
|
||||
- (id) initWithLib: (tr_session *) lib
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ typedef enum
|
|||
|
||||
@interface Controller : NSObject <GrowlApplicationBridgeDelegate>
|
||||
{
|
||||
tr_handle * fLib;
|
||||
tr_session * fLib;
|
||||
|
||||
NSMutableArray * fTorrents, * fDisplayedTorrents;
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ typedef enum
|
|||
#define TRAC_URL @"http://trac.transmissionbt.com/"
|
||||
#define DONATE_URL @"http://www.transmissionbt.com/donate.php"
|
||||
|
||||
static tr_rpc_callback_status rpcCallback(tr_handle * handle UNUSED, tr_rpc_callback_type type, struct tr_torrent * torrentStruct, void * controller)
|
||||
static tr_rpc_callback_status rpcCallback(tr_session * handle UNUSED, tr_rpc_callback_type type, struct tr_torrent * torrentStruct, void * controller)
|
||||
{
|
||||
[(Controller *)controller rpcCallback: type forTorrentStruct: torrentStruct];
|
||||
return TR_RPC_NOREMOVE; //we'll do the remove manually
|
||||
|
|
|
@ -49,10 +49,10 @@
|
|||
NSUserDefaults * fDefaults;
|
||||
}
|
||||
|
||||
+ (void) createTorrentFile: (tr_handle *) handle;
|
||||
+ (void) createTorrentFile: (tr_handle *) handle forFile: (NSString *) file;
|
||||
+ (void) createTorrentFile: (tr_session *) handle;
|
||||
+ (void) createTorrentFile: (tr_session *) handle forFile: (NSString *) file;
|
||||
|
||||
- (id) initWithHandle: (tr_handle *) handle path: (NSString *) path;
|
||||
- (id) initWithHandle: (tr_session *) handle path: (NSString *) path;
|
||||
|
||||
- (void) toggleOpenCheck: (id) sender;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
@implementation CreatorWindowController
|
||||
|
||||
+ (void) createTorrentFile: (tr_handle *) handle
|
||||
+ (void) createTorrentFile: (tr_session *) handle
|
||||
{
|
||||
//get file/folder for torrent
|
||||
NSString * path;
|
||||
|
@ -56,13 +56,13 @@
|
|||
[creator showWindow: nil];
|
||||
}
|
||||
|
||||
+ (void) createTorrentFile: (tr_handle *) handle forFile: (NSString *) file
|
||||
+ (void) createTorrentFile: (tr_session *) handle forFile: (NSString *) file
|
||||
{
|
||||
CreatorWindowController * creator = [[self alloc] initWithHandle: handle path: file];
|
||||
[creator showWindow: nil];
|
||||
}
|
||||
|
||||
- (id) initWithHandle: (tr_handle *) handle path: (NSString *) path
|
||||
- (id) initWithHandle: (tr_session *) handle path: (NSString *) path
|
||||
{
|
||||
if ((self = [super initWithWindowNibName: @"Creator"]))
|
||||
{
|
||||
|
|
|
@ -27,12 +27,12 @@
|
|||
|
||||
@interface DragOverlayWindow : NSWindow
|
||||
{
|
||||
tr_handle * fLib;
|
||||
tr_session * fLib;
|
||||
|
||||
NSViewAnimation * fFadeInAnimation, * fFadeOutAnimation;
|
||||
}
|
||||
|
||||
- (id) initWithLib: (tr_handle *) lib forWindow: (NSWindow *) window;
|
||||
- (id) initWithLib: (tr_session *) lib forWindow: (NSWindow *) window;
|
||||
|
||||
- (void) setTorrents: (NSArray *) files;
|
||||
- (void) setFile: (NSString *) file;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
@implementation DragOverlayWindow
|
||||
|
||||
- (id) initWithLib: (tr_handle *) lib forWindow: (NSWindow *) window
|
||||
- (id) initWithLib: (tr_session *) lib forWindow: (NSWindow *) window
|
||||
{
|
||||
if ((self = ([super initWithContentRect: NSMakeRect(0, 0, 1.0, 1.0) styleMask: NSBorderlessWindowMask
|
||||
backing: NSBackingStoreBuffered defer: NO])))
|
||||
|
|
|
@ -62,8 +62,8 @@
|
|||
IBOutlet NSSegmentedControl * fRPCAddRemoveControl;
|
||||
}
|
||||
|
||||
+ (void) setHandle: (tr_handle *) handle;
|
||||
+ (tr_handle *) handle;
|
||||
+ (void) setHandle: (tr_session *) handle;
|
||||
+ (tr_session *) handle;
|
||||
|
||||
- (void) setPort: (id) sender;
|
||||
- (void) randomPort: (id) sender;
|
||||
|
|
|
@ -72,13 +72,13 @@
|
|||
|
||||
@implementation PrefsController
|
||||
|
||||
tr_handle * fHandle;
|
||||
+ (void) setHandle: (tr_handle *) handle
|
||||
tr_session * fHandle;
|
||||
+ (void) setHandle: (tr_session *) handle
|
||||
{
|
||||
fHandle = handle;
|
||||
}
|
||||
|
||||
+ (tr_handle *) handle
|
||||
+ (tr_session *) handle
|
||||
{
|
||||
return fHandle;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
NSTimer * fTimer;
|
||||
}
|
||||
|
||||
+ (StatsWindowController *) statsWindow: (tr_handle *) lib;
|
||||
+ (StatsWindowController *) statsWindow: (tr_session *) lib;
|
||||
|
||||
- (void) resetStats: (id) sender;
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@
|
|||
@implementation StatsWindowController
|
||||
|
||||
StatsWindowController * fStatsWindowInstance = nil;
|
||||
tr_handle * fLib;
|
||||
+ (StatsWindowController *) statsWindow: (tr_handle *) lib
|
||||
tr_session * fLib;
|
||||
+ (StatsWindowController *) statsWindow: (tr_session *) lib
|
||||
{
|
||||
if (!fStatsWindowInstance)
|
||||
{
|
||||
|
|
|
@ -77,9 +77,9 @@ typedef enum
|
|||
}
|
||||
|
||||
- (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (torrentFileState) torrentDelete
|
||||
lib: (tr_handle *) lib;
|
||||
- (id) initWithTorrentStruct: (tr_torrent *) torrentStruct location: (NSString *) location lib: (tr_handle *) lib;
|
||||
- (id) initWithHistory: (NSDictionary *) history lib: (tr_handle *) lib;
|
||||
lib: (tr_session *) lib;
|
||||
- (id) initWithTorrentStruct: (tr_torrent *) torrentStruct location: (NSString *) location lib: (tr_session *) lib;
|
||||
- (id) initWithHistory: (NSDictionary *) history lib: (tr_session *) lib;
|
||||
|
||||
- (NSDictionary *) history;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
@interface Torrent (Private)
|
||||
|
||||
- (id) initWithHash: (NSString *) hashString path: (NSString *) path torrentStruct: (tr_torrent *) torrentStruct lib: (tr_handle *) lib
|
||||
- (id) initWithHash: (NSString *) hashString path: (NSString *) path torrentStruct: (tr_torrent *) torrentStruct lib: (tr_session *) lib
|
||||
publicTorrent: (NSNumber *) publicTorrent
|
||||
downloadFolder: (NSString *) downloadFolder
|
||||
useIncompleteFolder: (NSNumber *) useIncompleteFolder incompleteFolder: (NSString *) incompleteFolder
|
||||
|
@ -70,7 +70,7 @@ void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, vo
|
|||
@implementation Torrent
|
||||
|
||||
- (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (torrentFileState) torrentDelete
|
||||
lib: (tr_handle *) lib
|
||||
lib: (tr_session *) lib
|
||||
{
|
||||
self = [self initWithHash: nil path: path torrentStruct: NULL lib: lib
|
||||
publicTorrent: torrentDelete != TORRENT_FILE_DEFAULT ? [NSNumber numberWithBool: torrentDelete == TORRENT_FILE_SAVE] : nil
|
||||
|
@ -95,7 +95,7 @@ void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, vo
|
|||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithTorrentStruct: (tr_torrent *) torrentStruct location: (NSString *) location lib: (tr_handle *) lib
|
||||
- (id) initWithTorrentStruct: (tr_torrent *) torrentStruct location: (NSString *) location lib: (tr_session *) lib
|
||||
{
|
||||
self = [self initWithHash: nil path: nil torrentStruct: torrentStruct lib: lib
|
||||
publicTorrent: [NSNumber numberWithBool: NO]
|
||||
|
@ -107,7 +107,7 @@ void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, vo
|
|||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithHistory: (NSDictionary *) history lib: (tr_handle *) lib
|
||||
- (id) initWithHistory: (NSDictionary *) history lib: (tr_session *) lib
|
||||
{
|
||||
self = [self initWithHash: [history objectForKey: @"TorrentHash"]
|
||||
path: [history objectForKey: @"TorrentPath"] torrentStruct: NULL lib: lib
|
||||
|
@ -1675,7 +1675,7 @@ void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, vo
|
|||
@implementation Torrent (Private)
|
||||
|
||||
//if a hash is given, attempt to load that; otherwise, attempt to open file at path
|
||||
- (id) initWithHash: (NSString *) hashString path: (NSString *) path torrentStruct: (tr_torrent *) torrentStruct lib: (tr_handle *) lib
|
||||
- (id) initWithHash: (NSString *) hashString path: (NSString *) path torrentStruct: (tr_torrent *) torrentStruct lib: (tr_session *) lib
|
||||
publicTorrent: (NSNumber *) publicTorrent
|
||||
downloadFolder: (NSString *) downloadFolder
|
||||
useIncompleteFolder: (NSNumber *) useIncompleteFolder incompleteFolder: (NSString *) incompleteFolder
|
||||
|
|
|
@ -210,7 +210,7 @@ SpeedStats :: SetTorrent( tr_torrent * tor )
|
|||
}
|
||||
|
||||
void
|
||||
SpeedStats :: Pulse( tr_handle * handle )
|
||||
SpeedStats :: Pulse( tr_session * handle )
|
||||
{
|
||||
// add a new record
|
||||
const double allUp = tr_sessionGetPieceSpeed( handle, TR_UP );
|
||||
|
|
|
@ -49,7 +49,7 @@ class SpeedStats: public wxPanel
|
|||
|
||||
void SetTorrent( struct tr_torrent * );
|
||||
|
||||
void Pulse( tr_handle * handle );
|
||||
void Pulse( tr_session * handle );
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ END_EVENT_TABLE()
|
|||
|
||||
|
||||
|
||||
TorrentListCtrl :: TorrentListCtrl( tr_handle * handle,
|
||||
TorrentListCtrl :: TorrentListCtrl( tr_session * handle,
|
||||
wxConfig * config,
|
||||
wxWindow * parent,
|
||||
const wxPoint & pos,
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
class TorrentListCtrl: public wxListCtrl
|
||||
{
|
||||
public:
|
||||
TorrentListCtrl( tr_handle * handle,
|
||||
TorrentListCtrl( tr_session * handle,
|
||||
wxConfig * config,
|
||||
wxWindow * parent,
|
||||
const wxPoint & pos = wxDefaultPosition,
|
||||
|
@ -123,7 +123,7 @@ class TorrentListCtrl: public wxListCtrl
|
|||
bool IsSorted( ) const;
|
||||
|
||||
private:
|
||||
tr_handle * myHandle;
|
||||
tr_session * myHandle;
|
||||
wxConfig * myConfig;
|
||||
torrents_v myTorrents;
|
||||
int prevSortCol;
|
||||
|
|
|
@ -136,7 +136,7 @@ class MyApp : public wxApp
|
|||
|
||||
namespace
|
||||
{
|
||||
tr_handle * handle = NULL;
|
||||
tr_session * handle = NULL;
|
||||
|
||||
typedef std::vector<tr_torrent*> torrents_v;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue