[vlc-commits] macosx/main menu: iterate on menu item validation
Felix Paul Kühne
git at videolan.org
Sat Feb 2 12:41:51 CET 2019
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Sat Feb 2 12:41:17 2019 +0100| [593745e784de1ec48489e80d05131a5f02b4487e] | committer: Felix Paul Kühne
macosx/main menu: iterate on menu item validation
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=593745e784de1ec48489e80d05131a5f02b4487e
---
modules/gui/macosx/VLCMainMenu.m | 18 ++++++++++--------
modules/gui/macosx/VLCPlaylistController.m | 6 ++----
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/modules/gui/macosx/VLCMainMenu.m b/modules/gui/macosx/VLCMainMenu.m
index c3984d4802..2a73ec5faf 100644
--- a/modules/gui/macosx/VLCMainMenu.m
+++ b/modules/gui/macosx/VLCMainMenu.m
@@ -63,6 +63,7 @@
VLCHelpWindowController *_helpWindowController;
VLCAddonsWindowController *_addonsController;
VLCRendererMenuController *_rendererMenuController;
+ VLCPlaylistController *_playlistController;
NSTimer *_cancelRendererDiscoveryTimer;
NSMenu *_playlistTableColumnsContextMenu;
@@ -86,6 +87,7 @@
- (void)awakeFromNib
{
_timeSelectionPanel = [[VLCTimeSelectionPanelController alloc] init];
+ _playlistController = [[VLCMain sharedInstance] playlistController];
/* check whether the user runs OSX with a RTL language */
NSArray* languages = [NSLocale preferredLanguages];
@@ -1604,19 +1606,19 @@
input_thread_t *p_input = playlist_CurrentInput(p_playlist);
if (mi == _stop || mi == _voutMenustop || mi == _dockMenustop) {
- if (!p_input)
- enabled = NO;
+ // FIXME: disable the stop item as soon as we can detect if there is an input or not*/
+/* if (!p_input)
+ enabled = NO;*/
[self setupMenus]; /* Make sure input menu is up to date */
} else if (mi == _previous ||
mi == _voutMenuprev ||
- mi == _dockMenuprevious ||
+ mi == _dockMenuprevious) {
+ enabled = _playlistController.hasPreviousPlaylistItem;
+ } else if (
mi == _next ||
mi == _voutMenunext ||
- mi == _dockMenunext
- ) {
- PL_LOCK;
- enabled = playlist_CurrentSize(p_playlist) > 1;
- PL_UNLOCK;
+ mi == _dockMenunext) {
+ enabled = _playlistController.hasNextPlaylistItem;
} else if (mi == _record) {
enabled = NO;
if (p_input)
diff --git a/modules/gui/macosx/VLCPlaylistController.m b/modules/gui/macosx/VLCPlaylistController.m
index f43b95788d..e72d6d54ec 100644
--- a/modules/gui/macosx/VLCPlaylistController.m
+++ b/modules/gui/macosx/VLCPlaylistController.m
@@ -366,10 +366,8 @@ static const struct vlc_playlist_callbacks playlist_callbacks = {
- (int)startPlaylist
{
- vlc_playlist_Lock(_p_playlist);
- int ret = vlc_playlist_Start(_p_playlist);
- vlc_playlist_Unlock(_p_playlist);
- return ret;
+ NSInteger selectedIndex = [_playlistDataSource.tableView selectedRow];
+ return [self playItemAtIndex:selectedIndex];
}
- (int)playPreviousItem
More information about the vlc-commits
mailing list