mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Hack to open unstable windows from atom-stable
This commit is contained in:
@@ -131,6 +131,10 @@
|
||||
[[AtomWindowController alloc] initWithPath:path];
|
||||
}
|
||||
|
||||
- (void)openUnstable:(NSString *)path {
|
||||
[[AtomWindowController alloc] initUnstableWithPath:path];
|
||||
}
|
||||
|
||||
- (IBAction)runSpecs:(id)sender {
|
||||
[self runSpecsThenExit:NO];
|
||||
}
|
||||
|
||||
@@ -34,6 +34,10 @@ bool AtomCefClient::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
||||
bool hasArguments = argumentList->GetSize() > 1;
|
||||
hasArguments ? Open(argumentList->GetString(1)) : Open();
|
||||
}
|
||||
if (name == "openUnstable") {
|
||||
bool hasArguments = argumentList->GetSize() > 1;
|
||||
hasArguments ? OpenUnstable(argumentList->GetString(1)) : OpenUnstable();
|
||||
}
|
||||
else if (name == "newWindow") {
|
||||
NewWindow();
|
||||
}
|
||||
|
||||
@@ -107,6 +107,9 @@ class AtomCefClient : public CefClient,
|
||||
void FocusNextWindow();
|
||||
void Open(std::string path);
|
||||
void Open();
|
||||
void OpenUnstable(std::string path);
|
||||
|
||||
void OpenUnstable();
|
||||
void NewWindow();
|
||||
void ToggleDevTools(CefRefPtr<CefBrowser> browser);
|
||||
void ShowDevTools(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
@@ -37,6 +37,20 @@ void AtomCefClient::Open() {
|
||||
}
|
||||
}
|
||||
|
||||
void AtomCefClient::OpenUnstable(std::string path) {
|
||||
NSString *pathString = [NSString stringWithCString:path.c_str() encoding:NSUTF8StringEncoding];
|
||||
[(AtomApplication *)[AtomApplication sharedApplication] openUnstable:pathString];
|
||||
}
|
||||
|
||||
void AtomCefClient::OpenUnstable() {
|
||||
NSOpenPanel *panel = [NSOpenPanel openPanel];
|
||||
[panel setCanChooseDirectories:YES];
|
||||
if ([panel runModal] == NSFileHandlingPanelOKButton) {
|
||||
NSURL *url = [[panel URLs] lastObject];
|
||||
OpenUnstable([[url path] UTF8String]);
|
||||
}
|
||||
}
|
||||
|
||||
void AtomCefClient::NewWindow() {
|
||||
[(AtomApplication *)[AtomApplication sharedApplication] open:nil];
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ class AtomCefClient;
|
||||
@property (nonatomic, retain) IBOutlet NSView *devToolsView;
|
||||
|
||||
- (id)initWithPath:(NSString *)path;
|
||||
- (id)initUnstableWithPath:(NSString *)path;
|
||||
- (id)initInBackground;
|
||||
- (id)initSpecsThenExit:(BOOL)exitWhenDone;
|
||||
- (id)initBenchmarksThenExit:(BOOL)exitWhenDone;
|
||||
|
||||
@@ -52,6 +52,12 @@
|
||||
return [self initWithBootstrapScript:@"window-bootstrap" background:NO alwaysUseBundleResourcePath:stable];
|
||||
}
|
||||
|
||||
- (id)initUnstableWithPath:(NSString *)path {
|
||||
_pathToOpen = [path retain];
|
||||
AtomApplication *atomApplication = (AtomApplication *)[AtomApplication sharedApplication];
|
||||
return [self initWithBootstrapScript:@"window-bootstrap" background:NO alwaysUseBundleResourcePath:false];
|
||||
}
|
||||
|
||||
- (id)initInBackground {
|
||||
AtomApplication *atomApplication = (AtomApplication *)[AtomApplication sharedApplication];
|
||||
BOOL stable = [atomApplication.arguments objectForKey:@"stable"] != nil;
|
||||
|
||||
@@ -25,6 +25,9 @@ atom.receiveMessageFromBrowserProcess = (name, data) ->
|
||||
atom.open = (args...) ->
|
||||
@sendMessageToBrowserProcess('open', args)
|
||||
|
||||
atom.openUnstable = (args...) ->
|
||||
@sendMessageToBrowserProcess('openUnstable', args)
|
||||
|
||||
atom.newWindow = (args...) ->
|
||||
@sendMessageToBrowserProcess('newWindow', args)
|
||||
|
||||
|
||||
@@ -20,11 +20,13 @@ class Keymap
|
||||
'meta-n': 'new-window'
|
||||
'meta-,': 'open-user-configuration'
|
||||
'meta-o': 'open'
|
||||
'meta-O': 'open-unstable'
|
||||
'meta-w': 'core:close'
|
||||
|
||||
$(document).on 'new-window', => atom.newWindow()
|
||||
$(document).on 'open-user-configuration', => atom.open(atom.configFilePath)
|
||||
$(document).on 'open', => atom.open()
|
||||
$(document).on 'open-unstable', => atom.openUnstable()
|
||||
|
||||
bindKeys: (selector, bindings) ->
|
||||
bindingSet = new BindingSet(selector, bindings, @bindingSets.length)
|
||||
|
||||
Reference in New Issue
Block a user