[vlc-commits] MacOS X: fix preferences for ModulesConfig

Jean-Baptiste Kempf git at videolan.org
Fri Nov 18 18:59:20 CET 2011


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Nov 18 18:58:29 2011 +0100| [f2c1fa831fcfa76eef7ef2265de6f56c6ad562cb] | committer: Jean-Baptiste Kempf

MacOS X: fix preferences for ModulesConfig

Close #5024

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

 modules/gui/macosx/MainMenu.m      |    6 +++++-
 modules/gui/macosx/intf.m          |    2 ++
 modules/gui/macosx/prefs_widgets.m |   27 +++++++++++----------------
 3 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/modules/gui/macosx/MainMenu.m b/modules/gui/macosx/MainMenu.m
index 4cddd14..0f09a14 100644
--- a/modules/gui/macosx/MainMenu.m
+++ b/modules/gui/macosx/MainMenu.m
@@ -540,6 +540,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
 #pragma mark Recent Items
 - (void)openRecentItem:(id)item
 {
+    msg_Err( VLCIntf, "could not translate: %s", [[item title] UTF8String]);
     [[VLCMain sharedInstance] application: nil openFile: [item title]];
 }
 
@@ -1096,6 +1097,8 @@ static VLCMainMenu *_o_sharedInstance = nil;
 
 - (BOOL)validateMenuItem:(NSMenuItem *)o_mi
 {
+    msg_Err( VLCIntf, "Hello");
+
     NSString *o_title = [o_mi title];
     BOOL bEnabled = TRUE;
     vlc_value_t val;
@@ -1105,12 +1108,13 @@ static VLCMainMenu *_o_sharedInstance = nil;
     /* Recent Items Menu */
     if( [o_title isEqualToString: _NS("Clear Menu")] )
     {
+
         NSMenu * o_menu = [o_mi_open_recent submenu];
         int i_nb_items = [o_menu numberOfItems];
         NSArray * o_docs = [[NSDocumentController sharedDocumentController]
                             recentDocumentURLs];
         UInt32 i_nb_docs = [o_docs count];
-
+        msg_Err( VLCIntf, "Hello %i", i_nb_docs);
         if( i_nb_items > 1 )
         {
             while( --i_nb_items )
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index feb4294..b351f7c 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -854,6 +854,8 @@ static VLCMain *_o_sharedMainInstance = nil;
 {
     BOOL b_autoplay = config_GetInt( VLCIntf, "macosx-autoplay" );
     char *psz_uri = make_URI([o_filename UTF8String], "file" );
+    msg_Err( VLCIntf, "could not open: %s", psz_uri );
+
     if( !psz_uri )
         return( FALSE );
 
diff --git a/modules/gui/macosx/prefs_widgets.m b/modules/gui/macosx/prefs_widgets.m
index b1c2001..c1ed074 100644
--- a/modules/gui/macosx/prefs_widgets.m
+++ b/modules/gui/macosx/prefs_widgets.m
@@ -1313,6 +1313,7 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain];       \
                                 localizedString: (char *)p_item->psz_text];
         else
             o_labelString = [NSString stringWithString:@""];
+
         ADD_LABEL( o_label, mainFrame, 0, -1, o_labelString, o_popupTooltip )
         [o_label setAutoresizingMask:NSViewNotSizable ];
         [self addSubview: o_label];
@@ -1378,18 +1379,17 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain];       \
         }
         else
         {
-            int i;
-
             if( module_is_main( p_parser) )
                 continue;
-            unsigned int confsize, unused;
+
+            unsigned int confsize;
             module_config_t *p_config = module_config_get( p_parser, &confsize );
-            for ( i = 0; i < confsize; i++ )
+            for ( size_t i = 0; i < confsize; i++ )
             {
-                module_config_t *p_item = p_config + i;
+                module_config_t *p_cfg = p_config + i;
                 /* Hack: required subcategory is stored in i_min */
-                if( p_item->i_type == CONFIG_SUBCATEGORY &&
-                    p_item->value.i == p_item->min.i )
+                if( p_cfg->i_type == CONFIG_SUBCATEGORY &&
+                    p_cfg->value.i == p_cfg->min.i )
                 {
                     NSString *o_description = [[VLCMain sharedInstance]
                         localizedString: module_get_name( p_parser, TRUE )];
@@ -1436,30 +1436,25 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain];       \
         }
         else
         {
-            int i;
-
             if( module_is_main( p_parser ) )
                 continue;
             unsigned int confsize;
-            unsigned int unused;
+
             module_config_t *p_configlist = module_config_get( p_parser, &confsize );
-            for ( i = 0; i < confsize; i++ )
+            for ( size_t i = 0; i < confsize; i++ )
             {
                 module_config_t *p_config = &p_configlist[i];
                 /* Hack: required subcategory is stored in i_min */
                 if( p_config->i_type == CONFIG_SUBCATEGORY &&
-                    config_GetInt( VLCIntf, p_item->psz_name) == p_item->min.i )
+                    p_config->value.i == p_item->min.i )
                 {
                     NSString *o_description = [[VLCMain sharedInstance]
                         localizedString: module_get_name( p_parser, TRUE )];
                     [o_popup addItemWithTitle: o_description];
-                    char *psz_value = config_GetPsz( VLCIntf, p_item->psz_name );
 
-                    if( psz_value && !strcmp(psz_value,
+                    if( p_item->value.psz && !strcmp(p_item->value.psz,
                                             module_get_object( p_parser )) )
                         [o_popup selectItem:[o_popup lastItem]];
-
-                    free( psz_value );
                 }
             }
             module_config_free( p_configlist );



More information about the vlc-commits mailing list