10.6 compatibility fixes.

This commit is contained in:
Damiano Galassi committed 2014-06-25 11:02:05 +02:00
1 parent 91d6813ea1
commit 7de4eb93a0
4 files changed
+38 -29

No files matched your search

+31 -22
View File
@@ -340,7 +340,7 @@ static void *SBQueueContex = &SBQueueContex;
/* /*
* Creates a popover with the queue options. * Creates a popover with the queue options.
*/ */
- (void)createPopover { - (void)createOptionsPopover {
if (self.popover == nil) { if (self.popover == nil) {
// create and setup our popover // create and setup our popover
_popover = [[NSPopover alloc] init]; _popover = [[NSPopover alloc] init];
@@ -360,6 +360,16 @@ static void *SBQueueContex = &SBQueueContex;
} }
} }
-(NSWindow *)createOptionsWindow {
if (!self.windowController) {
self.windowController = [[[SBOptionsViewController alloc] initWithOptions:self.options] autorelease];
}
_detachedWindow.contentView = self.windowController.view;
_detachedWindow.delegate = self;
return _detachedWindow;
}
/* /*
* Creates a popover with a SBQueueItem * Creates a popover with a SBQueueItem
*/ */
@@ -389,15 +399,7 @@ static void *SBQueueContex = &SBQueueContex;
- (NSWindow *)detachableWindowForPopover:(NSPopover *)popover { - (NSWindow *)detachableWindowForPopover:(NSPopover *)popover {
if (popover == self.popover) { if (popover == self.popover) {
if (!self.windowController) { return [self createOptionsWindow];
self.windowController = [[[SBOptionsViewController alloc] initWithOptions:self.options] autorelease];
}
NSRect contentFrame = NSMakeRect(0, 0, self.windowController.view.frame.size.width, self.windowController.view.frame.size.height + 20);
_detachedWindow.contentView = self.windowController.view;
_detachedWindow.delegate = self;
[_detachedWindow setFrame:contentFrame display:NO];
return _detachedWindow;
} }
return nil; return nil;
} }
@@ -463,14 +465,19 @@ static void *SBQueueContex = &SBQueueContex;
} }
- (IBAction)toggleOptions:(id)sender { - (IBAction)toggleOptions:(id)sender {
[self createPopover]; if (NSClassFromString(@"NSPopover")) {
[self createOptionsPopover];
if (!self.popover.isShown) { if (!self.popover.isShown) {
NSButton *targetButton = (NSButton *)sender; NSButton *targetButton = (NSButton *)sender;
[self.popover showRelativeToRect:[targetButton bounds] ofView:sender preferredEdge:NSMaxYEdge]; [self.popover showRelativeToRect:[targetButton bounds] ofView:sender preferredEdge:NSMaxYEdge];
} else {
[self.popover close];
self.popover = nil;
}
} else { } else {
[self.popover close]; NSWindow *optionsWindow = [self createOptionsWindow];
self.popover = nil; [optionsWindow makeKeyAndOrderFront:sender];
} }
} }
@@ -478,12 +485,14 @@ static void *SBQueueContex = &SBQueueContex;
NSInteger clickedRow = [sender clickedRow]; NSInteger clickedRow = [sender clickedRow];
SBQueueItem *item = [self.queue itemAtIndex:clickedRow]; SBQueueItem *item = [self.queue itemAtIndex:clickedRow];
if (self.itemPopover.isShown && [(SBItemViewController *)self.itemPopover.contentViewController item] == item) { if (NSClassFromString(@"NSPopover")) {
[self.itemPopover close]; if (self.itemPopover.isShown && [(SBItemViewController *)self.itemPopover.contentViewController item] == item) {
self.itemPopover = nil; [self.itemPopover close];
} else { self.itemPopover = nil;
[self createItemPopover:[self.queue itemAtIndex:clickedRow]]; } else {
[self.itemPopover showRelativeToRect:[sender frameOfCellAtColumn:2 row:clickedRow] ofView:sender preferredEdge:NSMaxXEdge]; [self createItemPopover:[self.queue itemAtIndex:clickedRow]];
[self.itemPopover showRelativeToRect:[sender frameOfCellAtColumn:2 row:clickedRow] ofView:sender preferredEdge:NSMaxXEdge];
}
} }
} }
+1 -1
View File
@@ -226,7 +226,7 @@
if (outError) { if (outError) {
NSDictionary *errorDetail = @{ NSLocalizedDescriptionKey : @"Not enough disk space", NSDictionary *errorDetail = @{ NSLocalizedDescriptionKey : @"Not enough disk space",
NSLocalizedRecoverySuggestionErrorKey : @"" }; NSLocalizedRecoverySuggestionErrorKey : @"" };
*outError = [NSError errorWithDomain:@"SBQueueItemError" code:10 userInfo:errorDetail]; *outError = [NSError errorWithDomain:@"SBQueueItemError" code:12 userInfo:errorDetail];
} }
goto bail; goto bail;
} }
+4 -4
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13D43" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13E19" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies> <dependencies>
<deployment defaultVersion="1060" identifier="macosx"/> <deployment defaultVersion="1060" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
@@ -205,13 +205,13 @@
<outlet property="delegate" destination="-2" id="84"/> <outlet property="delegate" destination="-2" id="84"/>
</connections> </connections>
</menu> </menu>
<window title="Queue Options" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="zHc-NF-Zeh" userLabel="Window - Detached Options" customClass="NSPanel"> <window title="Queue Options" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="SBQueueOptionsWindow" animationBehavior="default" id="zHc-NF-Zeh" userLabel="Window - Detached Options" customClass="NSPanel">
<windowStyleMask key="styleMask" titled="YES" closable="YES" utility="YES"/> <windowStyleMask key="styleMask" titled="YES" closable="YES" utility="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="283" y="305" width="321" height="238"/> <rect key="contentRect" x="187" y="1037" width="334" height="262"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/> <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/>
<view key="contentView" id="hhb-jZ-DWa"> <view key="contentView" id="hhb-jZ-DWa">
<rect key="frame" x="0.0" y="0.0" width="321" height="238"/> <rect key="frame" x="0.0" y="0.0" width="334" height="262"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
</view> </view>
</window> </window>
+2 -2
View File
@@ -938,7 +938,7 @@
GCC_WARN_SIGN_COMPARE = NO; GCC_WARN_SIGN_COMPARE = NO;
GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = NO; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_PARAMETER = NO; GCC_WARN_UNUSED_PARAMETER = NO;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = ""; HEADER_SEARCH_PATHS = "";
@@ -981,7 +981,7 @@
GCC_WARN_SIGN_COMPARE = NO; GCC_WARN_SIGN_COMPARE = NO;
GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = NO; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_PARAMETER = NO; GCC_WARN_UNUSED_PARAMETER = NO;
GCC_WARN_UNUSED_VALUE = YES; GCC_WARN_UNUSED_VALUE = YES;