Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit 78bed5a64d6e0f9c6a607df30fc5d9c94a876771 @maccman maccman committed Jan 9, 2012
Showing with 5,557 additions and 0 deletions.
  1. BIN .DS_Store
  2. +25 −0 LICENSE
  3. +406 −0 MacGap.xcodeproj/project.pbxproj
  4. +7 −0 MacGap.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  5. BIN MacGap.xcodeproj/project.xcworkspace/xcuserdata/Alex.xcuserdatad/UserInterfaceState.xcuserstate
  6. +84 −0 MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/MacGap.xcscheme
  7. +22 −0 MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/xcschememanagement.plist
  8. BIN MacGap/.DS_Store
  9. +17 −0 MacGap/AppDelegate.h
  10. +32 −0 MacGap/AppDelegate.m
  11. BIN MacGap/Classes/.DS_Store
  12. +13 −0 MacGap/Classes/Commands/App.h
  13. +25 −0 MacGap/Classes/Commands/App.m
  14. +11 −0 MacGap/Classes/Commands/Dock.h
  15. +33 −0 MacGap/Classes/Commands/Dock.m
  16. +15 −0 MacGap/Classes/Commands/Growl.h
  17. +79 −0 MacGap/Classes/Commands/Growl.m
  18. +13 −0 MacGap/Classes/Commands/Path.h
  19. +30 −0 MacGap/Classes/Commands/Path.m
  20. +11 −0 MacGap/Classes/Commands/Sound.h
  21. +34 −0 MacGap/Classes/Commands/Sound.m
  22. +7 −0 MacGap/Classes/Constants.h
  23. +14 −0 MacGap/Classes/ContentView.h
  24. +31 −0 MacGap/Classes/ContentView.m
  25. +17 −0 MacGap/Classes/Utils.h
  26. +58 −0 MacGap/Classes/Utils.m
  27. +24 −0 MacGap/Classes/WebViewDelegate.h
  28. +90 −0 MacGap/Classes/WebViewDelegate.m
  29. +1 −0 MacGap/Growl.framework/Growl
  30. +1 −0 MacGap/Growl.framework/Headers
  31. +1 −0 MacGap/Growl.framework/Resources
  32. BIN MacGap/Growl.framework/Versions/A/Growl
  33. +5 −0 MacGap/Growl.framework/Versions/A/Headers/Growl.h
  34. +551 −0 MacGap/Growl.framework/Versions/A/Headers/GrowlApplicationBridge.h
  35. +341 −0 MacGap/Growl.framework/Versions/A/Headers/GrowlDefines.h
  36. +40 −0 MacGap/Growl.framework/Versions/A/Resources/Info.plist
  37. +34 −0 MacGap/Growl.framework/Versions/A/_CodeSignature/CodeResources
  38. +1 −0 MacGap/Growl.framework/Versions/Current
  39. +32 −0 MacGap/MacGap-Info.plist
  40. +15 −0 MacGap/MacGap-Prefix.pch
  41. +29 −0 MacGap/en.lproj/Credits.rtf
  42. +2 −0 MacGap/en.lproj/InfoPlist.strings
  43. +3,297 −0 MacGap/en.lproj/MainMenu.xib
  44. +14 −0 MacGap/main.m
  45. +61 −0 README.md
  46. BIN application.icns
  47. +34 −0 public/index.html
