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

David Fuhrmann git at videolan.org
Wed Jul 25 19:14:37 CEST 2012


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Wed Jul 25 18:38:09 2012 +0200| [07e72e56f24d7184334bb7e25911c0a1dfdf2c3c] | committer: David Fuhrmann

macosx: improve main menu handling for autogenerated items

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

close #6998

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=07e72e56f24d7184334bb7e25911c0a1dfdf2c3c
---

 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 5baf6dd..47e7ff3 100644
--- a/modules/gui/macosx/MainMenu.m
+++ b/modules/gui/macosx/MainMenu.m
@@ -489,7 +489,6 @@ static VLCMainMenu *_o_sharedInstance = nil;
             vlc_object_release( p_vout );
 
             [self refreshVoutDeviceMenu:nil];
-            [self setSubmenusEnabled: YES];
         }
         vlc_object_release( p_input );
     }
@@ -518,6 +517,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];
@@ -1007,17 +1007,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 )];
@@ -1086,6 +1075,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 )
@@ -1116,7 +1107,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