diff --git a/OpenRA.Launcher.Mac/Controller.m b/OpenRA.Launcher.Mac/Controller.m
index 30e4942692..c50b91b192 100644
--- a/OpenRA.Launcher.Mac/Controller.m
+++ b/OpenRA.Launcher.Mac/Controller.m
@@ -18,6 +18,8 @@
- (void) awakeFromNib
{
game = [[GameInstall alloc] initWithURL:[NSURL URLWithString:@"/Users/paul/src/OpenRA"]];
+ jsbridge = [[JSBridge alloc] initWithController:self];
+
NSTableColumn *col = [outlineView tableColumnWithIdentifier:@"mods"];
ImageAndTextCell *imageAndTextCell = [[[ImageAndTextCell alloc] init] autorelease];
[col setDataCell:imageAndTextCell];
@@ -31,11 +33,22 @@
[outlineView reloadData];
[outlineView expandItem:modsRoot expandChildren:YES];
- [outlineView expandItem:otherRoot expandChildren:YES];
- [outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO];
- jsbridge = [[JSBridge alloc] initWithController:self];
- [[webView windowScriptObject] setValue:jsbridge forKey:@"external"];
+ if ([[modsRoot children] count] > 0)
+ {
+ id firstMod = [[modsRoot children] objectAtIndex:0];
+ int row = [outlineView rowForItem:firstMod];
+ [outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
+ [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL: [firstMod url]]];
+ }
+
+ [outlineView expandItem:otherRoot expandChildren:YES];
+}
+
+- (void) dealloc
+{
+ [sidebarItems release]; sidebarItems = nil;
+ [super dealloc];
}
- (SidebarEntry *)sidebarModsTree
@@ -48,7 +61,7 @@
for (id aMod in allMods)
{
if ([aMod standalone])
- {
+ {
id child = [SidebarEntry entryWithMod:aMod allMods:allMods baseURL:[[game gameURL] URLByAppendingPathComponent:@"mods"]];
[rootItem addChild:child];
}
@@ -66,11 +79,9 @@
return rootItem;
}
-
-- (void) dealloc
+- (void)launchGame
{
- [sidebarItems release]; sidebarItems = nil;
- [super dealloc];
+ [game launchGame];
}
#pragma mark Sidebar Datasource and Delegate
@@ -139,8 +150,10 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
}
}
-- (void)launchGame
+#pragma mark WebView delegates
+- (void)webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)windowObject forFrame:(WebFrame *)frame
{
- [game launchGame];
+ [windowObject setValue:jsbridge forKey:@"external"];
}
+
@end
diff --git a/OpenRA.Launcher.Mac/English.lproj/MainMenu.xib b/OpenRA.Launcher.Mac/English.lproj/MainMenu.xib
index 3a200f77a1..cedf268855 100644
--- a/OpenRA.Launcher.Mac/English.lproj/MainMenu.xib
+++ b/OpenRA.Launcher.Mac/English.lproj/MainMenu.xib
@@ -21,8 +21,8 @@
590
+
@@ -1083,9 +1091,9 @@
{74, 862}
{{6, 978}, {478, 20}}
- {{611, 949}, {659, 469}}
+ {{611, 537}, {659, 469}}
com.apple.InterfaceBuilder.CocoaPlugin
- {{611, 949}, {659, 469}}
+ {{611, 537}, {659, 469}}
{{33, 99}, {480, 360}}
{3.40282e+38, 3.40282e+38}
@@ -1118,9 +1126,7 @@
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.WebKitIBPlugin
-
- AcJAAABDFwAAA
-
+
com.apple.InterfaceBuilder.CocoaPlugin
@@ -1141,7 +1147,7 @@
- 590
+ 591
@@ -1149,17 +1155,6 @@
Controller
NSObject
-
- launchGame:
- id
-
-
- launchGame:
-
- launchGame:
- id
-
-
YES