Browse files

Enables ARC.

  • Loading branch information...
1 parent 5faafe1 commit b256404f618f734e1844a99f70283c05a8b8ece7 @shpakovski committed Apr 8, 2012
View
2 Popup.xcodeproj/project.pbxproj
@@ -297,6 +297,7 @@
DD4F7C2313C30F9F00825C6E /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CLANG_ENABLE_OBJC_ARC = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Popup/Popup-Prefix.pch";
INFOPLIST_FILE = "Popup/Popup-Info.plist";
@@ -308,6 +309,7 @@
DD4F7C2413C30F9F00825C6E /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CLANG_ENABLE_OBJC_ARC = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Popup/Popup-Prefix.pch";
INFOPLIST_FILE = "Popup/Popup-Info.plist";
View
5 Popup/ApplicationDelegate.h
@@ -2,13 +2,12 @@
#import "PanelController.h"
@interface ApplicationDelegate : NSObject <NSApplicationDelegate, PanelControllerDelegate> {
-@private
MenubarController *_menubarController;
PanelController *_panelController;
}
-@property (nonatomic, retain) MenubarController *menubarController;
-@property (nonatomic, readonly) PanelController *panelController;
+@property (nonatomic, strong) MenubarController *menubarController;
+@property (nonatomic, unsafe_unretained, readonly) PanelController *panelController;
- (IBAction)togglePanel:(id)sender;
View
6 Popup/ApplicationDelegate.m
@@ -10,11 +10,7 @@ @implementation ApplicationDelegate
- (void)dealloc
{
- [_menubarController release];
[_panelController removeObserver:self forKeyPath:@"hasActivePanel"];
- [_panelController release];
-
- [super dealloc];
}
#pragma mark -
@@ -36,7 +32,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
// Install icon into the menu bar
- [self.menubarController = [[MenubarController alloc] init] release];
+ self.menubarController = [[MenubarController alloc] init];
}
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
View
6 Popup/MenubarController.h
@@ -9,8 +9,8 @@
StatusItemView *_statusItemView;
}
-@property (nonatomic, assign) BOOL hasActiveIcon;
-@property (nonatomic, readonly) NSStatusItem *statusItem;
-@property (nonatomic, readonly) StatusItemView *statusItemView;
+@property (nonatomic) BOOL hasActiveIcon;
+@property (nonatomic, unsafe_unretained, readonly) NSStatusItem *statusItem;
+@property (nonatomic, strong, readonly) StatusItemView *statusItemView;
@end
View
2 Popup/MenubarController.m
@@ -25,8 +25,6 @@ - (id)init
- (void)dealloc
{
[[NSStatusBar systemStatusBar] removeStatusItem:self.statusItem];
- [_statusItemView release];
- [super dealloc];
}
#pragma mark -
View
18 Popup/PanelController.h
@@ -16,18 +16,18 @@
@interface PanelController : NSWindowController <NSWindowDelegate>
{
BOOL _hasActivePanel;
- BackgroundView *_backgroundView;
- id<PanelControllerDelegate> _delegate;
- NSSearchField *_searchField;
- NSTextField *_textField;
+ __unsafe_unretained BackgroundView *_backgroundView;
+ __unsafe_unretained id<PanelControllerDelegate> _delegate;
+ __unsafe_unretained NSSearchField *_searchField;
+ __unsafe_unretained NSTextField *_textField;
}
-@property (assign) IBOutlet BackgroundView *backgroundView;
-@property (assign) IBOutlet NSSearchField *searchField;
-@property (assign) IBOutlet NSTextField *textField;
+@property (nonatomic, unsafe_unretained) IBOutlet BackgroundView *backgroundView;
+@property (nonatomic, unsafe_unretained) IBOutlet NSSearchField *searchField;
+@property (nonatomic, unsafe_unretained) IBOutlet NSTextField *textField;
-@property (nonatomic, assign) BOOL hasActivePanel;
-@property (nonatomic, readonly) id<PanelControllerDelegate> delegate;
+@property (nonatomic) BOOL hasActivePanel;
+@property (nonatomic, unsafe_unretained, readonly) id<PanelControllerDelegate> delegate;
- (id)initWithDelegate:(id<PanelControllerDelegate>)delegate;
View
1 Popup/PanelController.m
@@ -36,7 +36,6 @@ - (id)initWithDelegate:(id<PanelControllerDelegate>)delegate
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSControlTextDidChangeNotification object:self.searchField];
- [super dealloc];
}
#pragma mark -
View
10 Popup/StatusItemView.h
@@ -5,17 +5,17 @@
NSStatusItem *_statusItem;
BOOL _isHighlighted;
SEL _action;
- id _target;
+ __unsafe_unretained id _target;
}
- (id)initWithStatusItem:(NSStatusItem *)statusItem;
-@property (nonatomic, readonly) NSStatusItem *statusItem;
-@property (nonatomic, retain) NSImage *image;
-@property (nonatomic, retain) NSImage *alternateImage;
+@property (nonatomic, strong, readonly) NSStatusItem *statusItem;
+@property (nonatomic, strong) NSImage *image;
+@property (nonatomic, strong) NSImage *alternateImage;
@property (nonatomic, setter = setHighlighted:) BOOL isHighlighted;
@property (nonatomic, readonly) NSRect globalRect;
@property (nonatomic) SEL action;
-@property (nonatomic, assign) id target;
+@property (nonatomic, unsafe_unretained) id target;
@end
View
29 Popup/StatusItemView.m
@@ -20,20 +20,12 @@ - (id)initWithStatusItem:(NSStatusItem *)statusItem
if (self != nil)
{
- _statusItem = [statusItem retain];
+ _statusItem = statusItem;
_statusItem.view = self;
}
return self;
}
-- (void)dealloc
-{
- [_statusItem release];
- [_image release];
- [_alternateImage release];
-
- [super dealloc];
-}
#pragma mark -
@@ -72,19 +64,20 @@ - (void)setHighlighted:(BOOL)newFlag
- (void)setImage:(NSImage *)newImage
{
- [newImage retain];
- [_image release];
- _image = newImage;
- [self setNeedsDisplay:YES];
+ if (_image != newImage) {
+ _image = newImage;
+ [self setNeedsDisplay:YES];
+ }
}
- (void)setAlternateImage:(NSImage *)newImage
{
- [newImage retain];
- [_alternateImage release];
- _alternateImage = newImage;
- if (self.isHighlighted)
- [self setNeedsDisplay:YES];
+ if (_alternateImage != newImage) {
+ _alternateImage = newImage;
+ if (self.isHighlighted) {
+ [self setNeedsDisplay:YES];
+ }
+ }
}
#pragma mark -

0 comments on commit b256404

Please sign in to comment.