mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +00:00
#4920 On Lion, use window restoration on the message log and stats window
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#import "MessageWindowController.h"
|
||||
#import "Controller.h"
|
||||
#import "NSApplicationAdditions.h"
|
||||
#import "NSMutableArrayAdditions.h"
|
||||
#import "NSStringAdditions.h"
|
||||
@@ -57,6 +58,8 @@
|
||||
[window setFrameAutosaveName: @"MessageWindowFrame"];
|
||||
[window setFrameUsingName: @"MessageWindowFrame"];
|
||||
|
||||
[window setRestorationClass: [self class]];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(resizeColumn)
|
||||
name: @"NSTableViewColumnDidResizeNotification" object: fMessageTable];
|
||||
|
||||
@@ -149,8 +152,7 @@
|
||||
{
|
||||
if (!fTimer)
|
||||
{
|
||||
fTimer = [NSTimer scheduledTimerWithTimeInterval: UPDATE_SECONDS target: self
|
||||
selector: @selector(updateLog:) userInfo: nil repeats: YES];
|
||||
fTimer = [NSTimer scheduledTimerWithTimeInterval: UPDATE_SECONDS target: self selector: @selector(updateLog:) userInfo: nil repeats: YES];
|
||||
[self updateLog: nil];
|
||||
}
|
||||
}
|
||||
@@ -161,6 +163,21 @@
|
||||
fTimer = nil;
|
||||
}
|
||||
|
||||
+ (void) restoreWindowWithIdentifier: (NSString *) identifier state: (NSCoder *) state completionHandler: (void (^)(NSWindow *, NSError *)) completionHandler
|
||||
{
|
||||
NSAssert1([identifier isEqualToString: @"MessageWindow"], @"Trying to restore unexpected identifier %@", identifier);
|
||||
|
||||
NSWindow * window = [[(Controller *)[NSApp delegate] messageWindowController] window];
|
||||
completionHandler(window, nil);
|
||||
}
|
||||
|
||||
- (void) window: (NSWindow *) window didDecodeRestorableState: (NSCoder *) coder
|
||||
{
|
||||
[fTimer invalidate];
|
||||
fTimer = [NSTimer scheduledTimerWithTimeInterval: UPDATE_SECONDS target: self selector: @selector(updateLog:) userInfo: nil repeats: YES];
|
||||
[self updateLog: nil];
|
||||
}
|
||||
|
||||
- (void) updateLog: (NSTimer *) timer
|
||||
{
|
||||
tr_msg_list * messages;
|
||||
|
||||
Reference in New Issue
Block a user