Skip to content
This repository has been archived by the owner on Sep 4, 2018. It is now read-only.

Commit

Permalink
Merge pull request #382 from alcatraz/menu-item-missing-fix
Browse files Browse the repository at this point in the history
Subscribe to Xcode launch notification synchronously
  • Loading branch information
supermarin committed Nov 13, 2015
2 parents 8fd26cd + 601e2e9 commit df815bc
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions Alcatraz/Alcatraz.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,22 @@ + (NSString *)localizedStringForKey:(NSString *)key {
- (id)initWithBundle:(NSBundle *)plugin {
if (self = [super init]) {
self.bundle = plugin;
[[NSOperationQueue mainQueue] addOperationWithBlock:^{

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(xcodeDidFinishLaunching:)
name:NSApplicationDidFinishLaunchingNotification
object:nil];
}];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(xcodeDidFinishLaunching:)
name:NSApplicationDidFinishLaunchingNotification
object:nil];
[self updateAlcatraz];
}
return self;
}

- (void) xcodeDidFinishLaunching: (NSNotification *) notification {
[self createMenuItem];

- (void)xcodeDidFinishLaunching: (NSNotification *) notification {
[[NSNotificationCenter defaultCenter] removeObserver:self
name:NSApplicationDidFinishLaunchingNotification
object:nil];
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[self createMenuItem];
}];
}

#pragma mark - Private
Expand Down

0 comments on commit df815bc

Please sign in to comment.