Hide current artist from dock context menu when not playing or when there is no artist set
parent
7da599fe3c
commit
d3548d77e7
|
@ -40,6 +40,9 @@
|
||||||
IBOutlet NSMenuItem *showLengthColumn;
|
IBOutlet NSMenuItem *showLengthColumn;
|
||||||
IBOutlet NSMenuItem *showTrackColumn;
|
IBOutlet NSMenuItem *showTrackColumn;
|
||||||
IBOutlet NSMenuItem *showYearColumn;
|
IBOutlet NSMenuItem *showYearColumn;
|
||||||
|
|
||||||
|
IBOutlet NSMenu *dockMenu;
|
||||||
|
IBOutlet NSMenuItem *currentArtistItem;
|
||||||
|
|
||||||
IBOutlet NSWindowController *spotlightWindowController;
|
IBOutlet NSWindowController *spotlightWindowController;
|
||||||
|
|
||||||
|
|
|
@ -203,6 +203,11 @@ void* kAppControllerContext = &kAppControllerContext;
|
||||||
FileTreeOutlineView* outlineView = [fileTreeViewController outlineView];
|
FileTreeOutlineView* outlineView = [fileTreeViewController outlineView];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(nodeExpanded:) name:NSOutlineViewItemDidExpandNotification object:outlineView];
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(nodeExpanded:) name:NSOutlineViewItemDidExpandNotification object:outlineView];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(nodeCollapsed:) name:NSOutlineViewItemDidCollapseNotification object:outlineView];
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(nodeCollapsed:) name:NSOutlineViewItemDidCollapseNotification object:outlineView];
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDockMenu:) name:CogPlaybackDidBeginNotficiation object:nil];
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDockMenu:) name:CogPlaybackDidStopNotficiation object:nil];
|
||||||
|
|
||||||
|
[self updateDockMenu:nil];
|
||||||
|
|
||||||
NSArray *expandedNodesArray = [[NSUserDefaults standardUserDefaults] valueForKey:@"fileTreeViewExpandedNodes"];
|
NSArray *expandedNodesArray = [[NSUserDefaults standardUserDefaults] valueForKey:@"fileTreeViewExpandedNodes"];
|
||||||
|
|
||||||
|
@ -626,4 +631,21 @@ void* kAppControllerContext = &kAppControllerContext;
|
||||||
[miniWindow setLevel:level];
|
[miniWindow setLevel:level];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)updateDockMenu:(NSNotification *)notification
|
||||||
|
{
|
||||||
|
PlaylistEntry *pe = [playlistController currentEntry];
|
||||||
|
|
||||||
|
BOOL hideItem = NO;
|
||||||
|
|
||||||
|
if ([[notification name] isEqualToString:CogPlaybackDidStopNotficiation] || !pe || ![pe artist] || [[pe artist] isEqualToString:@""])
|
||||||
|
hideItem = YES;
|
||||||
|
|
||||||
|
if (hideItem && [dockMenu indexOfItem:currentArtistItem] == 0) {
|
||||||
|
[dockMenu removeItem:currentArtistItem];
|
||||||
|
}
|
||||||
|
else if (!hideItem && [dockMenu indexOfItem:currentArtistItem] < 0) {
|
||||||
|
[dockMenu insertItem:currentArtistItem atIndex:0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="KWC-Ti-8KY">
|
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="KWC-Ti-8KY">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="1000" height="378"/>
|
<rect key="frame" x="0.0" y="0.0" width="1000" height="378"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" autosaveName="Playlist" rowHeight="18" headerView="1517" id="207" customClass="PlaylistView">
|
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" autosaveName="Playlist" rowHeight="18" headerView="1517" id="207" customClass="PlaylistView">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="1000" height="361"/>
|
<rect key="frame" x="0.0" y="0.0" width="1000" height="361"/>
|
||||||
|
@ -657,7 +657,7 @@
|
||||||
<toolbarItem implicitItemIdentifier="C0FF70A3-EE67-43F6-9956-95B89425CF0E" label="Current Time" paletteLabel="Current Time" visibilityPriority="5" sizingBehavior="auto" id="2274">
|
<toolbarItem implicitItemIdentifier="C0FF70A3-EE67-43F6-9956-95B89425CF0E" label="Current Time" paletteLabel="Current Time" visibilityPriority="5" sizingBehavior="auto" id="2274">
|
||||||
<nil key="toolTip"/>
|
<nil key="toolTip"/>
|
||||||
<textField key="view" verticalHuggingPriority="750" id="2291" customClass="TimeField">
|
<textField key="view" verticalHuggingPriority="750" id="2291" customClass="TimeField">
|
||||||
<rect key="frame" x="14" y="14" width="49" height="19"/>
|
<rect key="frame" x="15" y="14" width="47" height="19"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" borderStyle="bezel" alignment="center" title="0:00" usesSingleLineMode="YES" bezelStyle="round" id="2292">
|
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" borderStyle="bezel" alignment="center" title="0:00" usesSingleLineMode="YES" bezelStyle="round" id="2292">
|
||||||
<font key="font" metaFont="message" size="11"/>
|
<font key="font" metaFont="message" size="11"/>
|
||||||
|
@ -1504,7 +1504,9 @@ Gw
|
||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="226" userLabel="AppController" customClass="AppController">
|
<customObject id="226" userLabel="AppController" customClass="AppController">
|
||||||
<connections>
|
<connections>
|
||||||
|
<outlet property="currentArtistItem" destination="1454" id="lsF-eW-c5e"/>
|
||||||
<outlet property="currentEntryController" destination="1897" id="2459"/>
|
<outlet property="currentEntryController" destination="1897" id="2459"/>
|
||||||
|
<outlet property="dockMenu" destination="513" id="hOo-MJ-WCK"/>
|
||||||
<outlet property="fileButton" destination="1631" id="1661"/>
|
<outlet property="fileButton" destination="1631" id="1661"/>
|
||||||
<outlet property="fileTreeViewController" destination="2172" id="2460"/>
|
<outlet property="fileTreeViewController" destination="2172" id="2460"/>
|
||||||
<outlet property="infoButton" destination="1627" id="1663"/>
|
<outlet property="infoButton" destination="1627" id="1663"/>
|
||||||
|
|
Loading…
Reference in New Issue