Commit 0c290c65 authored by David Fuhrmann's avatar David Fuhrmann Committed by Felix Paul Kühne

macosx: improve main menu handling for autogenerated items

especially:
- don't show outdated items in sub menus
- disable unusable sub menus

close #6998
(cherry picked from commit 07e72e56f24d7184334bb7e25911c0a1dfdf2c3c)
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent c4ea5571
...@@ -468,7 +468,6 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -468,7 +468,6 @@ static VLCMainMenu *_o_sharedInstance = nil;
vlc_object_release( p_vout ); vlc_object_release( p_vout );
[self refreshVoutDeviceMenu:nil]; [self refreshVoutDeviceMenu:nil];
[self setSubmenusEnabled: YES];
} }
vlc_object_release( p_input ); vlc_object_release( p_input );
} }
...@@ -497,6 +496,7 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -497,6 +496,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
NSArray * o_screens = [NSScreen screens]; NSArray * o_screens = [NSScreen screens];
NSMenuItem * o_mitem; NSMenuItem * o_mitem;
count = [o_screens count]; count = [o_screens count];
[o_mi_screen setEnabled: YES];
[o_submenu addItemWithTitle: _NS("Default") action:@selector(toggleFullscreenDevice:) keyEquivalent:@""]; [o_submenu addItemWithTitle: _NS("Default") action:@selector(toggleFullscreenDevice:) keyEquivalent:@""];
o_mitem = [o_submenu itemAtIndex: 0]; o_mitem = [o_submenu itemAtIndex: 0];
[o_mitem setTag: 0]; [o_mitem setTag: 0];
...@@ -901,17 +901,6 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -901,17 +901,6 @@ static VLCMainMenu *_o_sharedInstance = nil;
return; return;
} }
/* Make sure we want to display the variable
* special case for spu-es, which we want to display in any case */
if( i_type & VLC_VAR_HASCHOICE && strcmp( psz_variable, "spu-es" ) )
{
var_Change( p_object, psz_variable, VLC_VAR_CHOICESCOUNT, &val, NULL );
if( val.i_int == 0 )
return;
if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 )
return;
}
/* Get the descriptive name of the variable */ /* Get the descriptive name of the variable */
var_Change( p_object, psz_variable, VLC_VAR_GETTEXT, &text, NULL ); var_Change( p_object, psz_variable, VLC_VAR_GETTEXT, &text, NULL );
[o_mi setTitle: _NS( text.psz_string ? text.psz_string : psz_variable )]; [o_mi setTitle: _NS( text.psz_string ? text.psz_string : psz_variable )];
...@@ -980,6 +969,8 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -980,6 +969,8 @@ static VLCMainMenu *_o_sharedInstance = nil;
/* this is more efficient then the legacy code, but 10.6+ only */ /* this is more efficient then the legacy code, but 10.6+ only */
[o_menu removeAllItems]; [o_menu removeAllItems];
} }
/* we disable everything here, and enable it again when needed, below */
[o_parent setEnabled:NO];
/* Aspect Ratio */ /* Aspect Ratio */
if( [[o_parent title] isEqualToString: _NS("Aspect-ratio")] == YES ) if( [[o_parent title] isEqualToString: _NS("Aspect-ratio")] == YES )
...@@ -1010,7 +1001,8 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -1010,7 +1001,8 @@ static VLCMainMenu *_o_sharedInstance = nil;
if( i_type & VLC_VAR_HASCHOICE ) if( i_type & VLC_VAR_HASCHOICE )
{ {
var_Change( p_object, psz_variable, VLC_VAR_CHOICESCOUNT, &val, NULL ); var_Change( p_object, psz_variable, VLC_VAR_CHOICESCOUNT, &val, NULL );
if( val.i_int == 0 ) return; if( val.i_int == 0 )
return;
if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 ) if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 )
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment