adium 4589:380c9328603e: Refactored AIDockIconSelectionSheet int...

commits at adium.im commits at adium.im
Sun Jan 29 14:21:46 UTC 2012


details:	http://hg.adium.im/adium/rev/380c9328603e
revision:	4589:380c9328603e
branch:		(none)
author:		Thijs Alkemade <thijsalkemade at gmail.com>
date:		Sun Jan 29 15:21:31 2012 +0100

Refactored AIDockIconSelectionSheet into a way the static analyzer accepts.

diffs (61 lines):

diff -r 5f944dc6405a -r 380c9328603e Source/AIAppearancePreferences.m
--- 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]];
 }
 
 /*!
diff -r 5f944dc6405a -r 380c9328603e Source/AIDockIconSelectionSheet.h
--- 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
 
diff -r 5f944dc6405a -r 380c9328603e Source/AIDockIconSelectionSheet.m
--- 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];
 	}
 }




More information about the commits mailing list