adium 4590:e20b41b6af3d: Refactored AIEditAccountWindowControlle...
commits at adium.im
commits at adium.im
Sun Jan 29 14:47:36 UTC 2012
details: http://hg.adium.im/adium/rev/e20b41b6af3d
revision: 4590:e20b41b6af3d
branch: (none)
author: Thijs Alkemade <thijsalkemade at gmail.com>
date: Sun Jan 29 15:47:25 2012 +0100
Refactored AIEditAccountWindowController to be acceptable to the static analyzer.
diffs (158 lines):
diff -r 380c9328603e -r e20b41b6af3d Source/AIAccountController.m
--- a/Source/AIAccountController.m Sun Jan 29 15:21:31 2012 +0100
+++ b/Source/AIAccountController.m Sun Jan 29 15:47:25 2012 +0100
@@ -226,9 +226,9 @@
#pragma mark Editing
- (void)editAccount:(AIAccount *)account onWindow:(NSWindow *)window notifyingTarget:(id)target
{
- [AIEditAccountWindowController editAccount:account
- onWindow:window
- notifyingTarget:target];
+ AIEditAccountWindowController *accountWindowController = [[AIEditAccountWindowController alloc] initWithAccount:account
+ notifyingTarget:target];
+ [accountWindowController showOnWindow:window];
}
@end
diff -r 380c9328603e -r e20b41b6af3d Source/AIAccountListPreferences.m
--- a/Source/AIAccountListPreferences.m Sun Jan 29 15:21:31 2012 +0100
+++ b/Source/AIAccountListPreferences.m Sun Jan 29 15:47:25 2012 +0100
@@ -236,16 +236,16 @@
AIAccount *account = [adium.accountController createAccountWithService:service
UID:[service defaultUserName]];
- [AIEditAccountWindowController editAccount:account
- onWindow:[[self view] window]
- notifyingTarget:self];
+ AIEditAccountWindowController *editAccountWindowController = [[AIEditAccountWindowController alloc] initWithAccount:account
+ notifyingTarget:self];
+ [editAccountWindowController showOnWindow:[[self view] window]];
}
- (void)editAccount:(AIAccount *)inAccount
{
- [AIEditAccountWindowController editAccount:inAccount
- onWindow:[[self view] window]
- notifyingTarget:self];
+ AIEditAccountWindowController *editAccountWindowController = [[AIEditAccountWindowController alloc] initWithAccount:inAccount
+ notifyingTarget:self];
+ [editAccountWindowController showOnWindow:[[self view] window]];
}
/*!
diff -r 380c9328603e -r e20b41b6af3d Source/AIEditAccountWindowController.h
--- a/Source/AIEditAccountWindowController.h Sun Jan 29 15:21:31 2012 +0100
+++ b/Source/AIEditAccountWindowController.h Sun Jan 29 15:47:25 2012 +0100
@@ -48,7 +48,9 @@
id notifyTarget;
}
-+ (void)editAccount:(AIAccount *)account onWindow:(id)parentWindow notifyingTarget:(id)inTarget;
+- (void)showOnWindow:(id)parentWindow __attribute__((ns_consumes_self));
+
+- (id)initWithAccount:(AIAccount *)inAccount notifyingTarget:(id)inTarget;
- (IBAction)cancel:(id)sender;
- (IBAction)okay:(id)sender;
- (IBAction)changedIconSetting:(id)sender;
diff -r 380c9328603e -r e20b41b6af3d Source/AIEditAccountWindowController.m
--- a/Source/AIEditAccountWindowController.m Sun Jan 29 15:21:31 2012 +0100
+++ b/Source/AIEditAccountWindowController.m Sun Jan 29 15:47:25 2012 +0100
@@ -30,7 +30,6 @@
#import <Adium/AIServiceIcons.h>
@interface AIEditAccountWindowController ()
-- (id)initWithWindowNibName:(NSString *)windowNibName account:(AIAccount *)inAccount notifyingTarget:(id)inTarget;
- (void)_addCustomViewAndTabsForAccount:(AIAccount *)inAccount;
- (void)_addCustomView:(NSView *)customView toView:(NSView *)setupView tabViewItemIdentifier:(NSString *)identifier
runningHeight:(NSInteger *)height width:(NSInteger *)width;
@@ -51,35 +50,27 @@
/*!
* @brief Begin editing
*
- * @param inAccount The account to edit
* @param parentWindow A window on which to show the edit account window as a sheet. If nil, account editing takes place in an independent window.
- * @param inTarget Target to notify when editing is complete.
*/
-+ (void)editAccount:(AIAccount *)inAccount onWindow:(id)parentWindow notifyingTarget:(id)inTarget
+- (void)showOnWindow:(id)parentWindow
{
- AIEditAccountWindowController *controller;
-
- controller = [[self alloc] initWithWindowNibName:@"EditAccountSheet"
- account:inAccount
- notifyingTarget:inTarget];
-
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];
+ [self showWindow:nil];
}
}
/*!
* @brief Init the window controller
*/
-- (id)initWithWindowNibName:(NSString *)windowNibName account:(AIAccount *)inAccount notifyingTarget:(id)inTarget
+- (id)initWithAccount:(AIAccount *)inAccount notifyingTarget:(id)inTarget
{
- if ((self = [super initWithWindowNibName:windowNibName])) {
+ if ((self = [super initWithWindowNibName:@"EditAccountSheet"])) {
account = [inAccount retain];
notifyTarget = inTarget;
userIconData = nil;
@@ -94,6 +85,8 @@
- (void)dealloc
{
[account release];
+ [accountViewController release];
+ [accountProxyController release];
[userIconData release]; userIconData = nil;
[super dealloc];
@@ -166,6 +159,7 @@
- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
[sheet orderOut:nil];
+ [self autorelease];
}
- (void)configureControlDimming
diff -r 380c9328603e -r e20b41b6af3d Source/AIGuestAccountWindowController.m
--- a/Source/AIGuestAccountWindowController.m Sun Jan 29 15:21:31 2012 +0100
+++ b/Source/AIGuestAccountWindowController.m Sun Jan 29 15:47:25 2012 +0100
@@ -145,9 +145,9 @@
- (IBAction)displayAdvanced:(id)sender
{
- [AIEditAccountWindowController editAccount:self.account
- onWindow:[self window]
- notifyingTarget:self];
+ AIEditAccountWindowController *editAccountWindowController = [[AIEditAccountWindowController alloc] initWithAccount:self.account
+ notifyingTarget:self];
+ [editAccountWindowController showOnWindow:[self window]];
}
- (void)editAccountSheetDidEndForAccount:(AIAccount *)inAccount withSuccess:(BOOL)inSuccess
diff -r 380c9328603e -r e20b41b6af3d Source/AITemporaryIRCAccountWindowController.m
--- a/Source/AITemporaryIRCAccountWindowController.m Sun Jan 29 15:21:31 2012 +0100
+++ b/Source/AITemporaryIRCAccountWindowController.m Sun Jan 29 15:47:25 2012 +0100
@@ -167,9 +167,9 @@
group:GROUP_ACCOUNT_STATUS];
}
- [AIEditAccountWindowController editAccount:self.account
- onWindow:[self window]
- notifyingTarget:self];
+ AIEditAccountWindowController *editAccountWindowController = [[AIEditAccountWindowController alloc] initWithAccount:self.account
+ notifyingTarget:self];
+ [editAccountWindowController showOnWindow:[self window]];
}
- (void)editAccountSheetDidEndForAccount:(AIAccount *)inAccount withSuccess:(BOOL)inSuccess
More information about the commits
mailing list