when dragging a file on the window, check if it has the .torrent extension; smaller changes

This commit is contained in:
Mitchell Livingston
2007-11-13 00:56:58 +00:00
parent 6242508fe2
commit 7f9e4d9efe
5 changed files with 31 additions and 25 deletions

View File

@@ -6,7 +6,7 @@
<description>Most recent version available.</description>
<language>en</language>
<pubDate>Tue, 23 Oct 2007 23:20:00 -0400</pubDate>
<lastBuildDate>Tue, 12 Nov 2007 16:22:00 -0400</lastBuildDate>
<lastBuildDate>Mon, 12 Nov 2007 16:22:00 -0400</lastBuildDate>
<item>
<title>Transmission 0.93 Released</title>
@@ -22,7 +22,7 @@
</ul>
<h4>TRANSMISSION 0.72 AND EARLIER: COMPLETE YOUR DOWNLOADS BEFORE UPGRADING OR YOU WILL LOSE DATA!</h4>]]></description>
<pubDate>Tue, 12 Nov 2007 16:22:00 -0400</pubDate>
<pubDate>Mon, 12 Nov 2007 16:22:00 -0400</pubDate>
<enclosure sparkle:version="3811" sparkle:shortVersionString="0.93" url="http://mirrors.m0k.org/transmission/files/Transmission-0.93.dmg" length="2142946" type="application/octet-stream"/>
</item>

View File

@@ -72,9 +72,8 @@
if (uploadRateString || downloadRateString)
{
NSRect badgeRect;
NSRect badgeRect = NSZeroRect;
badgeRect.size = [[NSImage imageNamed: @"UploadBadge"] size];
badgeRect.origin = NSZeroPoint;
//ignore shadow of badge when placing string
NSRect stringRect = badgeRect;

View File

@@ -2198,7 +2198,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
[pasteboard dataForType: TORRENT_TABLE_VIEW_DATA_TYPE]];
//determine where to move them
int i, decrease = 0;
int i;
for (i = [indexes firstIndex]; i < newRow && i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
newRow--;
@@ -2267,18 +2267,21 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
int canAdd;
while ((file = [enumerator nextObject]))
{
canAdd = tr_torrentParse(fLib, [file UTF8String], NULL, NULL);
if (canAdd == TR_OK)
if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
{
switch (canAdd = tr_torrentParse(fLib, [file UTF8String], NULL, NULL))
{
case TR_OK:
if (!fOverlayWindow)
fOverlayWindow = [[DragOverlayWindow alloc] initWithLib: fLib forWindow: fWindow];
[fOverlayWindow setTorrents: files];
return NSDragOperationCopy;
}
else if (canAdd == TR_EDUPLICATE)
case TR_EDUPLICATE:
torrent = YES;
else;
}
}
}
//create a torrent file if a single file
@@ -2304,6 +2307,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
return NSDragOperationNone;
}
#warning when dragging a torrent file that already exists, it gives a weird result
- (void) draggingExited: (id <NSDraggingInfo>) info
{
if (fOverlayWindow)
@@ -2320,7 +2324,6 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
{
BOOL torrent = NO, accept = YES;
#warning replace ifs with switch
//create an array of files that can be opened
NSMutableArray * filesToOpen = [[NSMutableArray alloc] init];
NSArray * files = [pasteboard propertyListForType: NSFilenamesPboardType];
@@ -2329,15 +2332,19 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
int canAdd;
while ((file = [enumerator nextObject]))
{
canAdd = tr_torrentParse(fLib, [file UTF8String], NULL, NULL);
if (canAdd == TR_OK)
if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
{
switch(tr_torrentParse(fLib, [file UTF8String], NULL, NULL))
{
case TR_OK:
[filesToOpen addObject: file];
torrent = YES;
}
else if (canAdd == TR_EDUPLICATE)
break;
case TR_EDUPLICATE:
torrent = YES;
else;
}
}
}
if ([filesToOpen count] > 0)

View File

@@ -85,7 +85,8 @@
tr_info info;
while ((file = [enumerator nextObject]))
{
if (tr_torrentParse(fLib, [file UTF8String], NULL, &info) == TR_OK)
if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame
&& tr_torrentParse(fLib, [file UTF8String], NULL, &info) == TR_OK)
{
count++;
size += info.totalSize;

View File

@@ -749,7 +749,6 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
- (float) notAvailableDesired
{
//NSLog(@"not available %f", (float)(fStat->desiredSize - fStat->desiredAvailable) / [self size]);
return (float)(fStat->desiredSize - fStat->desiredAvailable) / [self size];
}