diff --git a/XLocation.xcodeproj/project.pbxproj b/XLocation.xcodeproj/project.pbxproj
index 69befea..c1c1271 100644
--- a/XLocation.xcodeproj/project.pbxproj
+++ b/XLocation.xcodeproj/project.pbxproj
@@ -502,7 +502,6 @@
"$(inherited)",
"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/SharedFrameworks",
"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Frameworks",
- "$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/XLocation-bvfsktypljbpaqcugmxxgbcspdud/Build/Products/Debug",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "XLocation/XLocation-Prefix.pch";
@@ -528,7 +527,6 @@
"$(inherited)",
"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/SharedFrameworks",
"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Frameworks",
- "$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/XLocation-bvfsktypljbpaqcugmxxgbcspdud/Build/Products/Debug",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "XLocation/XLocation-Prefix.pch";
diff --git a/XLocation/LXLocation.m b/XLocation/LXLocation.m
index 7d3d97e..b7ac697 100644
--- a/XLocation/LXLocation.m
+++ b/XLocation/LXLocation.m
@@ -78,10 +78,45 @@ + (void)pluginDidLoad:(NSBundle *)plugin
if ([currentApplicationName isEqual:@"Xcode"]) {
dispatch_once(&onceToken, ^{
sharedPlugin = [[self alloc] initWithBundle:plugin];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(menuDidChange)
+ name:NSMenuDidChangeItemNotification
+ object:nil];
});
}
}
++ (void)menuDidChange
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:NSMenuDidChangeItemNotification
+ object:nil];
+
+ [sharedPlugin createMenu];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(menuDidChange)
+ name:NSMenuDidChangeItemNotification
+ object:nil];
+}
+
+- (void)createMenu
+{
+ if (!self.actionItem)
+ {
+ // Create new menu item in Debug
+ NSMenuItem *debugMenuItem = [[NSApp mainMenu] itemWithTitle:@"Debug"];
+ if (debugMenuItem) {
+ [[debugMenuItem submenu] addItem:[NSMenuItem separatorItem]];
+ self.actionItem = [[NSMenuItem alloc] initWithTitle:@"Add new Location"
+ action:@selector(addNewLocationMenu)
+ keyEquivalent:@""];
+ [[debugMenuItem submenu] addItem:self.actionItem];
+ }
+ }
+}
+
- (id)initWithBundle:(NSBundle *)plugin
{
if (self = [super init]) {
@@ -89,17 +124,8 @@ - (id)initWithBundle:(NSBundle *)plugin
self.bundle = plugin;
// Adds all observers
[self addObservers];
- // Create new menu item in Debug
- NSMenuItem *menuItem = [[NSApp mainMenu] itemWithTitle:@"Debug"];
- if (menuItem) {
- [[menuItem submenu] addItem:[NSMenuItem separatorItem]];
- self.actionItem = [[NSMenuItem alloc] initWithTitle:@"Add new Location"
- action:@selector(addNewLocationMenu)
- keyEquivalent:@""];
- [[menuItem submenu] addItem:self.actionItem];
- // Init interface
- [self loadWindow];
- }
+ // Init interface
+ [self loadWindow];
}
return self;
}
diff --git a/XLocation/XLocation-Info.plist b/XLocation/XLocation-Info.plist
index 7f633fd..4205bde 100644
--- a/XLocation/XLocation-Info.plist
+++ b/XLocation/XLocation-Info.plist
@@ -30,6 +30,7 @@
C4A681B0-4A26-480E-93EC-1218098B9AA0
A16FF353-8441-459E-A50C-B071F53F51B7
9F75337B-21B4-4ADC-B558-F9CADF7073A7
+ 7FDF5C7A-131F-4ABB-9EDC-8C5F8F0B8A90
NSPrincipalClass
LXLocation