1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +00:00

attempt to decrease memory usage a bit when window/application is hidden

This commit is contained in:
Mitchell Livingston 2007-09-26 04:12:57 +00:00
parent f20358927b
commit 9dec223018
3 changed files with 40 additions and 27 deletions

View file

@ -177,6 +177,8 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
{
fLib = tr_init("macosx");
[NSApp setDelegate: self];
fTorrents = [[NSMutableArray alloc] init];
fDisplayedTorrents = [[NSMutableArray alloc] init];
@ -1451,6 +1453,10 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
{
[fTorrents makeObjectsPerformSelector: @selector(update)];
if (![NSApp isHidden])
{
if ([fWindow isVisible])
{
//resort if necessary or just update the table
NSString * sortType = [fDefaults stringForKey: @"Sort"];
if ([sortType isEqualToString: SORT_PROGRESS] || [sortType isEqualToString: SORT_STATE]
@ -1470,10 +1476,12 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
[fTotalULField setStringValue: [NSLocalizedString(@"Total UL: ", "Status bar -> total upload")
stringByAppendingString: [NSString stringForSpeed: uploadRate]]];
}
}
//update non-constant parts of info window
if ([[fInfoController window] isVisible])
[fInfoController updateInfoStats];
}
//badge dock
[fBadger updateBadge];
@ -3219,6 +3227,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
[fStatusBar setNeedsDisplay: YES];
[fBadger clearCompleted];
[self updateUI];
}
- (void) windowDidResignKey: (NSNotification *) notification
@ -3258,6 +3267,11 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
[fSearchFilterField setHidden: !show];
}
- (void) applicationWillUnhide: (NSNotification *) notification
{
[self updateUI];
}
- (void) linkHomepage: (id) sender
{
[[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString: WEBSITE_URL]];

View file

@ -388,11 +388,11 @@
if (have == 0)
[fHaveField setStringValue: [NSString stringForFileSize: 0]];
else if (have == haveVerified)
[fHaveField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ verified", "Inspector -> Activity tab -> have"),
[NSString stringForFileSize: haveVerified]]];
[fHaveField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ verified",
"Inspector -> Activity tab -> have"), [NSString stringForFileSize: haveVerified]]];
else
[fHaveField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ (%@ verified)", "Inspector -> Activity tab -> have"),
[NSString stringForFileSize: have], [NSString stringForFileSize: haveVerified]]];
[fHaveField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ (%@ verified)",
"Inspector -> Activity tab -> have"), [NSString stringForFileSize: have], [NSString stringForFileSize: haveVerified]]];
[fDownloadedTotalField setStringValue: [NSString stringForFileSize: downloadedTotal]];
[fUploadedTotalField setStringValue: [NSString stringForFileSize: uploadedTotal]];

View file

@ -173,8 +173,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
NSRect result = bounds;
result.size.height = BAR_HEIGHT;
result.origin.x = PADDING_HORIZONAL + (minimal ? IMAGE_SIZE_MIN : IMAGE_SIZE_REG)
+ PADDING_BETWEEN_IMAGE_AND_BAR;
result.origin.x = PADDING_HORIZONAL + (minimal ? IMAGE_SIZE_MIN : IMAGE_SIZE_REG) + PADDING_BETWEEN_IMAGE_AND_BAR;
result.origin.y += PADDING_ABOVE_TITLE + HEIGHT_TITLE;
if (minimal)