[vlc-commits] macosx/status icon: fix 'show main menu' and micro-optimize
Felix Paul Kühne
git at videolan.org
Sun Jun 2 12:36:29 CEST 2019
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Sun Jun 2 11:49:07 2019 +0200| [baabf167ee80d75fa76c013365c2182f84b26164] | committer: Felix Paul Kühne
macosx/status icon: fix 'show main menu' and micro-optimize
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=baabf167ee80d75fa76c013365c2182f84b26164
---
modules/gui/macosx/UI/VLCStatusBarIconMainMenu.xib | 8 ++++----
modules/gui/macosx/menus/VLCStatusBarIcon.h | 2 +-
modules/gui/macosx/menus/VLCStatusBarIcon.m | 16 +++++++---------
3 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/modules/gui/macosx/UI/VLCStatusBarIconMainMenu.xib b/modules/gui/macosx/UI/VLCStatusBarIconMainMenu.xib
index 8788a3df77..06057a3346 100755
--- a/modules/gui/macosx/UI/VLCStatusBarIconMainMenu.xib
+++ b/modules/gui/macosx/UI/VLCStatusBarIconMainMenu.xib
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -21,7 +21,7 @@
<outlet property="quitItem" destination="539" id="xuy-Vl-Ami"/>
<outlet property="randomButton" destination="PaW-Fe-vxo" id="GT0-tR-eox"/>
<outlet property="separatorField" destination="za4-8d-tZy" id="Qcx-VE-sZY"/>
- <outlet property="showMainWindowItem" destination="08C-TA-yqu" id="qQR-Ah-T0b"/>
+ <outlet property="showMainWindowItem" destination="08C-TA-yqu" id="CjZ-0y-9Zi"/>
<outlet property="titleField" destination="Byt-pH-60l" id="JKP-xq-fIb"/>
<outlet property="totalField" destination="wXO-2p-mxK" id="XoY-cx-jzm"/>
<outlet property="vlcStatusBarIconMenu" destination="534" id="O0F-8Q-FgA"/>
@@ -54,7 +54,7 @@
<menuItem title="Show Main Window" id="08C-TA-yqu">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
- <action selector="restoreMainWindow:" target="-2" id="2Uq-Pa-toi"/>
+ <action selector="statusBarIconShowMainWindow:" target="-2" id="s0T-6f-d13"/>
</connections>
</menuItem>
<menuItem title="Quit" id="539">
diff --git a/modules/gui/macosx/menus/VLCStatusBarIcon.h b/modules/gui/macosx/menus/VLCStatusBarIcon.h
index 494e1a21f6..10aed3365b 100644
--- a/modules/gui/macosx/menus/VLCStatusBarIcon.h
+++ b/modules/gui/macosx/menus/VLCStatusBarIcon.h
@@ -30,7 +30,7 @@
@property (strong) IBOutlet NSView *playbackInfoView;
@property (strong) IBOutlet NSView *controlsView;
-- (IBAction)restoreMainWindow:(id)sender;
+- (IBAction)statusBarIconShowMainWindow:(id)sender;
- (IBAction)statusBarIconTogglePlayPause:(id)sender;
- (IBAction)statusBarIconStop:(id)sender;
- (IBAction)statusBarIconNext:(id)sender;
diff --git a/modules/gui/macosx/menus/VLCStatusBarIcon.m b/modules/gui/macosx/menus/VLCStatusBarIcon.m
index ad325a0da8..45cfd93ce1 100644
--- a/modules/gui/macosx/menus/VLCStatusBarIcon.m
+++ b/modules/gui/macosx/menus/VLCStatusBarIcon.m
@@ -56,7 +56,6 @@
IBOutlet NSMenuItem *showMainWindowItem;
IBOutlet NSMenuItem *quitItem;
- BOOL isStopped;
BOOL _showTimeElapsed;
NSString *_currentPlaybackUrl;
}
@@ -128,6 +127,10 @@
selector:@selector(configurationChanged:)
name:VLCConfigurationChangedNotification
object:nil];
+
+ [self inputItemChanged:nil];
+
+ [self setMetadataTitle:_NS("VLC media player") artist:_NS("Nothing playing") album:nil andCover:[NSImage imageNamed:@"noart.png"]];
}
- (void)observeValueForKeyPath:(NSString *)keyPath
@@ -236,11 +239,7 @@
vlc_tick_t duration = input_item_GetDuration(p_item);
vlc_tick_t time = playerController.time;
- if (duration == -1) {
- /* Unknown duration, possibly due to buffering */
- [progressField setStringValue:@"--:--"];
- [totalField setStringValue:@"--:--"];
- } else if (duration == 0) {
+ if (duration == 0) {
/* Infinite duration */
[progressField setStringValue:[NSString stringWithDuration:duration currentTime:time negative:NO]];
[totalField setStringValue:@"∞"];
@@ -442,7 +441,6 @@
// Set the play/pause menu item status
- (void)setStoppedStatus:(BOOL)stopped
{
- isStopped = stopped;
if (stopped) {
[playPauseButton setState:NSOffState];
} else {
@@ -486,9 +484,9 @@
}
// Action: Show VLC main window
-- (IBAction)restoreMainWindow:(id)sender
+- (IBAction)statusBarIconShowMainWindow:(id)sender
{
- [[NSApp sharedApplication] activateIgnoringOtherApps:YES];
+ [[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
[(NSWindow *)[[VLCMain sharedInstance] libraryWindow] makeKeyAndOrderFront:sender];
}
More information about the vlc-commits
mailing list