summaryrefslogtreecommitdiff
path: root/frontends/cocoa/BrowserWindowController.m
diff options
context:
space:
mode:
authorSven Weidauer <sven@5sw.de>2017-06-05 10:47:34 +0200
committerSven Weidauer <sven@5sw.de>2017-06-05 10:51:19 +0200
commit3ee40a10b123c36be3e29602767840a7a71aaafa (patch)
tree64123d0bf6a6cf5a5a4c1fd8349756db68e09483 /frontends/cocoa/BrowserWindowController.m
parentce4e059ea67cee7f35b4b810a4387f343fa74650 (diff)
downloadnetsurf-3ee40a10b123c36be3e29602767840a7a71aaafa.tar.gz
netsurf-3ee40a10b123c36be3e29602767840a7a71aaafa.tar.bz2
Fix up cocoa frontend.
- Convert to ARC - Fix crash due to endless responder chain recursion - Update makefile to find openssl installed via home-brew - Fix most compiler warnings
Diffstat (limited to 'frontends/cocoa/BrowserWindowController.m')
-rw-r--r--frontends/cocoa/BrowserWindowController.m53
1 files changed, 22 insertions, 31 deletions
diff --git a/frontends/cocoa/BrowserWindowController.m b/frontends/cocoa/BrowserWindowController.m
index aa7375a0e..1fa78b47b 100644
--- a/frontends/cocoa/BrowserWindowController.m
+++ b/frontends/cocoa/BrowserWindowController.m
@@ -52,24 +52,15 @@
@synthesize activeBrowser;
@synthesize activeBrowserController;
-- (id) init;
+- (id) init
{
if (nil == (self = [super initWithWindowNibName: @"BrowserWindow"])) return nil;
return self;
}
-- (void) dealloc;
-{
- [self setTabBar: nil];
- [self setTabView: nil];
- [self setUrlField: nil];
- [self setNavigationControl: nil];
-
- [super dealloc];
-}
-- (void) awakeFromNib;
+- (void) awakeFromNib
{
[tabBar setShowAddTabButton: YES];
[tabBar setTearOffStyle: PSMTabBarTearOffMiniwindow];
@@ -94,9 +85,9 @@
[navigationControl setMenu: historyForwardMenu forSegment: 1];
}
-- (void) addTab: (BrowserViewController *)browser;
+- (void) addTab: (BrowserViewController *)browser
{
- NSTabViewItem *item = [[[NSTabViewItem alloc] initWithIdentifier: browser] autorelease];
+ NSTabViewItem *item = [[NSTabViewItem alloc] initWithIdentifier: browser];
[item setView: [browser view]];
[item bind: @"label" toObject: browser withKeyPath: @"title" options: nil];
@@ -107,7 +98,7 @@
[tabView selectTabViewItem: item];
}
-- (void) removeTab: (BrowserViewController *)browser;
+- (void) removeTab: (BrowserViewController *)browser
{
NSUInteger itemIndex = [tabView indexOfTabViewItemWithIdentifier: browser];
if (itemIndex != NSNotFound) {
@@ -117,7 +108,7 @@
}
}
-- (BOOL) windowShouldClose: (NSWindow *) window;
+- (BOOL) windowShouldClose: (NSWindow *) window
{
if ([tabView numberOfTabViewItems] <= 1) return YES;
if ([[NSUserDefaults standardUserDefaults] boolForKey: kAlwaysCloseMultipleTabs]) return YES;
@@ -136,23 +127,23 @@
return NO;
}
-- (void) canCloseAlertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo;
+- (void) canCloseAlertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
- if (returnCode == NSOKButton) {
+ if (returnCode == NSModalResponseOK) {
[[NSUserDefaults standardUserDefaults] setBool: [[alert suppressionButton] state] == NSOnState
forKey: kAlwaysCloseMultipleTabs];
[[self window] close];
}
}
-- (void) windowWillClose: (NSNotification *)notification;
+- (void) windowWillClose: (NSNotification *)notification
{
for (NSTabViewItem *tab in [tabView tabViewItems]) {
[tabView removeTabViewItem: tab];
}
}
-- (IBAction) newTab: (id) sender;
+- (IBAction) newTab: (id) sender
{
nsurl *url;
nserror error;
@@ -176,38 +167,38 @@
}
}
-- (IBAction) closeCurrentTab: (id) sender;
+- (IBAction) closeCurrentTab: (id) sender
{
[self removeTab: activeBrowser];
}
-- (void) setActiveBrowser: (BrowserViewController *)newBrowser;
+- (void) setActiveBrowser: (BrowserViewController *)newBrowser
{
activeBrowser = newBrowser;
- [self setNextResponder: activeBrowser];
+ //[self setNextResponder: activeBrowser];
}
-- (void) setCanGoBack: (BOOL)can;
+- (void) setCanGoBack: (BOOL)can
{
[navigationControl setEnabled: can forSegment: 0];
}
-- (BOOL) canGoBack;
+- (BOOL) canGoBack
{
return [navigationControl isEnabledForSegment: 0];
}
-- (void) setCanGoForward: (BOOL)can;
+- (void) setCanGoForward: (BOOL)can
{
[navigationControl setEnabled: can forSegment: 1];
}
-- (BOOL) canGoForward;
+- (BOOL) canGoForward
{
return [navigationControl isEnabledForSegment: 1];
}
-- (void)windowDidBecomeMain: (NSNotification *)note;
+- (void)windowDidBecomeMain: (NSNotification *)note
{
[(NetSurfApp *)NSApp setFrontTab: [[tabView selectedTabViewItem] identifier]];
}
@@ -224,7 +215,7 @@
#pragma mark -
#pragma mark Tab bar delegate
-- (void) tabView: (NSTabView *)tabView didSelectTabViewItem: (NSTabViewItem *)tabViewItem;
+- (void) tabView: (NSTabView *)tabView didSelectTabViewItem: (NSTabViewItem *)tabViewItem
{
[self setActiveBrowser: [tabViewItem identifier]];
if ([[self window] isMainWindow]) {
@@ -243,15 +234,15 @@
return YES;
}
-- (PSMTabBarControl *)tabView:(NSTabView *)aTabView newTabBarForDraggedTabViewItem:(NSTabViewItem *)tabViewItem atPoint:(NSPoint)point;
+- (PSMTabBarControl *)tabView:(NSTabView *)aTabView newTabBarForDraggedTabViewItem:(NSTabViewItem *)tabViewItem atPoint:(NSPoint)point
{
- BrowserWindowController *newWindow = [[[BrowserWindowController alloc] init] autorelease];
+ BrowserWindowController *newWindow = [[BrowserWindowController alloc] init];
[[tabViewItem identifier] setWindowController: newWindow];
[[newWindow window] setFrameOrigin: point];
return newWindow->tabBar;
}
-- (void) tabView: (NSTabView *)aTabView didCloseTabViewItem: (NSTabViewItem *)tabViewItem;
+- (void) tabView: (NSTabView *)aTabView didCloseTabViewItem: (NSTabViewItem *)tabViewItem
{
[tabViewItem unbind: @"label"];