mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +00:00
only update the message window when it's visible
This commit is contained in:
@@ -60,11 +60,6 @@
|
||||
#warning don't update when the window is closed
|
||||
- (void) awakeFromNib
|
||||
{
|
||||
fMessages = [[NSMutableArray alloc] init];
|
||||
|
||||
fTimer = [NSTimer scheduledTimerWithTimeInterval: UPDATE_SECONDS target: self
|
||||
selector: @selector(updateLog:) userInfo: nil repeats: YES];
|
||||
|
||||
NSWindow * window = [self window];
|
||||
[window setFrameAutosaveName: @"MessageWindowFrame"];
|
||||
[window setFrameUsingName: @"MessageWindowFrame"];
|
||||
@@ -87,8 +82,7 @@
|
||||
[[fLevelButton itemAtIndex: LEVEL_DEBUG] setImage: fDebugImage];
|
||||
|
||||
//select proper level in popup button
|
||||
int level = tr_getMessageLevel();
|
||||
switch (level)
|
||||
switch (tr_getMessageLevel())
|
||||
{
|
||||
case TR_MSG_ERR:
|
||||
[fLevelButton selectItemAtIndex: LEVEL_ERROR];
|
||||
@@ -100,9 +94,23 @@
|
||||
[fLevelButton selectItemAtIndex: LEVEL_DEBUG];
|
||||
}
|
||||
|
||||
fMessages = [[NSMutableArray alloc] init];
|
||||
}
|
||||
|
||||
- (void) windowDidBecomeKey: (NSNotification *) notification
|
||||
{
|
||||
if (!fTimer)
|
||||
fTimer = [NSTimer scheduledTimerWithTimeInterval: UPDATE_SECONDS target: self
|
||||
selector: @selector(updateLog:) userInfo: nil repeats: YES];
|
||||
[self updateLog: nil];
|
||||
}
|
||||
|
||||
- (void) windowWillClose: (id)sender
|
||||
{
|
||||
[fTimer invalidate];
|
||||
fTimer = nil;
|
||||
}
|
||||
|
||||
- (void) updateLog: (NSTimer *) timer
|
||||
{
|
||||
tr_msg_list * messages, * currentMessage;
|
||||
|
||||
Reference in New Issue
Block a user