adium/adium

Parents 5f944dc6405a
Children e20b41b6af3d
Refactored AIDockIconSelectionSheet into a way the static analyzer accepts.
--- a/Source/AIAppearancePreferences.m Sun Jan 29 15:11:57 2012 +0100
+++ b/Source/AIAppearancePreferences.m Sun Jan 29 15:21:31 2012 +0100
@@ -894,7 +894,8 @@
*/
- (IBAction)showAllDockIcons:(id)sender
{
- [AIDockIconSelectionSheet showDockIconSelectorOnWindow:[[self view] window]];
+ AIDockIconSelectionSheet *dockIconSelectionSheet = [[AIDockIconSelectionSheet alloc] init];
+ [dockIconSelectionSheet openOnWindow:[[self view] window]];
}
/*!
--- a/Source/AIDockIconSelectionSheet.h Sun Jan 29 15:11:57 2012 +0100
+++ b/Source/AIDockIconSelectionSheet.h Sun Jan 29 15:21:31 2012 +0100
@@ -45,7 +45,7 @@
@property (retain) NSTimer *animationTimer;
@property (assign) NSUInteger previousIndex;
-+ (void)showDockIconSelectorOnWindow:(NSWindow *)parentWindow;
+- (void)openOnWindow:(NSWindow *)parentWindow __attribute__((ns_consumes_self));
#pragma mark - Animations
--- a/Source/AIDockIconSelectionSheet.m Sun Jan 29 15:11:57 2012 +0100
+++ b/Source/AIDockIconSelectionSheet.m Sun Jan 29 15:21:31 2012 +0100
@@ -39,19 +39,26 @@
@synthesize imageCollectionView, okButton;
@synthesize icons, iconsData, animatedIconState, animatedIndex, animationTimer, previousIndex;
-+ (void)showDockIconSelectorOnWindow:(NSWindow *)parentWindow
+- (id)init
{
- AIDockIconSelectionSheet *controller = [[self alloc] initWithWindowNibName:@"DockIconSelectionSheet"];
+ if (self = [super initWithWindowNibName:@"DockIconSelectionSheet"]) {
+
+ }
+ return self;
+}
+
+- (void)openOnWindow:(NSWindow *)parentWindow
+{
if (parentWindow) {
- [NSApp beginSheet:[controller window]
+ [NSApp beginSheet:self.window
modalForWindow:parentWindow
- modalDelegate:controller
+ modalDelegate:self
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:nil];
} else {
- [controller showWindow:nil];
- [[controller window] makeKeyAndOrderFront:nil];
+ [self showWindow:nil];
+ [self.window makeKeyAndOrderFront:nil];
[NSApp activateIgnoringOtherApps:YES];
}
}