mirror of
https://github.com/ksherlock/ample.git
synced 2025-02-09 03:31:14 +00:00
media view - only enable eject button when there's something to eject.
This commit is contained in:
parent
69023c4af3
commit
3c77f0a309
@ -91,19 +91,19 @@
|
||||
</connections>
|
||||
</pathControl>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zNo-ij-mUl">
|
||||
<rect key="frame" x="253" y="5" width="23" height="18"/>
|
||||
<rect key="frame" x="253" y="3" width="23" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
||||
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="NSNavEjectButton.normalSelected" imagePosition="overlaps" alignment="center" controlSize="small" imageScaling="proportionallyDown" inset="2" id="IZA-Tu-olu">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="deleteAction:" target="-2" id="XAl-eQ-nUj"/>
|
||||
<action selector="ejectAction:" target="-2" id="XAl-eQ-nUj"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<connections>
|
||||
<outlet property="deleteButton" destination="zNo-ij-mUl" id="9br-3c-ddI"/>
|
||||
<outlet property="ejectButton" destination="zNo-ij-mUl" id="uzY-tA-5Wf"/>
|
||||
<outlet property="pathControl" destination="f7R-TO-fmF" id="oH7-N3-JC7"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
|
@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic) NSDictionary *media;
|
||||
@property NSArray *args;
|
||||
|
||||
- (IBAction)deleteAction:(id)sender;
|
||||
- (IBAction)ejectAction:(id)sender;
|
||||
- (IBAction)pathAction:(id)sender;
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TablePathView : NSTableCellView
|
||||
@property (weak) IBOutlet NSPathControl *pathControl;
|
||||
@property (weak) IBOutlet NSButton *deleteButton;
|
||||
@property (weak) IBOutlet NSButton *ejectButton;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -168,14 +168,19 @@
|
||||
|
||||
-(void)prepareView: (TablePathView *)view {
|
||||
NSPathControl *pc = [view pathControl];
|
||||
NSButton *button = [view ejectButton];
|
||||
|
||||
[pc setURL: _url]; //??? will binding take care of it?
|
||||
[pc unbind: @"value"];
|
||||
[pc bind: @"value" toObject: self withKeyPath: @"url" options: nil];
|
||||
|
||||
[button unbind: @"enabled"];
|
||||
NSValueTransformer *t = [NSValueTransformer valueTransformerForName: NSIsNotNilTransformerName];
|
||||
NSDictionary *options = @{ NSValueTransformerBindingOption: t};
|
||||
[button bind: @"enabled" toObject: self withKeyPath: @"url" options: options];
|
||||
|
||||
NSColor *tintColor = nil;
|
||||
if (!_valid) tintColor = [NSColor redColor];
|
||||
[[view deleteButton] setContentTintColor: tintColor];
|
||||
[button setContentTintColor: tintColor];
|
||||
}
|
||||
|
||||
-(CGFloat)height {
|
||||
@ -405,7 +410,7 @@ enum {
|
||||
|
||||
|
||||
#pragma mark - IBActions
|
||||
- (IBAction)deleteAction:(id)sender {
|
||||
- (IBAction)ejectAction:(id)sender {
|
||||
|
||||
NSInteger row = [_outlineView rowForView: sender];
|
||||
if (row < 0) return;
|
||||
@ -424,6 +429,7 @@ enum {
|
||||
}
|
||||
|
||||
- (IBAction)pathAction:(id)sender {
|
||||
// need to update the eject button...
|
||||
[self rebuildArgs];
|
||||
}
|
||||
@end
|
||||
|
Loading…
x
Reference in New Issue
Block a user