adium 4543:ec4b239b905c: Fix -initWithCoder, switch to propertie...
commits at adium.im
commits at adium.im
Tue Jan 24 19:22:03 UTC 2012
details: http://hg.adium.im/adium/rev/ec4b239b905c
revision: 4543:ec4b239b905c
branch: (none)
author: Adrian Godoroja <robotive at me.com>
date: Tue Jan 24 14:27:48 2012 +0200
Fix -initWithCoder, switch to properties. AISplitView.
Subject: adium 4544:aed834c51176: Fixed a leak in AIImageDrawingAdditions, when working with animated Gifs.
details: http://hg.adium.im/adium/rev/aed834c51176
revision: 4544:aed834c51176
branch: (none)
author: Adrian Godoroja <robotive at me.com>
date: Tue Jan 24 14:55:09 2012 +0200
Fixed a leak in AIImageDrawingAdditions, when working with animated Gifs.
Subject: adium 4545:579d1f2eab2b: Fix -init*, minor clean-up. AIListOutlineView.
details: http://hg.adium.im/adium/rev/579d1f2eab2b
revision: 4545:579d1f2eab2b
branch: (none)
author: Adrian Godoroja <robotive at me.com>
date: Tue Jan 24 15:47:53 2012 +0200
Fix -init*, minor clean-up. AIListOutlineView.
Subject: adium 4546:17d2b04084c9: Fix initWithWindowNibName, minor clean-up. AIAccountPlusFieldPromptController.
details: http://hg.adium.im/adium/rev/17d2b04084c9
revision: 4546:17d2b04084c9
branch: (none)
author: Adrian Godoroja <robotive at me.com>
date: Tue Jan 24 15:57:36 2012 +0200
Fix initWithWindowNibName, minor clean-up. AIAccountPlusFieldPromptController.
Subject: adium 4547:ef16d31376be: Fix initWithWindowNibName, minor clean-up. DCJoinChatWindowController.
details: http://hg.adium.im/adium/rev/ef16d31376be
revision: 4547:ef16d31376be
branch: (none)
author: Adrian Godoroja <robotive at me.com>
date: Tue Jan 24 16:06:36 2012 +0200
Fix initWithWindowNibName, minor clean-up. DCJoinChatWindowController.
Subject: adium 4548:50ed08ac9440: Fix initWithWindowNibName, minor clean-up. CSNewContactAlertWindowController.
details: http://hg.adium.im/adium/rev/50ed08ac9440
revision: 4548:50ed08ac9440
branch: (none)
author: Adrian Godoroja <robotive at me.com>
date: Tue Jan 24 16:22:18 2012 +0200
Fix initWithWindowNibName, minor clean-up. CSNewContactAlertWindowController.
Subject: adium 4549:bf899fe66739: Fix initWithWindowNibName, minor clean-up. SHLinkEditorWindowController.
details: http://hg.adium.im/adium/rev/bf899fe66739
revision: 4549:bf899fe66739
branch: (none)
author: Adrian Godoroja <robotive at me.com>
date: Tue Jan 24 17:03:11 2012 +0200
Fix initWithWindowNibName, minor clean-up. SHLinkEditorWindowController.
Subject: adium 4550:434ab94eed07: Fix initWithWindowNibName, minor clean-up. AIListLayoutWindowController.
details: http://hg.adium.im/adium/rev/434ab94eed07
revision: 4550:434ab94eed07
branch: (none)
author: Adrian Godoroja <robotive at me.com>
date: Tue Jan 24 20:08:22 2012 +0200
Fix initWithWindowNibName, minor clean-up. AIListLayoutWindowController.
Subject: adium 4551:2f06d161f2cb: Fix initWithWindowNibName, minor clean-up. AIListThemeWindowController.
details: http://hg.adium.im/adium/rev/2f06d161f2cb
revision: 4551:2f06d161f2cb
branch: (none)
author: Adrian Godoroja <robotive at me.com>
date: Tue Jan 24 20:10:03 2012 +0200
Fix initWithWindowNibName, minor clean-up. AIListThemeWindowController.
Subject: adium 4552:b3341f301136: Fix -init*, minor clean-up. AITextColorPreviewView.
details: http://hg.adium.im/adium/rev/b3341f301136
revision: 4552:b3341f301136
branch: (none)
author: Adrian Godoroja <robotive at me.com>
date: Tue Jan 24 20:19:12 2012 +0200
Fix -init*, minor clean-up. AITextColorPreviewView.
Subject: adium 4553:9aaa548e3c03: Fix initWithWindowNibName, minor clean-up. ErrorMessageWindowController.
details: http://hg.adium.im/adium/rev/9aaa548e3c03
revision: 4553:9aaa548e3c03
branch: (none)
author: Adrian Godoroja <robotive at me.com>
date: Tue Jan 24 20:29:24 2012 +0200
Fix initWithWindowNibName, minor clean-up. ErrorMessageWindowController.
Subject: adium 4554:ae6db8e450de: Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
details: http://hg.adium.im/adium/rev/ae6db8e450de
revision: 4554:ae6db8e450de
branch: (none)
author: Adrian Godoroja <robotive at me.com>
date: Tue Jan 24 21:12:35 2012 +0200
Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Subject: adium 4555:fb5530a3a6be: Fix initWithFrame. AIContactListImagePicker.
details: http://hg.adium.im/adium/rev/fb5530a3a6be
revision: 4555:fb5530a3a6be
branch: (none)
author: Adrian Godoroja <robotive at me.com>
date: Tue Jan 24 21:19:09 2012 +0200
Fix initWithFrame. AIContactListImagePicker.
Subject: adium 4556:09f21de0e8f2: Update change log.
details: http://hg.adium.im/adium/rev/09f21de0e8f2
revision: 4556:09f21de0e8f2
branch: (none)
author: Adrian Godoroja <robotive at me.com>
date: Tue Jan 24 21:20:40 2012 +0200
Update change log.
diffs (truncated from 3627 to 1000 lines):
diff -r 00e52040c19f -r 09f21de0e8f2 ChangeLogs/Changes Between Betas.txt
--- a/ChangeLogs/Changes Between Betas.txt Sun Jan 22 23:44:39 2012 -0500
+++ b/ChangeLogs/Changes Between Betas.txt Tue Jan 24 21:20:40 2012 +0200
@@ -3,6 +3,10 @@
* Fixed localisation of a couple of emoticons.
* Renamed "Current Track" status to "iTunes Status" (known as "iTunes" prior to 1.5).
* Updated localisations: German (#15586, #15733), Greek, Swedish (#15786).
+ * Fixed initializers and did minor clean-up in: AISplitView, AIListOutlineView, AIAccountPlusFieldPromptController,
+ DCJoinChatWindowController, CSNewContactAlertWindowController, SHLinkEditorWindowController, AIListLayoutWindowController,
+ AIListThemeWindowController, AITextColorPreviewView, ErrorMessageWindowController, AWEzvContactManagerRendezvous, AIContactListImagePicker.
+ * Fixed a leak when resizing animated Gif files.
Adium 1.5rc1
Localisation
diff -r 00e52040c19f -r 09f21de0e8f2 Frameworks/AIUtilities Framework/Source/AIImageDrawingAdditions.m
--- a/Frameworks/AIUtilities Framework/Source/AIImageDrawingAdditions.m Sun Jan 22 23:44:39 2012 -0500
+++ b/Frameworks/AIUtilities Framework/Source/AIImageDrawingAdditions.m Tue Jan 24 21:20:40 2012 +0200
@@ -273,6 +273,9 @@
// Write GIF Extension Blocks
[self writeGIFExtensionBlocksInData:GIFRepresentationData forRepresenation:(NSBitmapImageRep *)bestRep];
+ // Release before you re-allocate.
+ [newImage release];
+
newImage = [[NSImage alloc] initWithData:GIFRepresentationData];
} else {
[scaledImage lockFocus];
diff -r 00e52040c19f -r 09f21de0e8f2 Frameworks/AIUtilities Framework/Source/AISplitView.h
--- a/Frameworks/AIUtilities Framework/Source/AISplitView.h Sun Jan 22 23:44:39 2012 -0500
+++ b/Frameworks/AIUtilities Framework/Source/AISplitView.h Tue Jan 24 21:20:40 2012 +0200
@@ -19,8 +19,8 @@
* @class AISplitView
* @brief <tt>NSSplitView</tt> subclass with additional customization
*
- * This subclass of NSSplitView allows the user to adjust the thickness of the divider and disable drawing of the
- * divider 'dot' graphic.
+ * This subclass of NSSplitView allows the user to adjust the thickness of the divider
+ * and disable drawing of the divider 'dot' graphic.
*/
@interface AISplitView : NSSplitView {
CGFloat dividerThickness;
@@ -29,18 +29,15 @@
/*!
* @brief Set the thickness of the split divider
- *
- * Set the thickness of the split divider
- * @param inThickness Desired divider thickness
*/
-- (void)setDividerThickness:(CGFloat)inThickness;
+ at property (nonatomic, readwrite, assign) CGFloat dividerThickness;
/*!
* @brief Toggle drawing of the divider graphics
*
* Toggle display of the divider graphics (The 'dot' in the center of the divider)
- * @param inDraw NO to disable drawing of the dot, YES to enable it
+ * Set to NO to disable drawing of the dot, YES to enable it
*/
-- (void)setDrawsDivider:(BOOL)inDraw;
+ at property (nonatomic, readwrite, assign) BOOL drawDivider;
@end
diff -r 00e52040c19f -r 09f21de0e8f2 Frameworks/AIUtilities Framework/Source/AISplitView.m
--- a/Frameworks/AIUtilities Framework/Source/AISplitView.m Sun Jan 22 23:44:39 2012 -0500
+++ b/Frameworks/AIUtilities Framework/Source/AISplitView.m Tue Jan 24 21:20:40 2012 +0200
@@ -14,20 +14,25 @@
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#import "AISplitView.h"
@interface AISplitView ()
-- (void)_initSplitView;
+
+- (void)AI_initSplitView;
+
@end
@implementation AISplitView
-//Init
+ at synthesize dividerThickness, drawDivider;
+
+// Init
- (id)initWithCoder:(NSCoder *)aDecoder
{
- if (([super initWithCoder:aDecoder])) {
- [self _initSplitView];
+ if ((self = [super initWithCoder:aDecoder])) {
+ [self AI_initSplitView];
}
return self;
}
@@ -35,31 +40,22 @@
- (id)initWithFrame:(NSRect)frameRect
{
if ((self = [super initWithFrame:frameRect])) {
- [self _initSplitView];
+ [self AI_initSplitView];
}
return self;
}
-- (void)_initSplitView
+- (void)AI_initSplitView
{
dividerThickness = [super dividerThickness];
drawDivider = YES;
}
-//Divider thickness
-- (void)setDividerThickness:(CGFloat)inThickness{
- dividerThickness = inThickness;
-}
-- (CGFloat)dividerThickness{
- return dividerThickness;
-}
+#pragma mark - Drawing
-//Divider drawing
-- (void)setDrawsDivider:(BOOL)inDraw{
- drawDivider = inDraw;
-}
-- (void)drawDividerInRect:(NSRect)aRect{
- if (drawDivider) {
+- (void)drawDividerInRect:(NSRect)aRect
+{
+ if ([self drawDivider]) {
[super drawDividerInRect:aRect];
}
}
diff -r 00e52040c19f -r 09f21de0e8f2 Frameworks/Adium Framework/Source/AIAccountPlusFieldPromptController.m
--- a/Frameworks/Adium Framework/Source/AIAccountPlusFieldPromptController.m Sun Jan 22 23:44:39 2012 -0500
+++ b/Frameworks/Adium Framework/Source/AIAccountPlusFieldPromptController.m Tue Jan 24 21:20:40 2012 +0200
@@ -25,7 +25,9 @@
#import <Adium/AIMetaContact.h>
@interface AIAccountPlusFieldPromptController ()
-- (void)_configureTextFieldForAccount:(AIAccount *)account;
+
+- (void)AI_configureTextFieldForAccount:(AIAccount *)account;
+
@end
#define ACCOUNT_PLUS_FIELD_GROUP @"AccountPlusFieldWindows"
@@ -99,9 +101,9 @@
return contact;
}
-- (void)_configureTextFieldForAccount:(AIAccount *)account
+- (void)AI_configureTextFieldForAccount:(AIAccount *)account
{
- //Clear the completing strings
+ // Clear the completing strings
[textField_handle setCompletingStrings:nil];
/* Configure the auto-complete view to autocomplete for contacts matching the selected account's service
@@ -153,12 +155,12 @@
[self _saveConfiguredAccount];
}
-// Private --------------------------------------------------------------------------------
+#pragma mark Private
+
- (id)initWithWindowNibName:(NSString *)windowNibName
{
- //init
- [super initWithWindowNibName:windowNibName];
-
+ self = [super initWithWindowNibName:windowNibName];
+
return self;
}
@@ -167,10 +169,10 @@
[super dealloc];
}
-//Setup the window before it is displayed
+// Setup the window before it is displayed
- (void)windowDidLoad
{
- //Controls
+ // Controls
[button_cancel setLocalizedString:
AILocalizedStringFromTableInBundle(@"Cancel",
nil,
@@ -178,15 +180,15 @@
nil)];
[textField_handle setMinStringLength:2];
- //Account menu
+ // Account menu
accountMenu = [[AIAccountMenu accountMenuWithDelegate:self
submenuType:AIAccountNoSubmenu
showTitleVerbs:NO] retain];
[self _restoreLastAccountIfPossible];
- [self _configureTextFieldForAccount:[[popUp_service selectedItem] representedObject]];
+ [self AI_configureTextFieldForAccount:[[popUp_service selectedItem] representedObject]];
[self controlTextDidChange:nil];
- //Center the window
+ // Center the window
[[self window] center];
}
@@ -205,20 +207,26 @@
[button_okay setEnabled:([[textField_handle stringValue] length] > 0)];
}
- if ([[AIAccountPlusFieldPromptController superclass] instancesRespondToSelector:@selector(controlTextDidChange:)])
+ if ([[AIAccountPlusFieldPromptController superclass] instancesRespondToSelector:@selector(controlTextDidChange:)]) {
[super controlTextDidChange:aNotification];
+ }
}
-//Account menu ---------------------------------------------------------------------------------------------------------
#pragma mark Account menu
-//Account menu delegate
-- (void)accountMenu:(AIAccountMenu *)inAccountMenu didRebuildMenuItems:(NSArray *)menuItems {
+
+// Account menu delegate
+- (void)accountMenu:(AIAccountMenu *)inAccountMenu didRebuildMenuItems:(NSArray *)menuItems
+{
[popUp_service setMenu:[inAccountMenu menu]];
}
-- (void)accountMenu:(AIAccountMenu *)inAccountMenu didSelectAccount:(AIAccount *)inAccount {
- [self _configureTextFieldForAccount:inAccount];
+
+- (void)accountMenu:(AIAccountMenu *)inAccountMenu didSelectAccount:(AIAccount *)inAccount
+{
+ [self AI_configureTextFieldForAccount:inAccount];
}
-- (BOOL)accountMenu:(AIAccountMenu *)inAccountMenu shouldIncludeAccount:(AIAccount *)inAccount {
+
+- (BOOL)accountMenu:(AIAccountMenu *)inAccountMenu shouldIncludeAccount:(AIAccount *)inAccount
+{
return inAccount.online;
}
@@ -246,10 +254,10 @@
return anyItem;
}
-//Select the last used account / Available online account
+// Select the last used account / Available online account
- (void)_selectLastUsedAccountInAccountMenu:(AIAccountMenu *)inAccountMenu
{
- //First online account in our list
+ // First online account in our list
AIAccount *preferredAccount;
for (preferredAccount in adium.accountController.accounts) {
if (preferredAccount.online)
@@ -260,7 +268,7 @@
if (menuItem) {
[popUp_service selectItem:menuItem];
- [self _configureTextFieldForAccount:preferredAccount];
+ [self AI_configureTextFieldForAccount:preferredAccount];
}
}
diff -r 00e52040c19f -r 09f21de0e8f2 Frameworks/Adium Framework/Source/AIListOutlineView.h
--- a/Frameworks/Adium Framework/Source/AIListOutlineView.h Sun Jan 22 23:44:39 2012 -0500
+++ b/Frameworks/Adium Framework/Source/AIListOutlineView.h Tue Jan 24 21:20:40 2012 +0200
@@ -56,13 +56,14 @@
@property (readonly, nonatomic) NSInteger desiredHeight;
@property (readonly, nonatomic) NSInteger desiredWidth;
-//Contact menu
+// Contact menu
@property (readonly, nonatomic) AIListObject *listObject;
@property (readonly, nonatomic) NSArray *arrayOfListObjects;
@property (readonly, nonatomic) NSArray *arrayOfListObjectsWithGroups;
@property (readonly, nonatomic) AIListContact *firstVisibleListContact;
-//Contacts
+// Contacts
+
/*!
* @brief Index of the first visible list contact
*
@@ -81,10 +82,10 @@
@property (readwrite, nonatomic, retain) NSColor *highlightColor;
@property (readwrite, nonatomic, retain) NSColor *alternatingRowColor;
-//Shadows
+// Shadows
- (void)setUpdateShadowsWhileDrawing:(BOOL)update;
-//Backgrounds
+// Backgrounds
- (void)setBackgroundImage:(NSImage *)inImage;
- (void)setBackgroundStyle:(AIBackgroundStyle)inBackgroundStyle;
- (void)setBackgroundOpacity:(CGFloat)opacity forWindowStyle:(AIContactListWindowStyle)windowStyle;
diff -r 00e52040c19f -r 09f21de0e8f2 Frameworks/Adium Framework/Source/AIListOutlineView.m
--- a/Frameworks/Adium Framework/Source/AIListOutlineView.m Sun Jan 22 23:44:39 2012 -0500
+++ b/Frameworks/Adium Framework/Source/AIListOutlineView.m Tue Jan 24 21:20:40 2012 +0200
@@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License along with this program; if not,
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#import "AIContactController.h"
#import <Adium/AIInterfaceControllerProtocol.h>
#import <Adium/AIListCell.h>
@@ -27,15 +28,19 @@
#import "AISCLViewPlugin.h"
@interface AIListOutlineView ()
-- (void)_initListOutlineView;
+
+- (void)AI_initListOutlineView;
+
@end
@implementation AIListOutlineView
+ (void)initialize
{
- if (self != [AIListOutlineView class])
+ if (self != [AIListOutlineView class]) {
return;
+ }
+
[self exposeBinding:@"desiredHeight"];
[self exposeBinding:@"totalHeight"];
}
@@ -43,28 +48,34 @@
+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key
{
NSSet *superSet = [super keyPathsForValuesAffectingValueForKey:key];
- if ([key isEqualToString:@"desiredHeight"])
+
+ if ([key isEqualToString:@"desiredHeight"]) {
return [superSet setByAddingObject:@"totalHeight"];
+ }
+
return superSet;
}
- (id)initWithCoder:(NSCoder *)aDecoder
{
- [super initWithCoder:aDecoder];
- [self _initListOutlineView];
+ if ((self = [super initWithCoder:aDecoder])) {
+ [self AI_initListOutlineView];
+ }
+
return self;
}
- (id)initWithFrame:(NSRect)frame
{
-
- [super initWithFrame:frame];
- [self _initListOutlineView];
- [self registerForDraggedTypes:[NSArray arrayWithObjects:@"AIListContact",@"AIListObject",nil]];
+ if ((self = [super initWithFrame:frame])) {
+ [self AI_initListOutlineView];
+ [self registerForDraggedTypes:[NSArray arrayWithObjects:@"AIListContact",@"AIListObject",nil]];
+ }
+
return self;
}
-- (void)_initListOutlineView
+- (void)AI_initListOutlineView
{
updateShadowsWhileDrawing = NO;
@@ -107,7 +118,7 @@
groupsHaveBackground = [[prefDict objectForKey:KEY_LIST_THEME_GROUP_GRADIENT] boolValue];
}
-//Keep our column full width
+// Keep our column full width
- (void)setFrameSize:(NSSize)newSize
{
[super setFrameSize:newSize];
@@ -130,6 +141,7 @@
}
#pragma mark Sizing
+
/*!
* @brief Get the desired height for the outline view
*
@@ -157,18 +169,22 @@
{
NSInteger row;
NSInteger numberOfRows = [self numberOfRows];
- CGFloat widestCell = 0;
+ CGFloat widestCell = 0;
id theDelegate = self.delegate;
- //Enumerate all rows, find the widest one
+ // Enumerate all rows, find the widest one
for (row = 0; row < numberOfRows; row++) {
- id item = [self itemAtRow:row];
- NSCell *cell = ([theDelegate outlineView:self isGroup:item] ? groupCell : contentCell);
+ id item = [self itemAtRow:row];
+ NSCell *cell = ([theDelegate outlineView:self isGroup:item] ? groupCell : contentCell);
[theDelegate outlineView:self willDisplayCell:cell forTableColumn:nil item:item];
CGFloat width = [(AIListCell *)cell cellWidth];
- if (width > widestCell) widestCell = width;
+
+ if (width > widestCell) {
+ widestCell = width;
+ }
}
+
return ((widestCell > minimumDesiredWidth) ? widestCell : minimumDesiredWidth);
}
@@ -181,7 +197,10 @@
}
#pragma mark List object access
-//Return the selected object (to auto-configure the contact menu)
+
+/*!
+ * @brief Return the selected object (to auto-configure the contact menu)
+ */
- (AIListObject *)listObject
{
NSInteger selectedRow = [self selectedRow];
@@ -240,14 +259,15 @@
}
#pragma mark Group expanding
+
/*!
* @brief Expand or collapses groups on mouse down
*/
- (void)mouseDown:(NSEvent *)theEvent
{
NSPoint viewPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];
- NSInteger row = [self rowAtPoint:viewPoint];
- id item = [self itemAtRow:row];
+ NSInteger row = [self rowAtPoint:viewPoint];
+ id item = [self itemAtRow:row];
// Let super handle it if it's not a group, or the command key is down (dealing with selection)
// Allow clickthroughs for triangle disclosure only.
@@ -256,7 +276,7 @@
return;
}
- //Wait for the next event
+ // Wait for the next event
NSEvent *nextEvent = [[self window] nextEventMatchingMask:(NSLeftMouseUpMask | NSLeftMouseDraggedMask | NSPeriodicMask)
untilDate:[NSDate distantFuture]
inMode:NSEventTrackingRunLoopMode
@@ -293,7 +313,7 @@
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
- //From previous implementation - still needed?
+ // From previous implementation - still needed?
[[sender draggingDestinationWindow] makeKeyAndOrderFront:self];
return [super draggingEntered:sender];
@@ -309,7 +329,8 @@
return YES;
}
-#pragma mark Copying selected objects via the data source
+#pragma mark Copying selected objects via the data source
+
- (IBAction)copy:(id)sender
{
id dataSource = [self dataSource];
@@ -329,6 +350,7 @@
}
#pragma mark Menu items
+
- (BOOL) validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem
{
if ([anItem action] == @selector(copy:))
@@ -339,6 +361,7 @@
#pragma mark Accessibility
#if ACCESSIBILITY_DEBUG
+
- (NSArray *)accessibilityAttributeNames
{
AILogWithSignature(@"names: %@", [super accessibilityAttributeNames]);
@@ -351,7 +374,7 @@
return [super accessibilityAttributeValue:attribute];
}
+
#endif
@end
-
diff -r 00e52040c19f -r 09f21de0e8f2 Frameworks/Adium Framework/Source/CSNewContactAlertWindowController.h
--- a/Frameworks/Adium Framework/Source/CSNewContactAlertWindowController.h Sun Jan 22 23:44:39 2012 -0500
+++ b/Frameworks/Adium Framework/Source/CSNewContactAlertWindowController.h Tue Jan 24 21:20:40 2012 +0200
@@ -19,29 +19,29 @@
@class AIImageTextCellView, AIActionDetailsPane;
@interface CSNewContactAlertWindowController : AIWindowController {
- IBOutlet NSView *view_auxiliary;
- IBOutlet NSPopUpButton *popUp_event;
- IBOutlet NSPopUpButton *popUp_action;
+ IBOutlet NSView *view_auxiliary;
+ IBOutlet NSPopUpButton *popUp_event;
+ IBOutlet NSPopUpButton *popUp_action;
- IBOutlet NSButton *checkbox_oneTime;
+ IBOutlet NSButton *checkbox_oneTime;
- IBOutlet NSButton *button_OK;
- IBOutlet NSButton *button_cancel;
- IBOutlet NSTextField *label_Event;
- IBOutlet NSTextField *label_Action;
+ IBOutlet NSButton *button_OK;
+ IBOutlet NSButton *button_cancel;
+ IBOutlet NSTextField *label_Event;
+ IBOutlet NSTextField *label_Action;
- AIActionDetailsPane *detailsPane;
- NSView *detailsView;
- NSMutableDictionary *alert;
+ AIActionDetailsPane *detailsPane;
+ NSView *detailsView;
+ NSMutableDictionary *alert;
- id target;
- NSDictionary *oldAlert;
+ id target;
+ NSDictionary *oldAlert;
- AIListObject *listObject;
+ AIListObject *listObject;
- BOOL configureForGlobal;
+ BOOL configureForGlobal;
- IBOutlet AIImageTextCellView *headerView;
+ IBOutlet AIImageTextCellView *headerView;
}
/*!
diff -r 00e52040c19f -r 09f21de0e8f2 Frameworks/Adium Framework/Source/CSNewContactAlertWindowController.m
--- a/Frameworks/Adium Framework/Source/CSNewContactAlertWindowController.m Sun Jan 22 23:44:39 2012 -0500
+++ b/Frameworks/Adium Framework/Source/CSNewContactAlertWindowController.m Tue Jan 24 21:20:40 2012 +0200
@@ -25,6 +25,7 @@
#define NEW_ALERT_NO_EVENTS_NIB @"NewAlertNoEvents"
@interface CSNewContactAlertWindowController ()
+
- (id)initWithWindowNibName:(NSString *)windowNibName
alert:(NSDictionary *)inAlert
forListObject:(AIListObject *)inListObject
@@ -40,11 +41,12 @@
- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
- (void)alertDetailsForHeaderChanged:(NSNotification *)aNotification;
+
@end
@implementation CSNewContactAlertWindowController
-//Prompt for a new alert. Pass nil for a panel prompt.
+// Prompt for a new alert. Pass nil for a panel prompt.
+ (CSNewContactAlertWindowController *)editAlert:(NSDictionary *)inAlert
forListObject:(AIListObject *)inObject
onWindow:(NSWindow *)parentWindow
@@ -74,7 +76,7 @@
return newController;
}
-//Init
+// Init
- (id)initWithWindowNibName:(NSString *)windowNibName
alert:(NSDictionary *)inAlert
forListObject:(AIListObject *)inListObject
@@ -82,36 +84,35 @@
configureForGlobal:(BOOL)inConfigureForGlobal
defaultEventID:(NSString *)inDefaultEventID
{
- [super initWithWindowNibName:windowNibName];
-
- //
- oldAlert = [inAlert retain];
- listObject = [inListObject retain];
- target = inTarget;
- detailsPane = nil;
- configureForGlobal = inConfigureForGlobal;
-
- //Create a mutable copy of the alert dictionary we're passed. If we're passed nil, create the default alert.
- alert = [inAlert mutableCopy];
- if (!alert) {
- /*
- if (!defaultEventID) {
- defaultEventID = [adium.contactAlertsController defaultEventID];
+ if ((self = [super initWithWindowNibName:windowNibName])) {
+ oldAlert = [inAlert retain];
+ listObject = [inListObject retain];
+ target = inTarget;
+ detailsPane = nil;
+ configureForGlobal = inConfigureForGlobal;
+
+ // Create a mutable copy of the alert dictionary we're passed. If we're passed nil, create the default alert.
+ alert = [inAlert mutableCopy];
+ if (!alert) {
+ /*
+ if (!defaultEventID) {
+ defaultEventID = [adium.contactAlertsController defaultEventID];
+ }
+ */
+ alert = [[NSMutableDictionary alloc] initWithObjectsAndKeys:inDefaultEventID, KEY_EVENT_ID,
+ [adium.contactAlertsController defaultActionID], KEY_ACTION_ID, nil];
}
-*/
- alert = [[NSMutableDictionary alloc] initWithObjectsAndKeys:inDefaultEventID, KEY_EVENT_ID,
- [adium.contactAlertsController defaultActionID], KEY_ACTION_ID, nil];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(alertDetailsForHeaderChanged:)
+ name:CONTACT_ALERTS_DETAILS_FOR_HEADER_CHANGED
+ object:nil];
}
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(alertDetailsForHeaderChanged:)
- name:CONTACT_ALERTS_DETAILS_FOR_HEADER_CHANGED
- object:nil];
-
return self;
}
-//Dealloc
+// Dealloc
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
@@ -124,14 +125,14 @@
[super dealloc];
}
-//Setup the window before it is displayed
+// Setup the window before it is displayed
- (void)windowDidLoad
{
if ([[self superclass] instancesRespondToSelector:@selector(windowDidLoad)]) {
- [super windowDidLoad];
+ [super windowDidLoad];
}
- //Configure window
+ // Configure window
[[self window] center];
[popUp_event setMenu:[adium.contactAlertsController menuOfEventsWithTarget:self forGlobalMenu:configureForGlobal]];
[popUp_action setMenu:[adium.contactAlertsController menuOfActionsWithTarget:self]];
@@ -145,7 +146,7 @@
[label_Event setLocalizedString:AILocalizedString(@"Event:", "Label for contact alert event (e.g. Contact signed on, Message received, etc.)")];
[label_Action setLocalizedString:AILocalizedString(@"Action:", "Label for contact alert action (e.g. Send message, Play sound, etc.)")];
- //Remove the single-fire option for global
+ // Remove the single-fire option for global
if (configureForGlobal) {
if ([checkbox_oneTime respondsToSelector:@selector(setHidden:)]) {
[checkbox_oneTime setHidden:YES];
@@ -154,57 +155,55 @@
}
}
- //Set things up for the current event
+ // Set things up for the current event
[self configureForEvent];
}
-//Window is closing
+// Window is closing
- (void)windowWillClose:(id)sender
{
[super windowWillClose:sender];
[self cleanUpDetailsPane];
}
-//Called as the user list edit sheet closes, dismisses the sheet
+// Called as the user list edit sheet closes, dismisses the sheet
- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
[sheet orderOut:nil];
[self cleanUpDetailsPane];
}
+#pragma mark Buttons
-//Buttons --------------------------------------------------------------------------------------------------------------
-#pragma mark Buttons
-//Cancel changes
+// Cancel changes
- (IBAction)cancel:(id)sender
{
- //Pass the modified alert to our target
+ // Pass the modified alert to our target
[target performSelector:@selector(alertUpdated:oldAlert:) withObject:nil withObject:oldAlert];
[self closeWindow:nil];
}
-//Save changes
+// Save changes
- (IBAction)save:(id)sender
{
- //Save changes in our detail pane
+ // Save changes in our detail pane
[self saveDetailsPaneChanges];
- //Pass the modified alert to our target
+ // Pass the modified alert to our target
[target performSelector:@selector(alertUpdated:oldAlert:) withObject:alert withObject:oldAlert];
[self closeWindow:nil];
}
+#pragma mark Controls
-//Controls -------------------------------------------------------------------------------------------------------------
-#pragma mark Controls
-//Configure window for our current event dict
+// Configure window for our current event dict
- (void)configureForEvent
{
NSEnumerator *enumerator;
NSMenuItem *menuItem;
- //Select the correct event
+ // Select the correct event
NSString *eventID = [alert objectForKey:KEY_EVENT_ID];
enumerator = [[popUp_event itemArray] objectEnumerator];
while ((menuItem = [enumerator nextObject])) {
@@ -214,8 +213,8 @@
}
}
- //Select the correct action
- NSString *actionID = [alert objectForKey:KEY_ACTION_ID];
+ // Select the correct action
+ NSString *actionID = [alert objectForKey:KEY_ACTION_ID];
enumerator = [[popUp_action itemArray] objectEnumerator];
while ((menuItem = [enumerator nextObject])) {
if ([actionID isEqualToString:[menuItem representedObject]]) {
@@ -224,49 +223,51 @@
}
}
- //Setup our single-fire option
+ // Setup our single-fire option
if (!configureForGlobal) {
[checkbox_oneTime setState:[[alert objectForKey:KEY_ONE_TIME_ALERT] intValue]];
}
- //Configure the action details pane
+ // Configure the action details pane
[self configureDetailsPane];
}
-//Save changes made in the details pane
+// Save changes made in the details pane
- (void)saveDetailsPaneChanges
{
- //Save details
+ // Save details
NSDictionary *actionDetails = [detailsPane actionDetails];
if (actionDetails) {
[alert setObject:actionDetails forKey:KEY_ACTION_DETAILS];
}
- //Save our single-fire option
+ // Save our single-fire option
[alert setObject:[NSNumber numberWithBool:([checkbox_oneTime state] == NSOnState)] forKey:KEY_ONE_TIME_ALERT];
}
-//Remove details view/pane
+// Remove details view/pane
- (void)cleanUpDetailsPane
{
- [detailsView removeFromSuperview];
- detailsView = nil;
+ [detailsView removeFromSuperview], detailsView = nil;
+
[detailsPane closeView];
- [detailsPane release];
- detailsPane = nil;
+ [detailsPane release], detailsPane = nil;
}
-//Configure the details pane for our current alert
+// Configure the details pane for our current alert
- (void)configureDetailsPane
{
NSString *actionID = [alert objectForKey:KEY_ACTION_ID];
id <AIActionHandler> actionHandler = [[adium.contactAlertsController actionHandlers] objectForKey:actionID];
- //Save changes and close down the old pane
- if (detailsPane) [self saveDetailsPaneChanges];
+ // Save changes and close down the old pane
+ if (detailsPane) {
+ [self saveDetailsPaneChanges];
+ }
+
[self cleanUpDetailsPane];
- //Get a new pane for the current action type, and configure it for our alert
+ // Get a new pane for the current action type, and configure it for our alert
detailsPane = [[actionHandler detailsPaneForActionID:actionID] retain];
if (detailsPane) {
NSDictionary *actionDetails = [alert objectForKey:KEY_ACTION_DETAILS];
@@ -278,7 +279,7 @@
listObject:listObject];
}
- //Resize our window for best fit
+ // Resize our window for best fit
CGFloat currentDetailHeight = [view_auxiliary frame].size.height;
CGFloat desiredDetailHeight = [detailsView frame].size.height;
CGFloat difference = (currentDetailHeight - desiredDetailHeight);
@@ -287,20 +288,22 @@
display:[[self window] isVisible]
animate:[[self window] isVisible]];
- //Add the details view
- if (detailsView) [view_auxiliary addSubview:detailsView];
+ // A dd the details view
+ if (detailsView) {
+ [view_auxiliary addSubview:detailsView];
+ }
- //Pull any default values the pane set in configureForActionDetails
+ // Pull any default values the pane set in configureForActionDetails
[self saveDetailsPaneChanges];
- //And use them to update our header view
+ // And use them to update our header view
[self updateHeaderView];
}
-//User selected an event from the popup
+// User selected an event from the popup
- (IBAction)selectEvent:(id)sender
{
- NSString *eventID;
+ NSString *eventID;
if ((eventID = [sender representedObject])) {
[alert setObject:eventID forKey:KEY_EVENT_ID];
@@ -311,7 +314,7 @@
}
}
-//User selected an action from the popup
+// User selected an action from the popup
- (IBAction)selectAction:(id)sender
{
if ([sender representedObject]) {
@@ -334,11 +337,11 @@
- (void)updateHeaderView
{
- NSString *actionID = [alert objectForKey:KEY_ACTION_ID];
- NSString *eventID = [alert objectForKey:KEY_EVENT_ID];
- NSString *eventDescription = [adium.contactAlertsController longDescriptionForEventID:eventID
+ NSString *actionID = [alert objectForKey:KEY_ACTION_ID];
+ NSString *eventID = [alert objectForKey:KEY_EVENT_ID];
+ NSString *eventDescription = [adium.contactAlertsController longDescriptionForEventID:eventID
forListObject:listObject];
- id <AIActionHandler> actionHandler = [[adium.contactAlertsController actionHandlers] objectForKey:actionID];
+ id <AIActionHandler> actionHandler = [[adium.contactAlertsController actionHandlers] objectForKey:actionID];
if (actionHandler && eventDescription) {
[headerView setStringValue:eventDescription];
diff -r 00e52040c19f -r 09f21de0e8f2 Frameworks/Adium Framework/Source/DCJoinChatWindowController.h
--- a/Frameworks/Adium Framework/Source/DCJoinChatWindowController.h Sun Jan 22 23:44:39 2012 -0500
+++ b/Frameworks/Adium Framework/Source/DCJoinChatWindowController.h Tue Jan 24 21:20:40 2012 +0200
@@ -20,18 +20,16 @@
@class AILocalizationTextField, AILocalizationButton, AIListContact, DCJoinChatViewController;
@interface DCJoinChatWindowController : AIWindowController <AIAccountMenuDelegate> {
- IBOutlet NSPopUpButton *popUp_service; //Account selector
- IBOutlet NSView *view_customView; //View containing service-specific controls
+ IBOutlet NSPopUpButton *popUp_service; // Account selector
+ IBOutlet NSView *view_customView; // View containing service-specific controls
- IBOutlet AILocalizationTextField *label_account;
- IBOutlet AILocalizationButton *button_joinChat;
- IBOutlet AILocalizationButton *button_cancel;
+ IBOutlet AILocalizationTextField *label_account;
+ IBOutlet AILocalizationButton *button_joinChat;
+ IBOutlet AILocalizationButton *button_cancel;
- DCJoinChatViewController *joinChatViewController; //Current view controller
+ DCJoinChatViewController *joinChatViewController; // Current view controller
- AIAccountMenu *accountMenu;
-
-
+ AIAccountMenu *accountMenu;
}
+ (DCJoinChatWindowController *)showJoinChatWindow;
diff -r 00e52040c19f -r 09f21de0e8f2 Frameworks/Adium Framework/Source/DCJoinChatWindowController.m
--- a/Frameworks/Adium Framework/Source/DCJoinChatWindowController.m Sun Jan 22 23:44:39 2012 -0500
+++ b/Frameworks/Adium Framework/Source/DCJoinChatWindowController.m Tue Jan 24 21:20:40 2012 +0200
@@ -27,9 +27,11 @@
#define JOIN_CHAT_NIB @"JoinChatWindow"
@interface DCJoinChatWindowController ()
+
- (id)initWithWindowNibName:(NSString *)windowNibName;
- (void)windowDidLoad;
- (void)_selectPreferredAccountInAccountMenu:(AIAccountMenu *)inAccountMenu;
+
@end
@implementation DCJoinChatWindowController
@@ -38,7 +40,7 @@
static DCJoinChatWindowController *sharedJoinChatInstance = nil;
-//Create a new join chat window
+// Create a new join chat window
+ (DCJoinChatWindowController *)showJoinChatWindow
{
if (!sharedJoinChatInstance) {
@@ -71,16 +73,16 @@
NSRect windowFrame = [[self window] frame];
CGFloat diff;
- //Remove the previous view controller's view
+ // Remove the previous view controller's view
[[self.joinChatViewController view] removeFromSuperview];
- //Get a view controller for this account if there is one
+ // Get a view controller for this account if there is one
self.joinChatViewController = [inAccount.service joinChatView];
NSView *currentView = [self.joinChatViewController view];
[self.joinChatViewController setDelegate:self];
[self.joinChatViewController setSharedChatInstance:self];
- //Resize the window to fit the new view
+ // Resize the window to fit the new view
diff = NSHeight([view_customView frame]) - NSHeight([currentView frame]);
windowFrame.size.height -= diff;
windowFrame.origin.y += diff;
@@ -102,12 +104,12 @@
}
}
-//Init
+// Init
- (id)initWithWindowNibName:(NSString *)windowNibName
-{
- [super initWithWindowNibName:windowNibName];
-
- self.joinChatViewController = nil;
+{
+ if ((self = [super initWithWindowNibName:windowNibName])) {
+ self.joinChatViewController = nil;
+ }
return self;
}
@@ -119,24 +121,24 @@
[super dealloc];
}
-//Setup the window before it is displayed
+// Setup the window before it is displayed
- (void)windowDidLoad
{
- //Localized strings
+ // Localized strings
[[self window] setTitle:AILocalizedString(@"Join Chat", nil)];
[label_account setLocalizedString:AILocalizedString(@"Account:", nil)];
[button_joinChat setLocalizedString:AILocalizedString(@"Join", nil)];
[button_cancel setLocalizedString:AILocalizedString(@"Cancel", nil)];
- //Account menu
+ // Account menu
accountMenu = [[AIAccountMenu accountMenuWithDelegate:self
submenuType:AIAccountNoSubmenu
showTitleVerbs:NO] retain];
[self configureForAccount:[[popUp_service selectedItem] representedObject]];
- //Center the window
+ // Center the window
[[self window] center];
More information about the commits
mailing list