adium 5050:d474b6ea9184: All AIWindowControllers that are not re...

commits at adium.im commits at adium.im
Tue Sep 11 23:36:32 UTC 2012


details:	http://hg.adium.im/adium/rev/d474b6ea9184
revision:	5050:d474b6ea9184
branch:		(none)
author:		Thijs Alkemade <thijsalkemade at gmail.com>
date:		Wed Sep 12 01:36:08 2012 +0200

All AIWindowControllers that are not retained by their creator now end up in a set, where they are removed from once they close. This solution should be ARCceptable.

diffs (758 lines):

diff -r 19f59503d22d -r d474b6ea9184 Frameworks/Adium Framework/Source/AIWindowController.h
--- a/Frameworks/Adium Framework/Source/AIWindowController.h	Wed Sep 12 00:49:10 2012 +0200
+++ b/Frameworks/Adium Framework/Source/AIWindowController.h	Wed Sep 12 01:36:08 2012 +0200
@@ -17,6 +17,8 @@
 @interface AIWindowController : NSWindowController <NSWindowDelegate> {
 }
 
+- (void)showOnWindow:(id)parentWindow;
+- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
 - (IBAction)closeWindow:(id)sender;
 - (BOOL)windowShouldClose:(id)sender;
 - (NSString *)adiumFrameAutosaveName;
diff -r 19f59503d22d -r d474b6ea9184 Frameworks/Adium Framework/Source/AIWindowController.m
--- a/Frameworks/Adium Framework/Source/AIWindowController.m	Wed Sep 12 00:49:10 2012 +0200
+++ b/Frameworks/Adium Framework/Source/AIWindowController.m	Wed Sep 12 01:36:08 2012 +0200
@@ -32,6 +32,16 @@
  */
 @implementation AIWindowController
 
++ (NSMutableSet *)independentWindows {
+	static NSMutableSet *independentWindows;
+	static dispatch_once_t onceToken;
+	dispatch_once(&onceToken, ^{
+		independentWindows = [[NSMutableSet alloc] init];
+	});
+	
+	return independentWindows;
+}
+
 + (void)initialize
 {
 	if ([self isEqual:[AIWindowController class]]) {
@@ -61,6 +71,37 @@
 	}
 }
 
+
+/*!
+ * @brief Begin editing
+ *
+ * @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.
+ */
+- (void)showOnWindow:(id)parentWindow
+{
+	if (parentWindow) {
+		[NSApp beginSheet:self.window
+		   modalForWindow:parentWindow
+			modalDelegate:self
+		   didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
+			  contextInfo:nil];
+	} else {
+		[self showWindow:nil];
+	}
+	
+	[[AIWindowController independentWindows] addObject:self];
+}
+
+/*!
+ * @brief Called as the user list edit sheet closes, dismisses the sheet
+ */
+- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
+{
+    [sheet orderOut:nil];
+	
+	[[AIWindowController independentWindows] removeObject:self];
+}
+
 /*!
  * @brief Initialize
  */
@@ -287,6 +328,8 @@
 											 forKey:[self multiscreenKeyWithAutosaveName:key]
 											  group:PREF_GROUP_WINDOW_POSITIONS];		
 	}
