[vlc-commits] macosx: improve main menu handling for autogenerated items

David Fuhrmann git at videolan.org
Sat Jul 28 16:47:09 CEST 2012


vlc/vlc-2.0 | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Wed Jul 25 18:38:09 2012 +0200| [0c290c6560603b94c0319f6c5981fe326086b2f0] | committer: 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: Felix Paul Kühne <fkuehne at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=0c290c6560603b94c0319f6c5981fe326086b2f0
---

 modules/gui/macosx/MainMenu.m |   18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/modules/gui/macosx/MainMenu.m b/modules/gui/macosx/MainMenu.m
index bc0b93f..8521605 100644
--- a/modules/gui/macosx/MainMenu.m
+++ b/modules/gui/macosx/MainMenu.m
@@ -468,7 +468,6 @@ static VLCMainMenu *_o_sharedInstance = nil;
             vlc_object_release( p_vout );
 
             [self refreshVoutDeviceMenu:nil];
-            [self setSubmenusEnabled: YES];
         }
         vlc_object_release( p_input );
     }
@@ -497,6 +496,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
     NSArray * o_screens = [NSScreen screens];
     NSMenuItem * o_mitem;
     count = [o_screens count];
+    [o_mi_screen setEnabled: YES];
     [o_submenu addItemWithTitle: _NS("Default") action:@selector(toggleFullscreenDevice:) keyEquivalent:@""];
     o_mitem = [o_submenu itemAtIndex: 0];
     [o_mitem setTag: 0];
@@ -901,17 +901,6 @@ static VLCMainMenu *_o_sharedInstance = nil;
             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 */
     var_Change( p_object, psz_variable, VLC_VAR_GETTEXT, &text, NULL );
     [o_mi setTitle: _NS( text.psz_string ? text.psz_string : psz_variable )];
@@ -980,6 +969,8 @@ static VLCMainMenu *_o_sharedInstance = nil;
         /* this is more efficient then the legacy code, but 10.6+ only */
         [o_menu removeAllItems];
     }
+    /* we disable everything here, and enable it again when needed, below */
+    [o_parent setEnabled:NO];
 
     /* Aspect Ratio */
     if( [[o_parent title] isEqualToString: _NS("Aspect-ratio")] == YES )
@@ -1010,7 +1001,8 @@ static VLCMainMenu *_o_sharedInstance = nil;
     if( i_type & VLC_VAR_HASCHOICE )
     {
         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 )
             return;
     }



More information about the vlc-commits mailing list