Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
Enables ARC.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadim Shpakovski committed Apr 8, 2012
1 parent 5faafe1 commit b256404
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 46 deletions.
2 changes: 2 additions & 0 deletions Popup.xcodeproj/project.pbxproj
Expand Up @@ -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";
Expand All @@ -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";
Expand Down
5 changes: 2 additions & 3 deletions Popup/ApplicationDelegate.h
Expand Up @@ -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;

Expand Down
6 changes: 1 addition & 5 deletions Popup/ApplicationDelegate.m
Expand Up @@ -10,11 +10,7 @@ @implementation ApplicationDelegate

- (void)dealloc
{
[_menubarController release];
[_panelController removeObserver:self forKeyPath:@"hasActivePanel"];
[_panelController release];

[super dealloc];
}

#pragma mark -
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Popup/MenubarController.h
Expand Up @@ -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
2 changes: 0 additions & 2 deletions Popup/MenubarController.m
Expand Up @@ -25,8 +25,6 @@ - (id)init
- (void)dealloc
{
[[NSStatusBar systemStatusBar] removeStatusItem:self.statusItem];
[_statusItemView release];
[super dealloc];
}

#pragma mark -
Expand Down
18 changes: 9 additions & 9 deletions Popup/PanelController.h
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion Popup/PanelController.m
Expand Up @@ -36,7 +36,6 @@ - (id)initWithDelegate:(id<PanelControllerDelegate>)delegate
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSControlTextDidChangeNotification object:self.searchField];
[super dealloc];
}

#pragma mark -
Expand Down
10 changes: 5 additions & 5 deletions Popup/StatusItemView.h
Expand Up @@ -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
29 changes: 11 additions & 18 deletions Popup/StatusItemView.m
Expand Up @@ -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 -

Expand Down Expand Up @@ -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 -
Expand Down

0 comments on commit b256404

Please sign in to comment.