adium/adium

Parents e258ab5909be
Children 5ad23c8b6b04
Today's lesson in not using Apple's private methods: somewhere between old/886f95f00431 and #9620 Apple changed their document icon setup process. Use the new methods and fix #9620.
(transplanted from 5cf365ce9352d25978ffd6073d3bc07573aba518)
--- a/Plugins/Dual Window Interface/AIMessageWindowController.h Tue Apr 10 23:54:51 2012 +0300
+++ b/Plugins/Dual Window Interface/AIMessageWindowController.h Sun Apr 29 23:27:29 2012 -0400
@@ -52,8 +52,6 @@
NSDictionary *toolbarItems;
NSMutableArray *m_containedChats;
- BOOL hasShownDocumentButton;
-
BOOL toolbar_selectedTabChanged;
NSToolbar *toolbar;
}
--- a/Plugins/Dual Window Interface/AIMessageWindowController.m Tue Apr 10 23:54:51 2012 +0300
+++ b/Plugins/Dual Window Interface/AIMessageWindowController.m Sun Apr 29 23:27:29 2012 -0400
@@ -68,11 +68,6 @@
- (void)_relayoutWindow;
@end
-//Used to squelch compiler warnings on this private call
-@interface NSWindow (AISecretWindowDocumentIconAdditions)
-- (void)addDocumentIconButton;
-@end
-
@implementation AIMessageWindowController
//Create a new message window controller
@@ -99,7 +94,6 @@
containerName = [inName retain];
containerID = [inContainerID retain];
m_containedChats = [[NSMutableArray alloc] init];
- hasShownDocumentButton = NO;
//Load our window
myWindow = [self window];
@@ -600,6 +594,12 @@
return tabPosition;
}
+//Prevent the document popup since we aren't using an actual file
+- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu
+{
+ return NO;
+}
+
//Contained Chats ------------------------------------------------------------------------------------------------------
#pragma mark Contained Chats
//Add a tab view item container at the end of the tabs (without changing the current selection)
@@ -759,26 +759,13 @@
if (title) [window setTitle:title];
//Window Icon (We display state in the window title if tabs are not visible)
- if (!hasShownDocumentButton) {
- if ([window respondsToSelector:@selector(addDocumentIconButton)]) {
- [window addDocumentIconButton];
- }
- hasShownDocumentButton = YES;
- }
-
button = [window standardWindowButton:NSWindowDocumentIconButton];
-
- if ([tabView_tabBar isTabBarHidden]) {
- NSImage *image = [(AIMessageTabViewItem *)[tabView_messages selectedTabViewItem] stateIcon];
- if (image != [button image]) {
- [button setImage:image];
- }
-
- } else {
- if ([button image]) {
- [button setImage:nil];
- }
- }
+ [window setRepresentedURL:[NSURL URLWithString:@"StatusIcon"]];
+
+ if ([tabView_tabBar isTabBarHidden])
+ [button setImage:[(AIMessageTabViewItem *)[tabView_messages selectedTabViewItem] icon]];
+ else
+ [button setImage:nil];
}
- (AIChat *)activeChat