+	
+	[[AIWindowController independentWindows] removeObject:self];
 }
 
 /*!
diff -r 19f59503d22d -r d474b6ea9184 Frameworks/Adium Framework/Source/ESPresetManagementController.h
--- a/Frameworks/Adium Framework/Source/ESPresetManagementController.h	Wed Sep 12 00:49:10 2012 +0200
+++ b/Frameworks/Adium Framework/Source/ESPresetManagementController.h	Wed Sep 12 01:36:08 2012 +0200
@@ -35,7 +35,6 @@
 }
 
 - (id)initWithPresets:(NSArray *)inPresets namedByKey:(NSString *)inNameKey withDelegate:(id)inDelegate;
-- (void)showOnWindow:(NSWindow *)parentWindow __attribute__((ns_consumes_self));
 
 - (IBAction)duplicatePreset:(id)sender;
 - (IBAction)deletePreset:(id)sender;
diff -r 19f59503d22d -r d474b6ea9184 Frameworks/Adium Framework/Source/ESPresetManagementController.m
--- a/Frameworks/Adium Framework/Source/ESPresetManagementController.m	Wed Sep 12 00:49:10 2012 +0200
+++ b/Frameworks/Adium Framework/Source/ESPresetManagementController.m	Wed Sep 12 01:36:08 2012 +0200
@@ -21,7 +21,6 @@
 @interface ESPresetManagementController ()
 - (void)configureControlDimming;
 - (void)tableViewSelectionDidChange:(NSNotification *)notification;
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
 @end
 
 /*!
@@ -32,15 +31,9 @@
 
 - (void)showOnWindow:(NSWindow *)parentWindow
 {
-	if (parentWindow) {
-		[NSApp beginSheet:self.window
-		   modalForWindow:parentWindow
-			modalDelegate:self
-		   didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
-			  contextInfo:nil];
-
-	} else {
-		[self showWindow:nil];
+	[super showOnWindow:parentWindow];
+	
+	if (!parentWindow) {
 		[self.window makeKeyAndOrderFront:nil];
 		[NSApp activateIgnoringOtherApps:YES];
 	}
@@ -106,29 +99,10 @@
  */
 - (IBAction)okay:(id)sender
 {
-	
 	[self closeWindow:nil];
 }
 
 /*!
- * Invoked as the sheet closes, dismiss the sheet
- */
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
-{	
-    [sheet orderOut:nil];
-}
-
-/*!
- * @brief As the window closes, release this controller instance
- *
- * The instance retained itself (rather, was not autoreleased when created) so it could function independently.
- */
-- (void)windowWillClose:(id)sender
-{
-	[super windowWillClose:sender];
-}
-
-/*!
  * @brief Duplicate the selected preset
  */
 - (IBAction)duplicatePreset:(id)sender
diff -r 19f59503d22d -r d474b6ea9184 Frameworks/Adium Framework/Source/ESPresetNameSheetController.h
--- a/Frameworks/Adium Framework/Source/ESPresetNameSheetController.h	Wed Sep 12 00:49:10 2012 +0200
+++ b/Frameworks/Adium Framework/Source/ESPresetNameSheetController.h	Wed Sep 12 01:36:08 2012 +0200
@@ -36,7 +36,6 @@
 	id			userInfo;
 }
 - (id)initWithDefaultName:(NSString *)inDefaultName explanatoryText:(NSString *)inExplanatoryText notifyingTarget:(id)inTarget userInfo:(id)inUserInfo;
-- (void)showOnWindow:(NSWindow *)parentWindow __attribute__((ns_consumes_self));
 - (IBAction)okay:(id)sender;
 - (IBAction)cancel:(id)sender;
 
diff -r 19f59503d22d -r d474b6ea9184 Frameworks/Adium Framework/Source/ESPresetNameSheetController.m
--- a/Frameworks/Adium Framework/Source/ESPresetNameSheetController.m	Wed Sep 12 00:49:10 2012 +0200
+++ b/Frameworks/Adium Framework/Source/ESPresetNameSheetController.m	Wed Sep 12 01:36:08 2012 +0200
@@ -20,7 +20,6 @@
 
 @interface ESPresetNameSheetController ()
 - (void)configureExplanatoryTextWithString:(NSString *)inExplanatoryText;
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
 @end
 
 @implementation ESPresetNameSheetController
@@ -30,11 +29,7 @@
 	//Must be called on a window
 	NSParameterAssert(parentWindow != nil);
 	
-	[NSApp beginSheet:self.window
-	   modalForWindow:parentWindow
-		modalDelegate:self
-	   didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
-		  contextInfo:nil];
+	[super showOnWindow:parentWindow];
 }
 
 - (id)initWithDefaultName:(NSString *)inDefaultName explanatoryText:(NSString *)inExplanatoryText notifyingTarget:(id)inTarget userInfo:(id)inUserInfo
@@ -52,24 +47,6 @@
 	return self;
 }
 
