Skip to content

Commit

Permalink
Use built into Sonoma column hiding menu
Browse files Browse the repository at this point in the history
Not sure if I want to use it fully yet. It won't show columns with no
user visible label in the list (i..e the playback/synced icons) though.
  • Loading branch information
NattyNarwhal committed Dec 17, 2023
1 parent d200f52 commit 576a011
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 6 deletions.
7 changes: 4 additions & 3 deletions Submariner/MusicSearch.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand Down Expand Up @@ -153,6 +153,7 @@
</tableColumn>
</tableColumns>
<connections>
<outlet property="delegate" destination="-2" id="ipU-Bn-KI0"/>
<outlet property="menu" destination="paR-xu-VXT" id="K9F-dr-6i0"/>
</connections>
</tableView>
Expand All @@ -171,7 +172,7 @@
<autoresizingMask key="autoresizingMask"/>
</tableHeaderView>
</scrollView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="o3e-Kv-DpN">
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="o3e-Kv-DpN">
<rect key="frame" x="18" y="13" width="606" height="16"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" alignment="center" title="Track length" id="gKj-iU-7qy">
Expand Down
8 changes: 8 additions & 0 deletions Submariner/SBMusicController.m
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,14 @@ - (BOOL)tableView:(NSTableView *)tableView writeRowsWithIndexes:(NSIndexSet *)ro
}


#pragma mark - NSTableView (Columns)


- (BOOL)tableView:(NSTableView *)tableView userCanChangeVisibilityOfTableColumn:(NSTableColumn *)column {
return YES;
}


#pragma mark -
#pragma mark NSTableView Sort Descriptor Override

Expand Down
8 changes: 8 additions & 0 deletions Submariner/SBMusicSearchController.m
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ - (IBAction)createNewLocalPlaylistWithSelectedTracks:(id)sender {
}


#pragma mark - NSTableView (Columns)


- (BOOL)tableView:(NSTableView *)tableView userCanChangeVisibilityOfTableColumn:(NSTableColumn *)column {
return YES;
}


#pragma mark -
#pragma mark UI Validator

Expand Down
6 changes: 6 additions & 0 deletions Submariner/SBPlaylistController.m
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@ - (IBAction)showSelectedInLibrary:(id)sender {
}


#pragma mark - NSTableView (Columns)


- (BOOL)tableView:(NSTableView *)tableView userCanChangeVisibilityOfTableColumn:(NSTableColumn *)column {
return YES;
}


#pragma mark -
Expand Down
4 changes: 4 additions & 0 deletions Submariner/SBServerHomeController.m
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,12 @@ - (void)imageBrowser:(IKImageBrowserView *)aBrowser cellWasDoubleClickedAtIndex:
}


#pragma mark - NSTableView (Columns)


- (BOOL)tableView:(NSTableView *)tableView userCanChangeVisibilityOfTableColumn:(NSTableColumn *)column {
return YES;
}


#pragma mark -
Expand Down
7 changes: 7 additions & 0 deletions Submariner/SBServerLibraryController.m
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,13 @@ - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColu
}


#pragma mark - NSTableView (Columns)


- (BOOL)tableView:(NSTableView *)tableView userCanChangeVisibilityOfTableColumn:(NSTableColumn *)column {
return YES;
}


#pragma mark -
#pragma mark NSTableView (Drag & Drop)
Expand Down
8 changes: 8 additions & 0 deletions Submariner/SBServerSearchController.m
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ - (IBAction)createNewLocalPlaylistWithSelectedTracks:(id)sender {



#pragma mark - NSTableView (Columns)


- (BOOL)tableView:(NSTableView *)tableView userCanChangeVisibilityOfTableColumn:(NSTableColumn *)column {
return YES;
}


#pragma mark -
#pragma mark NSTableView (Drag & Drop)

Expand Down
10 changes: 7 additions & 3 deletions Submariner/SBTableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ @implementation SBTableView

- (void)awakeFromNib {
[super awakeFromNib];
// don't override an existing menu
if (self.autosaveName != nil && self.headerView.menu == nil) {
[self createViewHeaderMenu];
if (@available(macOS 14.0, *)) {
// use built into sonoma feature instead
} else {
// don't override an existing menu
if (self.autosaveName != nil && self.headerView.menu == nil) {
[self createViewHeaderMenu];
}
}
}

Expand Down

0 comments on commit 576a011

Please sign in to comment.