Permalink
Browse files

Fixes accessors for ARC.

  • Loading branch information...
1 parent b256404 commit ec6bc3c1a76f6f4da070aab5b98ca3ef35eddb17 @shpakovski committed Apr 9, 2012
Showing with 10 additions and 17 deletions.
  1. +2 −5 Popup/ApplicationDelegate.h
  2. +6 −9 Popup/ApplicationDelegate.m
  3. +1 −1 Popup/MenubarController.h
  4. +1 −2 Popup/StatusItemView.m
@@ -1,13 +1,10 @@
#import "MenubarController.h"
#import "PanelController.h"
-@interface ApplicationDelegate : NSObject <NSApplicationDelegate, PanelControllerDelegate> {
- MenubarController *_menubarController;
- PanelController *_panelController;
-}
+@interface ApplicationDelegate : NSObject <NSApplicationDelegate, PanelControllerDelegate>
@property (nonatomic, strong) MenubarController *menubarController;
-@property (nonatomic, unsafe_unretained, readonly) PanelController *panelController;
+@property (nonatomic, strong, readonly) PanelController *panelController;
- (IBAction)togglePanel:(id)sender;
@@ -1,9 +1,8 @@
#import "ApplicationDelegate.h"
-void *kContextActivePanel = &kContextActivePanel;
-
@implementation ApplicationDelegate
+@synthesize panelController = _panelController;
@synthesize menubarController = _menubarController;
#pragma mark -
@@ -15,14 +14,14 @@ - (void)dealloc
#pragma mark -
+void *kContextActivePanel = &kContextActivePanel;
+
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
- if (context == kContextActivePanel)
- {
+ if (context == kContextActivePanel) {
self.menubarController.hasActiveIcon = self.panelController.hasActivePanel;
}
- else
- {
+ else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
@@ -39,7 +38,6 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sende
{
// Explicitly remove the icon from the menu bar
self.menubarController = nil;
-
return NSTerminateNow;
}
@@ -55,8 +53,7 @@ - (IBAction)togglePanel:(id)sender
- (PanelController *)panelController
{
- if (_panelController == nil)
- {
+ if (_panelController == nil) {
_panelController = [[PanelController alloc] initWithDelegate:self];
[_panelController addObserver:self forKeyPath:@"hasActivePanel" options:0 context:kContextActivePanel];
}
@@ -10,7 +10,7 @@
}
@property (nonatomic) BOOL hasActiveIcon;
-@property (nonatomic, unsafe_unretained, readonly) NSStatusItem *statusItem;
+@property (nonatomic, strong, readonly) NSStatusItem *statusItem;
@property (nonatomic, strong, readonly) StatusItemView *statusItemView;
@end
@@ -18,8 +18,7 @@ - (id)initWithStatusItem:(NSStatusItem *)statusItem
NSRect itemRect = NSMakeRect(0.0, 0.0, itemWidth, itemHeight);
self = [super initWithFrame:itemRect];
- if (self != nil)
- {
+ if (self != nil) {
_statusItem = statusItem;
_statusItem.view = self;
}

0 comments on commit ec6bc3c

Please sign in to comment.