-/*!
- * @brief Invoked as the sheet closes, dismiss the sheet
- */
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
-{	
-    [sheet orderOut:nil];
-}
-
-/*!
-* @brief As the window closes, release this controller instance
- *
- * The instance retained itself (rather, was not autoreleased when created) so it could function independently.
- */
-- (void)windowWillClose:(id)sender
-{
-	[super windowWillClose:sender];
-}
-
 - (IBAction)okay:(id)sender
 {
 	NSString	*newName = [textField_name stringValue];
diff -r 19f59503d22d -r d474b6ea9184 Frameworks/Adium Framework/Source/ESTextAndButtonsWindowController.h
--- a/Frameworks/Adium Framework/Source/ESTextAndButtonsWindowController.h	Wed Sep 12 00:49:10 2012 +0200
+++ b/Frameworks/Adium Framework/Source/ESTextAndButtonsWindowController.h	Wed Sep 12 01:36:08 2012 +0200
@@ -65,8 +65,6 @@
 			 target:(id)inTarget
 		   userInfo:(id)inUserInfo;
 
-- (void)showOnWindow:(NSWindow *)parentWindow __attribute__((ns_consumes_self));
-
 - (void)changeWindowToTitle:(NSString *)inTitle
 			  defaultButton:(NSString *)inDefaultButton
 			alternateButton:(NSString *)inAlternateButton
diff -r 19f59503d22d -r d474b6ea9184 Frameworks/Adium Framework/Source/ESTextAndButtonsWindowController.m
--- a/Frameworks/Adium Framework/Source/ESTextAndButtonsWindowController.m	Wed Sep 12 00:49:10 2012 +0200
+++ b/Frameworks/Adium Framework/Source/ESTextAndButtonsWindowController.m	Wed Sep 12 01:36:08 2012 +0200
@@ -20,7 +20,6 @@
 
 @interface ESTextAndButtonsWindowController ()
 - (void)configureWindow;
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
 @end
 
 @implementation ESTextAndButtonsWindowController
@@ -86,20 +85,6 @@
 	return self;
 }
 
-- (void)showOnWindow:(NSWindow *)parentWindow
-{
-	if (parentWindow) {
-		[NSApp beginSheet:self.window
-		   modalForWindow:parentWindow
-			modalDelegate:self
-		   didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
-			  contextInfo:nil];
-		
-	} else {
-		[self show];
-	}
-}
-
 - (id)initWithTitle:(NSString *)inTitle
 						  defaultButton:(NSString *)inDefaultButton
 						alternateButton:(NSString *)inAlternateButton
