diff --git a/Atom/src/Atom.h b/Atom/src/Atom.h index 2e7a2297e..1f4f314c1 100755 --- a/Atom/src/Atom.h +++ b/Atom/src/Atom.h @@ -12,7 +12,7 @@ class ClientHandler; CefRefPtr _clientHandler; } -- (AtomController *)open:(NSString *)path; +- (void)open:(NSString *)path; - (IBAction)runSpecs:(id)sender; - (IBAction)runBenchmarks:(id)sender; diff --git a/Atom/src/Atom.mm b/Atom/src/Atom.mm index 9afc909be..b3f2449ed 100755 --- a/Atom/src/Atom.mm +++ b/Atom/src/Atom.mm @@ -60,8 +60,8 @@ CefBrowser::CreateBrowser(window_info, _clientHandler.get(), [indexURLString UTF8String], settings); } -- (AtomController *)open:(NSString *)path { - return [[AtomController alloc] initWithPath:path atomContext:[self atomContext]]; +- (void)open:(NSString *)path { + [[AtomController alloc] initWithPath:path atomContext:[self atomContext]]; } - (IBAction)runSpecs:(id)sender { diff --git a/Atom/src/AtomController.h b/Atom/src/AtomController.h index f2e8e6dd1..c5b7ff43d 100644 --- a/Atom/src/AtomController.h +++ b/Atom/src/AtomController.h @@ -10,8 +10,6 @@ class ClientHandler; NSString *_bootstrapScript; NSString *_pathToOpen; - BOOL _loaded; - CefRefPtr _atomContext; CefRefPtr _clientHandler; } @@ -22,10 +20,8 @@ class ClientHandler; - (id)initBenchmarksWithAtomContext:(CefRefPtr)atomContext; - (void)createBrowser; -- (void)blockUntilBrowserLoaded; @property (nonatomic, retain) IBOutlet NSView *webView; -@property (nonatomic, readonly) CefRefPtr clientHandler; @end diff --git a/Atom/src/AtomController.mm b/Atom/src/AtomController.mm index 69e3f6428..880ecd06d 100644 --- a/Atom/src/AtomController.mm +++ b/Atom/src/AtomController.mm @@ -7,7 +7,6 @@ @implementation AtomController @synthesize webView=_webView; -@synthesize clientHandler=_clientHandler; - (void)dealloc { [_bootstrapScript release]; @@ -21,7 +20,6 @@ self = [super initWithWindowNibName:@"ClientWindow"]; _bootstrapScript = [bootstrapScript retain]; _atomContext = atomContext; - _loaded = false; [self.window makeKeyAndOrderFront:nil]; [self createBrowser]; @@ -62,16 +60,8 @@ CefBrowser::CreateBrowser(window_info, _clientHandler.get(), [indexURLString UTF8String], settings); } -- (void)blockUntilBrowserLoaded { - NSRunLoop *runLoop = [NSRunLoop mainRunLoop]; - while (!_loaded) { - [runLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0]]; - } -} - #pragma mark BrowserDelegate - (void)loadStart { - _loaded = false; CefRefPtr context = _clientHandler->GetBrowser()->GetMainFrame()->GetV8Context(); CefRefPtr global = context->GetGlobal(); @@ -91,10 +81,6 @@ context->Exit(); } -- (void)loadEnd { - _loaded = true; -} - - (bool)keyEventOfType:(cef_handler_keyevent_type_t)type code:(int)code modifiers:(int)modifiers diff --git a/Atom/src/native_handler.mm b/Atom/src/native_handler.mm index f75aa99d5..cdf9d86f2 100644 --- a/Atom/src/native_handler.mm +++ b/Atom/src/native_handler.mm @@ -235,11 +235,7 @@ bool NativeHandler::Execute(const CefString& name, } else if (name == "open") { NSString *path = stringFromCefV8Value(arguments[0]); - AtomController *atomController = [(Atom *)NSApp open:path]; - [atomController blockUntilBrowserLoaded]; - - CefRefPtr clientHandler = [atomController clientHandler]; - retval = clientHandler->GetBrowser()->GetMainFrame()->GetV8Context()->GetGlobal(); + [NSApp open:path]; return true; } diff --git a/src/atom/keymap.coffee b/src/atom/keymap.coffee index d0734b72e..a8583da62 100644 --- a/src/atom/keymap.coffee +++ b/src/atom/keymap.coffee @@ -14,21 +14,18 @@ class Keymap bindDefaultKeys: -> @bindKeys "*", 'meta-n': 'new-window' - 'meta-o': 'open' 'meta-,': 'open-user-configuration' + 'meta-o': 'open' @_newWindow = => $native.newWindow() + @_openUserConfiguration = => atom.open(atom.userConfigurationPath) @_open = => url = $native.openDialog() atom.open(url) if url - @_openUserConfiguration = => - openedWindow = atom.open(atom.userConfigurationPath) - defaultConfiguration = "# This is run when a window is loaded!\nconsole.log('see!')" - openedWindow.rootView.editor.buffer.setText defaultConfiguration unless fs.exists(atom.userConfigurationPath) $(document).on 'new-window', @_newWindow - $(document).on 'open', @_open $(document).on 'open-user-configuration', @_openUserConfiguration + $(document).on 'open', @_open unbindDefaultKeys: -> $(document).unbind 'new-window', @_newWindow