mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-29 12:17:49 +02:00
Adding link paths and rename AppDelegate.m -> AppDelegate.mm
This commit is contained in:
parent
e561a43e5d
commit
a9b2ec910c
2 changed files with 18 additions and 7 deletions
54
Mac/I2Pd/AppDelegate.mm
Normal file
54
Mac/I2Pd/AppDelegate.mm
Normal file
|
@ -0,0 +1,54 @@
|
|||
//
|
||||
// AppDelegate.m
|
||||
// I2Pd
|
||||
//
|
||||
// Created by Mikal Villa on 29/03/16.
|
||||
// Copyright © 2016 Purple I2P. All rights reserved.
|
||||
//
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
#include "Daemon.h"
|
||||
|
||||
@interface AppDelegate ()
|
||||
|
||||
@property (strong, nonatomic) NSStatusItem *statusItem;
|
||||
|
||||
@end
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
||||
[self setupStatusItem];
|
||||
|
||||
Daemon.start();
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)aNotification {
|
||||
// Insert code here to tear down your application
|
||||
}
|
||||
|
||||
- (void)setupStatusItem {
|
||||
self.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength];
|
||||
self.statusItem.button.image = [NSImage imageNamed:@"menuBarIcon"];
|
||||
|
||||
[self updateStatusItemMenu];
|
||||
}
|
||||
|
||||
- (void)updateStatusItemMenu {
|
||||
NSMenu *menu = [[NSMenu alloc] init];
|
||||
[menu addItemWithTitle:@"Open console" action:@selector(openWebConsole:) keyEquivalent:@""];
|
||||
[menu addItemWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@""];
|
||||
self.statusItem.menu = menu;
|
||||
}
|
||||
|
||||
#pragma mark - Menu actions
|
||||
|
||||
- (void)openWebConsole:(id)sender
|
||||
{
|
||||
NSURL *URL = [NSURL URLWithString:@"http://127.0.0.1:7070"];
|
||||
[[NSWorkspace sharedWorkspace] openURL:URL];
|
||||
}
|
||||
|
||||
|
||||
@end
|
Loading…
Add table
Add a link
Reference in a new issue