@@ -250,18 +235,10 @@
  */
 - (void)windowWillClose:(id)sender
 {
-	[super windowWillClose:sender];
-	
 	//Release our target immediately to avoid a potential mutual retain (if the target is retaining us)
 	target = nil;
-}
-
-/*!
- * @brief Invoked as the sheet closes, dismiss the sheet
- */
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
-{
-    [sheet orderOut:nil];
+	
+	[super windowWillClose:sender];
 }
 
 /*!
diff -r 19f59503d22d -r d474b6ea9184 Plugins/Link Management/SHLinkEditorWindowController.h
--- a/Plugins/Link Management/SHLinkEditorWindowController.h	Wed Sep 12 00:49:10 2012 +0200
+++ b/Plugins/Link Management/SHLinkEditorWindowController.h	Wed Sep 12 01:36:08 2012 +0200
@@ -43,7 +43,6 @@
 }
 
 - (id)initWithTextView:(NSTextView *)inTextView notifyingTarget:(id)inTarget;
-- (void)showOnWindow:(NSWindow *)parentWindow __attribute__((ns_consumes_self));
 
 - (IBAction)cancel:(id)sender;
 - (IBAction)acceptURL:(id)sender;
diff -r 19f59503d22d -r d474b6ea9184 Plugins/Link Management/SHLinkEditorWindowController.m
--- a/Plugins/Link Management/SHLinkEditorWindowController.m	Wed Sep 12 00:49:10 2012 +0200
+++ b/Plugins/Link Management/SHLinkEditorWindowController.m	Wed Sep 12 01:36:08 2012 +0200
@@ -28,8 +28,6 @@
 - (void)insertLinkTo:(NSURL *)urlString withText:(NSString *)linkString inView:(NSTextView *)inView;
 - (void)informTargetOfLink;
 
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
-
 @end
 
 @interface NSObject (SHLinkEditorAdditions)
@@ -42,19 +40,6 @@
 
 #pragma mark Init methods
 
-- (void)showOnWindow:(NSWindow *)parentWindow
-{
-	if (parentWindow) {
-		[NSApp beginSheet:self.window
-		   modalForWindow:parentWindow
-			modalDelegate:self
-		   didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
-			  contextInfo:nil];
-	} else {
-		[self showWindow:nil];
-	}
-}
-
 - (id)initWithTextView:(NSTextView *)inTextView notifyingTarget:(id)inTarget
 
 {
@@ -157,18 +142,6 @@
 	[scrollView_URL setAlwaysDrawFocusRingIfFocused:YES];
 }
 
-// Window is closing
-- (void)windowWillClose:(id)sender
-{
-	[super windowWillClose:sender];
-}
-
-// Called as the sheet closes, dismisses the sheet
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
-{
-    [sheet orderOut:nil];
-}
-
 // Cancel
 - (IBAction)cancel:(id)sender
 {
diff -r 19f59503d22d -r d474b6ea9184 Source/AIEditAccountWindowController.h
--- a/Source/AIEditAccountWindowController.h	Wed Sep 12 00:49:10 2012 +0200
+++ b/Source/AIEditAccountWindowController.h	Wed Sep 12 01:36:08 2012 +0200
@@ -48,8 +48,6 @@
 	id							notifyTarget;
 }
 
-- (void)showOnWindow:(id)parentWindow __attribute__((ns_consumes_self));
-
 - (id)initWithAccount:(AIAccount *)inAccount notifyingTarget:(id)inTarget;
 - (IBAction)cancel:(id)sender;
 - (IBAction)okay:(id)sender;
diff -r 19f59503d22d -r d474b6ea9184 Source/AIEditAccountWindowController.m
--- a/Source/AIEditAccountWindowController.m	Wed Sep 12 00:49:10 2012 +0200
+++ b/Source/AIEditAccountWindowController.m	Wed Sep 12 01:36:08 2012 +0200
@@ -37,8 +37,6 @@
 - (void)_localizeTabViewItemLabels;
 - (void)saveConfiguration;
 - (void)configureControlDimming;
-
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
 @end
 
 /*!
@@ -48,24 +46,6 @@
 @implementation AIEditAccountWindowController
 
 /*!
- * @brief Begin editing
- *
- * @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.
- */
-- (void)showOnWindow:(id)parentWindow
-{
-	if (parentWindow) {
-		[NSApp beginSheet:self.window
-		   modalForWindow:parentWindow
-			modalDelegate:self
-		   didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
-			  contextInfo:nil];
-	} else {
-		[self showWindow:nil];
-	}
-}
-
-/*!
  * @brief Init the window controller
  */
 - (id)initWithAccount:(AIAccount *)inAccount notifyingTarget:(id)inTarget
@@ -131,22 +111,6 @@
 		[notifyTarget editAccountWindow:[self window] didOpenForAccount:account];
 }
 
-/*!
- * @brief Window is closing
- */
-- (void)windowWillClose:(id)sender
-{
-	[super windowWillClose:sender];
-}
-
-/*!
- * @brief Called as the user list edit sheet closes, dismisses the sheet
- */
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
-{
-    [sheet orderOut:nil];
-}
-
 - (void)configureControlDimming
 {
 	BOOL enableUserIcon = ([[matrix_userIcon selectedCell] tag] == 1);
diff -r 19f59503d22d -r d474b6ea9184 Source/AIListLayoutWindowController.h
--- a/Source/AIListLayoutWindowController.h	Wed Sep 12 00:49:10 2012 +0200
+++ b/Source/AIListLayoutWindowController.h	Wed Sep 12 01:36:08 2012 +0200
@@ -61,7 +61,6 @@
 	NSString		*layoutName;	
 }
 
-- (void)showOnWindow:(NSWindow *)parentWindow __attribute__((ns_consumes_self));
 - (id)initWithName:(NSString *)inName notifyingTarget:(id)inTarget;
 - (IBAction)cancel:(id)sender;
 - (IBAction)okay:(id)sender;
