Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions XLocation.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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";
Expand Down
48 changes: 37 additions & 11 deletions XLocation/LXLocation.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,28 +78,54 @@ + (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]) {
// reference to plugin's bundle, for resource acccess
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;
}
Expand Down
1 change: 1 addition & 0 deletions XLocation/XLocation-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<string>C4A681B0-4A26-480E-93EC-1218098B9AA0</string>
<string>A16FF353-8441-459E-A50C-B071F53F51B7</string>
<string>9F75337B-21B4-4ADC-B558-F9CADF7073A7</string>
<string>7FDF5C7A-131F-4ABB-9EDC-8C5F8F0B8A90</string>
</array>
<key>NSPrincipalClass</key>
<string>LXLocation</string>
Expand Down