BIN .DS_Store
Binary file not shown.
25 LICENSE
@@ -0,0 +1,25 @@
+MacGap was ported from phonegap-mac, and is under the same license (MIT)
+
+The MIT License
+*****************
+
+Copyright (c) <2012> <Nitobi Software Inc., et. al., >
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "FAE451B914BA79C600190544"
+ BuildableName = "MacGap.app"
+ BlueprintName = "MacGap"
+ ReferencedContainer = "container:MacGap.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ buildConfiguration = "Debug">
+ <Testables>
+ </Testables>
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "FAE451B914BA79C600190544"
+ BuildableName = "MacGap.app"
+ BlueprintName = "MacGap"
+ ReferencedContainer = "container:MacGap.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ </TestAction>
+ <LaunchAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Debug"
+ debugDocumentVersioning = "YES"
+ allowLocationSimulation = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "FAE451B914BA79C600190544"
+ BuildableName = "MacGap.app"
+ BlueprintName = "MacGap"
+ ReferencedContainer = "container:MacGap.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Release"
+ debugDocumentVersioning = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "FAE451B914BA79C600190544"
+ BuildableName = "MacGap.app"
+ BlueprintName = "MacGap"
+ ReferencedContainer = "container:MacGap.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>SchemeUserState</key>
+ <dict>
+ <key>MacGap.xcscheme</key>
+ <dict>
+ <key>orderHint</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <key>SuppressBuildableAutocreation</key>
+ <dict>
+ <key>FAE451B914BA79C600190544</key>
+ <dict>
+ <key>primary</key>
+ <true/>
+ </dict>
+ </dict>
+</dict>
+</plist>
Binary file not shown.
@@ -0,0 +1,17 @@
+//
+// AppDelegate.h
+// MacGap
+//
+// Created by Alex MacCaw on 08/01/2012.
+// Copyright (c) 2012 Twitter. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import "Classes/ContentView.h"
+
+@interface AppDelegate : NSObject <NSApplicationDelegate>
+
+@property (strong) IBOutlet NSWindow *window;
+@property (strong) IBOutlet ContentView *contentView;
+
+@end
@@ -0,0 +1,32 @@
+//
+// AppDelegate.m
+// MacGap
+//
+// Created by Alex MacCaw on 08/01/2012.
+// Copyright (c) 2012 Twitter. All rights reserved.
+//
+
+#import "AppDelegate.h"
+
+@implementation AppDelegate
+
+@synthesize window, contentView;
+
+- (void) applicationWillFinishLaunching:(NSNotification *)aNotification
+{
+ [[NSNotificationCenter defaultCenter] addObserver:self.contentView
+ selector:@selector(windowResized:)
+ name:NSWindowDidResizeNotification
+ object:[self window]];
+
+ NSURL* fileUrl = [NSURL fileURLWithPath:[[Utils sharedInstance] pathForResource:kStartPage]];
+ [self.contentView.webView setMainFrameURL:[fileUrl description]];
+
+}
+
+- (void) applicationDidFinishLaunching:(NSNotification *)aNotification {
+ self.contentView.webView.alphaValue = 1.0;
+ self.contentView.alphaValue = 1.0;
+}
+
+@end
Binary file not shown.
@@ -0,0 +1,13 @@
+#import <Foundation/Foundation.h>
+
+@interface App : NSObject {
+
+}
+
+- (void) terminate;
+- (void) activate;
+- (void) hide;
+- (void) unhide;
+- (void) beep;
+
+@end
@@ -0,0 +1,25 @@
+#import "App.h"
+
+@implementation App
+
+- (void) terminate {
+ [NSApp terminate:nil];
+}
+
+- (void) activate {
+ [NSApp activateIgnoringOtherApps:YES];
+}
+
+- (void) hide {
+ [NSApp hide:nil];
+}
+
+- (void) unhide {
+ [NSApp unhide:nil];
+}
+
+- (void)beep {
+ NSBeep();
+}
+
+@end
@@ -0,0 +1,11 @@
+#import <Foundation/Foundation.h>
+
+@interface Dock : NSObject {
+
+}
+- (void) setBadge:(NSString*)value;
+- (NSString *) badge;
+
+@property (readwrite, copy) NSString *badge;
+
+@end
@@ -0,0 +1,33 @@
+#import "Dock.h"
+
+@implementation Dock
+
+@synthesize badge;
+
+- (void) setBadge:(NSString *)value
+{
+ NSDockTile *tile = [[NSApplication sharedApplication] dockTile];
+ [tile setBadgeLabel:value];
+}
+
+- (NSString *) badge
+{
+ NSDockTile *tile = [[NSApplication sharedApplication] dockTile];
+ return [tile badgeLabel];
+}
+
+#pragma mark WebScripting Protocol
+
+/* checks whether a selector is acceptable to be called from JavaScript */
++ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector
+{
+ return NO;
+}
+
+// right now exclude all properties (eg keys)
++ (BOOL) isKeyExcludedFromWebScript:(const char*)name
+{
+ return NO;
+}
+
+@end
@@ -0,0 +1,15 @@
+#import <Foundation/Foundation.h>
+#import <Growl/Growl.h>
+
+#define APP_GROWL_NOTIFICATION @"Growl Notification"
+
+@interface Growl : NSObject <GrowlApplicationBridgeDelegate> {
+
+}
+
+- (void) notify:(NSDictionary*)message;
+- (NSString *)applicationNameForGrowl;
+- (NSImage *)applicationIconForGrowl;
+- (NSDictionary *)registrationDictionaryForGrowl;
+
+@end
@@ -0,0 +1,79 @@
+#import "Growl.h"
+
+@implementation Growl
+
+- (id) init {
+ if (self = [super init]) {
+ NSBundle *myBundle = [NSBundle bundleForClass:[self class]];
+ NSString *growlPath = [[myBundle privateFrameworksPath]
+ stringByAppendingPathComponent:@"Growl.framework"];
+ NSBundle *growlBundle = [NSBundle bundleWithPath:growlPath];
+ if (growlBundle && [growlBundle load]) {
+ // Register ourselves as a Growl delegate
+ [GrowlApplicationBridge setGrowlDelegate:self];
+ } else {
+ NSLog(@"Could not load Growl.framework");
+ }
+ }
+
+ return self;
+}
+
+- (void) notify:(NSDictionary *)message {
+ [GrowlApplicationBridge notifyWithTitle:[message valueForKey:@"title"]
+ description:[message valueForKey:@"content"]
+ notificationName:APP_GROWL_NOTIFICATION
+ iconData:nil
+ priority:0
+ isSticky:false
+ clickContext:nil];
+}
+
+- (NSString *)applicationNameForGrowl {
+ return @"Callback";
+}
+
+- (NSImage *)applicationIconForGrowl {
+ return [NSImage imageNamed:@"NSApplicationIcon"];
+}
+
+- (NSDictionary *)registrationDictionaryForGrowl {
+ NSArray *allowedNotifications = [NSArray arrayWithObject:APP_GROWL_NOTIFICATION];
+ NSArray *defaultNotifications = [NSArray arrayWithObject:APP_GROWL_NOTIFICATION];
+
+ NSDictionary *ticket = [NSDictionary dictionaryWithObjectsAndKeys:
+ allowedNotifications, GROWL_NOTIFICATIONS_ALL,
+ defaultNotifications, GROWL_NOTIFICATIONS_DEFAULT,
+ nil];
+
+ return ticket;
+}
+
+#pragma mark WebScripting Protocol
+
++ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector
+{
+ if (selector == @selector(notify:))
+ return NO;
+
+ return YES;
+}
+
++ (NSString*) webScriptNameForSelector:(SEL)selector
+{
+ id result = nil;
+
+ if (selector == @selector(notify:)) {
+ result = @"notify";
+ }
+
+ return result;
+}
+
+// right now exclude all properties (eg keys)
++ (BOOL) isKeyExcludedFromWebScript:(const char*)name
+{
+ return YES;
+}
+
+@end
@@ -0,0 +1,13 @@
+#import <Foundation/Foundation.h>
+
+@interface Path : NSObject {
+
+}
+
+- (NSString *) application;
+- (NSString *) resource;
+
+@property (readonly,copy) NSString* application;
+@property (readonly,copy) NSString* resource;
+
+@end
Oops, something went wrong.

0 comments on commit 78bed5a

Please sign in to comment.