Importing the skeleton of system tray implementation and making sure it compiles and works
There was an interesting "problem" due to automatic reference counting
(-fobjc-arc flag). XCode includes this flag by default, so making sure
that wscript is doing the same thing.
diff --git a/osx/Info.plist b/osx/Info.plist
index 24e72d7..bafb8e6 100644
--- a/osx/Info.plist
+++ b/osx/Info.plist
@@ -2,23 +2,33 @@
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
<key>CFBundleExecutable</key>
<string>NDNx Control Center</string>
- <key>CFBundleGetInfoString</key>
- <string>Created by Waf</string>
<key>CFBundleIconFile</key>
<string>ndnx-main.icns</string>
<key>CFBundleIdentifier</key>
<string>net.named-data.control-center</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>NDNx Control Center</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
- <key>NOTE</key>
- <string>THIS IS A GENERATED FILE, DO NOT MODIFY</string>
+ <key>CFBundleShortVersionString</key>
+ <string>0.0.1</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>10.6</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
- <!-- <key>LSUIElement</key> -->
- <!-- <string>1</string> -->
+ <key>LSUIElement</key>
+ <string>1</string>
</dict>
</plist>
diff --git a/osx/MainMenu.xib b/osx/MainMenu.xib
new file mode 100644
index 0000000..c8a70f5
--- /dev/null
+++ b/osx/MainMenu.xib
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4510" systemVersion="12F37" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+ <dependencies>
+ <deployment defaultVersion="1080" identifier="macosx"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4510"/>
+ </dependencies>
+ <objects>
+ <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
+ <connections>
+ <outlet property="delegate" destination="494" id="495"/>
+ </connections>
+ </customObject>
+ <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+ <customObject id="-3" userLabel="Application"/>
+ <customObject id="494" customClass="MenuDelegate">
+ <connections>
+ <outlet property="statusMenu" destination="ovl-jc-kIR" id="dlz-Qz-Ia0"/>
+ </connections>
+ </customObject>
+ <customObject id="420" customClass="NSFontManager"/>
+ <menu id="ovl-jc-kIR">
+ <items>
+ <menuItem title="start" id="yhj-L6-nZL">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ <menuItem title="stop" id="TvT-OR-oT4">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ <menuItem title="ndnstatus" id="Tap-5m-ZRP">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ <menuItem title="Item" id="17X-uc-n9i">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ </items>
+ </menu>
+ </objects>
+</document>
diff --git a/osx/ndnx-main.icns b/osx/Resources/ndnx-main.icns
similarity index 100%
rename from osx/ndnx-main.icns
rename to osx/Resources/ndnx-main.icns
Binary files differ
diff --git a/osx/ndnx-tray.icns b/osx/Resources/ndnx-tray.icns
similarity index 100%
rename from osx/ndnx-tray.icns
rename to osx/Resources/ndnx-tray.icns
Binary files differ
diff --git a/osx/main.mm b/osx/main.mm
index edc5186..c306608 100644
--- a/osx/main.mm
+++ b/osx/main.mm
@@ -3,11 +3,12 @@
* @copyright See LICENCE for copyright and license information.
*
* @author Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * @author Ilya Moiseenko <iliamo@ucla.edu>
*/
#import <Cocoa/Cocoa.h>
-int main(int argc, char *argv[])
+int main(int argc, const char **argv)
{
- return NSApplicationMain(argc, (const char **)argv);
+ return NSApplicationMain (argc, argv);
}
diff --git a/osx/menu-delegate.h b/osx/menu-delegate.h
new file mode 100644
index 0000000..6aa434f
--- /dev/null
+++ b/osx/menu-delegate.h
@@ -0,0 +1,17 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * @copyright See LICENCE for copyright and license information.
+ *
+ * @author Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * @author Ilya Moiseenko <iliamo@ucla.edu>
+ */
+
+#import <Cocoa/Cocoa.h>
+
+@interface MenuDelegate : NSObject <NSApplicationDelegate>
+{
+ IBOutlet NSMenu *statusMenu;
+ NSStatusItem * statusItem;
+}
+
+@end
diff --git a/osx/menu-delegate.mm b/osx/menu-delegate.mm
new file mode 100644
index 0000000..8418f6f
--- /dev/null
+++ b/osx/menu-delegate.mm
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * @copyright See LICENCE for copyright and license information.
+ *
+ * @author Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * @author Ilya Moiseenko <iliamo@ucla.edu>
+ */
+
+#import "menu-delegate.h"
+
+@implementation MenuDelegate
+
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
+{
+ // Insert code here to initialize your application
+}
+
+// -(void)dealloc
+// {
+// [statusItem release];
+// [super dealloc];
+// }
+
+-(void)awakeFromNib
+{
+ statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
+ [statusItem setTitle:@"X"];
+ [statusItem setMenu:statusMenu];
+ [statusItem setHighlightMode:YES];
+}
+
+@end
diff --git a/osx/sparkle-auto-update.mm b/osx/sparkle-auto-update.mm
index a1dc5c0..a515a79 100644
--- a/osx/sparkle-auto-update.mm
+++ b/osx/sparkle-auto-update.mm
@@ -21,7 +21,7 @@
SparkleAutoUpdate::SparkleAutoUpdate(const char *updateUrl)
{
d = new Private;
- d->updater = [[SUUpdater sharedUpdater] retain];
+ d->updater = [SUUpdater sharedUpdater];
NSURL *url = [NSURL URLWithString: [NSString stringWithCString:updateUrl encoding:NSASCIIStringEncoding]];
[d->updater setFeedURL: url];
[d->updater setAutomaticallyChecksForUpdates: YES];
@@ -30,7 +30,7 @@
SparkleAutoUpdate::~SparkleAutoUpdate()
{
- [d->updater release];
+ // [d->updater release];
delete d;
// presummably SUUpdater handles garbage collection
}