diff -r 19f59503d22d -r d474b6ea9184 Source/AIListLayoutWindowController.m
--- a/Source/AIListLayoutWindowController.m	Wed Sep 12 00:49:10 2012 +0200
+++ b/Source/AIListLayoutWindowController.m	Wed Sep 12 01:36:08 2012 +0200
@@ -44,19 +44,6 @@
 
 @implementation AIListLayoutWindowController
 
-- (void)showOnWindow:(NSWindow *)parentWindow
-{
-	if (parentWindow) {
-		[NSApp beginSheet:self.window
-		   modalForWindow:parentWindow
-			modalDelegate:self
-		   didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
-			  contextInfo:nil];
-	} else {
-		[self showWindow:nil];
-	}
-}
-
 - (id)initWithName:(NSString *)inName notifyingTarget:(id)inTarget
 {
     if ((self = [super initWithWindowNibName:@"ListLayoutSheet"])) {
@@ -90,17 +77,12 @@
 // Called as the sheet closes, dismisses the sheet
 - (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
 {
-    [sheet orderOut:nil];
-	
 	[[NSColorPanel sharedColorPanel] close];
 	
 	// No longer allow alpha in our color pickers
 	[[NSColorPanel sharedColorPanel] setShowsAlpha:NO];
-}
-
-- (void)windowWillClose:(id)sender
-{
-	[super windowWillClose:sender];
+	
+	[super sheetDidEnd:sheet returnCode:returnCode contextInfo:contextInfo];
 }
 
 // Cancel
diff -r 19f59503d22d -r d474b6ea9184 Source/AIListThemeWindowController.h
--- a/Source/AIListThemeWindowController.h	Wed Sep 12 00:49:10 2012 +0200
+++ b/Source/AIListThemeWindowController.h	Wed Sep 12 01:36:08 2012 +0200
@@ -98,7 +98,6 @@
 	NSString		*themeName;
 }
 
-- (void)showOnWindow:(id)parentWindow __attribute__((ns_consumes_self));
 - (id)initWithName:(NSString *)inName notifyingTarget:(id)inTarget;
 - (IBAction)cancel:(id)sender;
 - (IBAction)okay:(id)sender;
diff -r 19f59503d22d -r d474b6ea9184 Source/AIListThemeWindowController.m
--- a/Source/AIListThemeWindowController.m	Wed Sep 12 00:49:10 2012 +0200
+++ b/Source/AIListThemeWindowController.m	Wed Sep 12 01:36:08 2012 +0200
@@ -36,19 +36,6 @@
 
 @implementation AIListThemeWindowController
 
-- (void)showOnWindow:(id)parentWindow
-{
-	if (parentWindow) {
-		[NSApp beginSheet:self.window
-		   modalForWindow:parentWindow
-			modalDelegate:self
-		   didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
-			  contextInfo:nil];
-	} else {
-		[self showWindow:nil];
-	}
-}
-
 - (id)initWithName:(NSString *)inName notifyingTarget:(id)inTarget
 {
     if ((self = [super initWithWindowNibName:@"ListThemeSheet"])) {	
@@ -76,17 +63,12 @@
 // Called as the sheet closes, dismisses the sheet
 - (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
 {
-    [sheet orderOut:nil];
-	
 	[[NSColorPanel sharedColorPanel] close];
 	
 	// No longer allow alpha in our color pickers
 	[[NSColorPanel sharedColorPanel] setShowsAlpha:NO];
-}
-
-- (void)windowWillClose:(id)sender
-{
-	[super windowWillClose:sender];
+	
+	[super sheetDidEnd:sheet returnCode:returnCode contextInfo:contextInfo];
 }
 
 // Cancel
diff -r 19f59503d22d -r d474b6ea9184 Source/AINewBookmarkWindowController.h
--- a/Source/AINewBookmarkWindowController.h	Wed Sep 12 00:49:10 2012 +0200
+++ b/Source/AINewBookmarkWindowController.h	Wed Sep 12 01:36:08 2012 +0200
@@ -32,7 +32,6 @@
 }
 
 - (id)initWithChat:(AIChat *)inChat notifyingTarget:(id)inTarget;
-- (void)showOnWindow:(id)parentWindow __attribute__((ns_consumes_self));
 - (IBAction)add:(id)sender;
 - (IBAction)cancel:(id)sender;
 
diff -r 19f59503d22d -r d474b6ea9184 Source/AINewBookmarkWindowController.m
--- a/Source/AINewBookmarkWindowController.m	Wed Sep 12 00:49:10 2012 +0200
+++ b/Source/AINewBookmarkWindowController.m	Wed Sep 12 01:36:08 2012 +0200
@@ -34,25 +34,10 @@
 - (void)buildGroupMenu;
 - (void)newGroup:(id)sender;
 - (void)newGroupDidEnd:(NSNotification *)inNotification;
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
 @end
 
 @implementation AINewBookmarkWindowController
 
-- (void)showOnWindow:(NSWindow *)parentWindow
-{
-	if(parentWindow) {
-	   [NSApp beginSheet:self.window
-		  modalForWindow:parentWindow
-	   	   modalDelegate:self
-		  didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
-			 contextInfo:nil];
-	} else {
-		[self showWindow:nil];
-		[self.window makeKeyAndOrderFront:nil];
-	}
-}
-
 - (id)initWithChat:(AIChat *)inChat notifyingTarget:(id)inTarget
 {
 	if ((self = [super initWithWindowNibName:ADD_BOOKMARK_NIB])) {
@@ -64,19 +49,6 @@
 }
 
 /*!
- *	@brief didEnd selector for the sheet created above, dismisses the sheet
- */
--(void)sheetDidEnd:(NSWindow*)sheet returnCode:(NSInteger)returnCode contextInfo:(void*)contextInfo
-{
-	[sheet orderOut:nil];
-}
-
-- (void)windowWillClose:(id)sender
-{
-	[super windowWillClose:sender];
-}
-
-/*!
  * @name windowDidLoad
  * @brief the sheet finished loading, populate the group menu with contactlist's groups
  */
diff -r 19f59503d22d -r d474b6ea9184 Source/AINewContactWindowController.h
--- a/Source/AINewContactWindowController.h	Wed Sep 12 00:49:10 2012 +0200
+++ b/Source/AINewContactWindowController.h	Wed Sep 12 01:36:08 2012 +0200
@@ -51,7 +51,6 @@
 }
 
 - (id)initWithContactName:(NSString *)inName service:(AIService *)inService account:(AIAccount *)inAccount;
-- (void)showOnWindow:(NSWindow *)parentWindow __attribute__((ns_consumes_self));
 - (IBAction)cancel:(id)sender;
 - (IBAction)addContact:(id)sender;
 - (IBAction)searchInAB:(id)sender;
diff -r 19f59503d22d -r d474b6ea9184 Source/AINewContactWindowController.m
--- a/Source/AINewContactWindowController.m	Wed Sep 12 00:49:10 2012 +0200
+++ b/Source/AINewContactWindowController.m	Wed Sep 12 01:36:08 2012 +0200
@@ -37,8 +37,6 @@
 #define DEFAULT_GROUP_NAME		AILocalizedString(@"Contacts",nil)
 
 @interface AINewContactWindowController ()
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
-
 - (void)buildGroupMenu;
 - (void)buildContactTypeMenu;
 - (void)configureForCurrentServiceType;
@@ -63,16 +61,11 @@
 
 - (void)showOnWindow:(NSWindow *)parentWindow
 {
+	[super showOnWindow:parentWindow];
+	
 	if (parentWindow) {
 		[parentWindow makeKeyAndOrderFront:nil];
-		
-		[NSApp beginSheet:self.window
-		   modalForWindow:parentWindow
-			modalDelegate:self
-		   didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
-			  contextInfo:nil];
 	} else {
-		[self showWindow:nil];
 		[self.window makeKeyAndOrderFront:nil];
 	}
 	
@@ -145,22 +138,6 @@
 }
 
 /*!
- * @brief Window is closing
- */
-- (void)windowWillClose:(id)sender
-{
-	[super windowWillClose:sender];
-}
-
-/*!
- * @brief Called as the user list edit sheet closes, dismisses the sheet
- */
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
-{
-    [sheet orderOut:nil];
-}
-
-/*!
  * @brief Cancel
  */
 - (IBAction)cancel:(id)sender
diff -r 19f59503d22d -r d474b6ea9184 Source/AINewGroupWindowController.h
--- a/Source/AINewGroupWindowController.h	Wed Sep 12 00:49:10 2012 +0200
+++ b/Source/AINewGroupWindowController.h	Wed Sep 12 01:36:08 2012 +0200
@@ -27,7 +27,6 @@
 	AIListGroup *group;
 }
 
-- (void)showOnWindow:(NSWindow *)parentWindow __attribute__((ns_consumes_self));
 - (AIListGroup *)group;
 - (IBAction)cancel:(id)sender;
 - (IBAction)addGroup:(id)sender;
diff -r 19f59503d22d -r d474b6ea9184 Source/AINewGroupWindowController.m
--- a/Source/AINewGroupWindowController.m	Wed Sep 12 00:49:10 2012 +0200
+++ b/Source/AINewGroupWindowController.m	Wed Sep 12 01:36:08 2012 +0200
@@ -39,19 +39,6 @@
 	return self;
 }
 
-- (void)showOnWindow:(NSWindow *)parentWindow
-{
-	if (parentWindow) {
-		[NSApp beginSheet:self.window
-		   modalForWindow:parentWindow
-			modalDelegate:self
-		   didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
-			  contextInfo:nil];
-	} else {
-		[self showWindow:nil];
-	}
-}
-
 /*!
  * @brief Setup the window before it is displayed
  */
@@ -75,12 +62,8 @@
 {
 	[[NSNotificationCenter defaultCenter] postNotificationName:@"NewGroupWindowControllerDidEnd"
 											  object:sheet];
-    [sheet orderOut:nil];
-}
-
-- (void)windowWillClose:(id)sender
-{
-	[super windowWillClose:sender];
+	
+    [super sheetDidEnd:sheet returnCode:returnCode contextInfo:contextInfo];
 }
 
 /*!
diff -r 19f59503d22d -r d474b6ea9184 Source/ESEditStatusGroupWindowController.h
--- a/Source/ESEditStatusGroupWindowController.h	Wed Sep 12 00:49:10 2012 +0200
+++ b/Source/ESEditStatusGroupWindowController.h	Wed Sep 12 01:36:08 2012 +0200
@@ -32,7 +32,6 @@
 	id								target;
 }
 
-- (void)showOnWindow:(NSWindow *)parentWindow __attribute__((ns_consumes_self));
 - (id)initWithStatusGroup:(AIStatusGroup *)inStatusGroup notifyingTarget:(id)inTarget;
 
 - (IBAction)okay:(id)sender;
diff -r 19f59503d22d -r d474b6ea9184 Source/ESEditStatusGroupWindowController.m
--- a/Source/ESEditStatusGroupWindowController.m	Wed Sep 12 00:49:10 2012 +0200
+++ b/Source/ESEditStatusGroupWindowController.m	Wed Sep 12 01:36:08 2012 +0200
@@ -23,25 +23,10 @@
 
 @interface ESEditStatusGroupWindowController ()
 - (NSMenu *)groupWithStatusMenu;
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
 @end
 
 @implementation ESEditStatusGroupWindowController
 
-- (void)showOnWindow:(NSWindow *)parentWindow
-{
-	if (parentWindow) {
-		[NSApp beginSheet:self.window
-		   modalForWindow:parentWindow
-			modalDelegate:self
-		   didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
-			  contextInfo:nil];
-	} else {
-		[self showWindow:nil];
-		[self.window makeKeyAndOrderFront:nil];
-	}
-}
-
 - (id)initWithStatusGroup:(AIStatusGroup *)inStatusGroup notifyingTarget:(id)inTarget
 {
     if ((self = [super initWithWindowNibName:@"EditStatusGroup"])) {
@@ -75,26 +60,6 @@
 }
 
 /*!
- * @brief Called before the window is closed
- *
- * As our window is closing, we auto-release this window controller instance.  This allows our editor to function
- * independently without needing a separate object to retain and release it.
- */
-- (void)windowWillClose:(id)sender
-{
-	[super windowWillClose:sender];
-}
-
-/*!
- * Invoked as the sheet closes, dismiss the sheet
- */
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
-{
-    [sheet orderOut:nil];
-}
-
-
-/*!
  * @brief Okay
  *
  * Save changes, notify our target of the new configuration, and close the editor.




More information about the commits mailing list