modules/gui/macosx/prefs*.m: Fix for module_t privatization. Feel free to test. That...
authorPierre d'Herbemont <pdherbemont@videolan.org>
Fri, 14 Dec 2007 16:57:01 +0000 (16:57 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Fri, 14 Dec 2007 16:57:01 +0000 (16:57 +0000)
modules/gui/macosx/prefs.m
modules/gui/macosx/prefs_widgets.m

index cce4386..5533968 100644 (file)
@@ -283,8 +283,7 @@ static VLCTreeItem *o_root_item = nil;
 
         /* get parser */
         p_parser = (module_t *)p_list->p_values[i_index].p_object;
 
         /* get parser */
         p_parser = (module_t *)p_list->p_values[i_index].p_object;
-        p_end = p_parser->p_config + p_parser->confsize;
+
         if( [[self getName] isEqualToString: @"main"] )
         {
             /*
         if( [[self getName] isEqualToString: @"main"] )
         {
             /*
@@ -293,7 +292,7 @@ static VLCTreeItem *o_root_item = nil;
             for( i_index = 0; i_index < p_list->i_count; i_index++ )
             {
                 p_module = (module_t *)p_list->p_values[i_index].p_object;
             for( i_index = 0; i_index < p_list->i_count; i_index++ )
             {
                 p_module = (module_t *)p_list->p_values[i_index].p_object;
-                if( !strcmp( p_module->psz_object_name, "main" ) )
+                if( !strcmp( module_GetObjName( p_module ), "main" ) )
                     break;
             }
             if( p_module == NULL )
                     break;
             }
             if( p_module == NULL )
@@ -308,7 +307,9 @@ static VLCTreeItem *o_root_item = nil;
                 /* Enumerate config categories and store a reference so we can
                  * generate their config panel them when it is asked by the user. */
                 VLCTreeItem *p_last_category = NULL;
                 /* Enumerate config categories and store a reference so we can
                  * generate their config panel them when it is asked by the user. */
                 VLCTreeItem *p_last_category = NULL;
-                p_item = p_module->p_config;
+                unsigned int i_confsize;
+                p_item = module_GetConfig( p_parser, &i_confsize );
+                p_end = p_item + i_confsize;
                 o_children = [[NSMutableArray alloc] initWithCapacity:10];
                 if( p_item ) do
                 {
                 o_children = [[NSMutableArray alloc] initWithCapacity:10];
                 if( p_item ) do
                 {
@@ -334,7 +335,7 @@ static VLCTreeItem *o_root_item = nil;
                             parent:self
                             children:[[NSMutableArray alloc]
                                 initWithCapacity:10]
                             parent:self
                             children:[[NSMutableArray alloc]
                                 initWithCapacity:10]
-                            whithCategory: p_item - p_module->p_config]];
+                            whithCategory: p_item - module_GetConfig( p_module, &i_confsize )]];
                         break;
                     case CONFIG_SUBCATEGORY:
                         if( p_item->value.i == -1 ) break;
                         break;
                     case CONFIG_SUBCATEGORY:
                         if( p_item->value.i == -1 ) break;
@@ -362,7 +363,7 @@ static VLCTreeItem *o_root_item = nil;
                                 parent:p_last_category
                                 children:[[NSMutableArray alloc]
                                     initWithCapacity:10]
                                 parent:p_last_category
                                 children:[[NSMutableArray alloc]
                                     initWithCapacity:10]
-                                whithCategory: p_item - p_module->p_config]];
+                                whithCategory: p_item - module_GetConfig( p_parser, &i_confsize )]];
                         }
  
                         break;
                         }
  
                         break;
@@ -376,18 +377,19 @@ static VLCTreeItem *o_root_item = nil;
             /* Add the capabilities */
             for( i_index = 0; i_index < p_list->i_count; i_index++ )
             {
             /* Add the capabilities */
             for( i_index = 0; i_index < p_list->i_count; i_index++ )
             {
+                unsigned int confsize;
                 p_module = (module_t *)p_list->p_values[i_index].p_object;
 
                 /* Exclude the main module */
                 p_module = (module_t *)p_list->p_values[i_index].p_object;
 
                 /* Exclude the main module */
-                if( !strcmp( p_module->psz_object_name, "main" ) )
+                if( !strcmp( module_GetObjName( p_module ), "main" ) )
                     continue;
 
                 /* Exclude empty plugins (submodules don't have config */
                 /* options, they are stored in the parent module) */
                     continue;
 
                 /* Exclude empty plugins (submodules don't have config */
                 /* options, they are stored in the parent module) */
-                if( p_module->b_submodule )
-                    continue;
-                else
-                    p_item = p_module->p_config;
+// Does not work
+//                if( modules_IsSubModule( p_module ) )
+//                    continue;
+                p_item = module_GetConfig( p_module, &confsize );
 
                 if( !p_item ) continue;
                 int i_category = -1;
 
                 if( !p_item ) continue;
                 int i_category = -1;
@@ -442,13 +444,11 @@ static VLCTreeItem *o_root_item = nil;
 
                 [p_subcategory_item->o_children addObject:[[VLCTreeItem alloc]
                     initWithName:[[VLCMain sharedInstance]
 
                 [p_subcategory_item->o_children addObject:[[VLCTreeItem alloc]
                     initWithName:[[VLCMain sharedInstance]
-                        localizedString: (char *)p_module->psz_shortname ?
-                        (char *)p_module->psz_shortname : (char *)p_module->psz_object_name ]
+                        localizedString: module_GetName( p_module, VLC_FALSE ) ]
                     withTitle:[[VLCMain sharedInstance]
                     withTitle:[[VLCMain sharedInstance]
-                        localizedString: (char *)p_module->psz_longname ?
-                        (char *)p_module->psz_longname : (char *)p_module->psz_object_name ]
+                        localizedString:  module_GetLongName( p_module ) ]
                     withHelp: @""
                     withHelp: @""
-                    ID: p_module->i_object_id
+                    ID: ((vlc_object_t*)p_module)->i_object_id
                     parent:p_subcategory_item
                     children:IsALeafNode
                     whithCategory: -1]];
                     parent:p_subcategory_item
                     children:IsALeafNode
                     whithCategory: -1]];
@@ -506,9 +506,11 @@ static VLCTreeItem *o_root_item = nil;
     {
         p_parser = (module_t *)p_list->p_values[i_index].p_object ;
 
     {
         p_parser = (module_t *)p_list->p_values[i_index].p_object ;
 
-        if( !strcmp( p_parser->psz_object_name, psz_module_name ) )
+        if( !strcmp( module_GetObjName( p_parser ), psz_module_name ) )
         {
         {
-            BOOL b_has_prefs = p_parser->i_config_items != 0;
+            unsigned int confsize;
+            module_GetConfig( p_parser, &confsize );
+            BOOL b_has_prefs = confsize != 0;
             vlc_list_release( p_list );
             return( b_has_prefs );
         }
             vlc_list_release( p_list );
             return( b_has_prefs );
         }
@@ -541,23 +543,20 @@ static VLCTreeItem *o_root_item = nil;
         module_t        *p_parser = NULL;
         module_config_t *p_item,
                         *p_end;
         module_t        *p_parser = NULL;
         module_config_t *p_item,
                         *p_end;
+        unsigned int confsize;
 
         o_subviews = [[NSMutableArray alloc] initWithCapacity:10];
         /* Get a pointer to the module */
         if( i_object_category == -1 )
         {
             p_parser = (module_t *) vlc_object_get( p_intf, i_object_id );
 
         o_subviews = [[NSMutableArray alloc] initWithCapacity:10];
         /* Get a pointer to the module */
         if( i_object_category == -1 )
         {
             p_parser = (module_t *) vlc_object_get( p_intf, i_object_id );
-            if( !p_parser || p_parser->i_object_type != VLC_OBJECT_MODULE )
+            if( !p_parser || ((vlc_object_t*)p_parser)->i_object_type != VLC_OBJECT_MODULE )
             {
                 /* 0OOoo something went really bad */
                 return nil;
             }
             {
                 /* 0OOoo something went really bad */
                 return nil;
             }
-            p_end = p_parser->p_config + p_parser->confsize;
-            p_item = p_parser->p_config;
-
-            p_item = p_parser->p_config + 1;
+            p_item = module_GetConfig( p_parser, &confsize );
+            p_end = p_item + confsize;
 
             do
             {
 
             do
             {
@@ -594,7 +593,7 @@ static VLCTreeItem *o_root_item = nil;
                 }
             } while( p_item < p_end && p_item++ );
 
                 }
             } while( p_item < p_end && p_item++ );
 
-            vlc_object_release( p_parser );
+            vlc_object_release( (vlc_object_t*)p_parser );
         }
         else
         {
         }
         else
         {
@@ -608,7 +607,7 @@ static VLCTreeItem *o_root_item = nil;
             for( i_index = 0; i_index < p_list->i_count; i_index++ )
             {
                 p_parser = (module_t *)p_list->p_values[i_index].p_object;
             for( i_index = 0; i_index < p_list->i_count; i_index++ )
             {
                 p_parser = (module_t *)p_list->p_values[i_index].p_object;
-                if( !strcmp( p_parser->psz_object_name, "main" ) )
+                if( !strcmp( module_GetObjName( p_parser ), "main" ) )
                     break;
             }
             if( p_parser == NULL )
                     break;
             }
             if( p_parser == NULL )
@@ -616,9 +615,11 @@ static VLCTreeItem *o_root_item = nil;
                 msg_Err( p_intf, "could not load preferences" );
                 return o_view;
             }
                 msg_Err( p_intf, "could not load preferences" );
                 return o_view;
             }
-            p_end = p_parser->p_config + p_parser->confsize;
-            p_item = (p_parser->p_config + i_object_category);
+            unsigned int confsize;
+            p_item = module_GetConfig( p_parser, &confsize );
+            p_end = p_item + confsize;
+            p_item += i_object_category;
+
             if( ( p_item->i_type == CONFIG_CATEGORY ) &&
               ( ( p_item->value.i == CAT_PLAYLIST )  ||
                 ( p_item->value.i == CAT_AUDIO )  ||
             if( ( p_item->i_type == CONFIG_CATEGORY ) &&
               ( ( p_item->value.i == CAT_PLAYLIST )  ||
                 ( p_item->value.i == CAT_AUDIO )  ||
index 9049769..bf5c6d3 100644 (file)
 
             if( p_item->i_type == CONFIG_ITEM_MODULE )
             {
 
             if( p_item->i_type == CONFIG_ITEM_MODULE )
             {
-                if( !strcmp( p_parser->psz_capability,
-                            p_item->psz_type ) )
+                if( module_IsCapable( p_parser, p_item->psz_type ) )
                 {
                     NSString *o_description = [[VLCMain sharedInstance]
                 {
                     NSString *o_description = [[VLCMain sharedInstance]
-                        localizedString: (char *)p_parser->psz_longname];
+                        localizedString: module_GetLongName( p_parser )];
                     [o_popup addItemWithTitle: o_description];
 
                     if( p_item->value.psz &&
                     [o_popup addItemWithTitle: o_description];
 
                     if( p_item->value.psz &&
-                !strcmp( p_item->value.psz, p_parser->psz_object_name ) )
+                !strcmp( p_item->value.psz, module_GetObjName( p_parser ) ) )
                         [o_popup selectItem:[o_popup lastItem]];
                 }
             }
                         [o_popup selectItem:[o_popup lastItem]];
                 }
             }
             {
                 int i;
 
             {
                 int i;
 
-                if( !strcmp( p_parser->psz_object_name, "main" ) )
+                if( !strcmp( module_GetObjName( p_parser ), "main" ) )
                     continue;
                     continue;
-
-                for ( i = 0; i < p_parser->confsize; i++ )
+                unsigned int confsize;
+                module_GetConfig( p_parser, &confsize );
+                for ( i = 0; i < confsize; i++ )
                 {
                 {
-                    module_config_t *p_config = p_parser->p_config + i;
+                    module_config_t *p_config = module_GetConfig( p_parser, NULL ) + i;
                     /* Hack: required subcategory is stored in i_min */
                     if( p_config->i_type == CONFIG_SUBCATEGORY &&
                         p_config->value.i == p_item->min.i )
                     {
                         NSString *o_description = [[VLCMain sharedInstance]
                     /* Hack: required subcategory is stored in i_min */
                     if( p_config->i_type == CONFIG_SUBCATEGORY &&
                         p_config->value.i == p_item->min.i )
                     {
                         NSString *o_description = [[VLCMain sharedInstance]
-                            localizedString: (char *)p_parser->psz_longname];
+                            localizedString: module_GetLongName( p_parser )];
                         [o_popup addItemWithTitle: o_description];
 
                         if( p_item->value.psz && !strcmp(p_item->value.psz,
                         [o_popup addItemWithTitle: o_description];
 
                         if( p_item->value.psz && !strcmp(p_item->value.psz,
-                                                p_parser->psz_object_name) )
+                                                module_GetObjName( p_parser )) )
                             [o_popup selectItem:[o_popup lastItem]];
                     }
                 }
                             [o_popup selectItem:[o_popup lastItem]];
                     }
                 }
 
         if( p_item->i_type == CONFIG_ITEM_MODULE )
         {
 
         if( p_item->i_type == CONFIG_ITEM_MODULE )
         {
-            if( !strcmp( p_parser->psz_capability,
-                    p_item->psz_type ) )
+            if( module_IsCapable( p_parser, p_item->psz_type ) )
             {
                 NSString *o_description = [[VLCMain sharedInstance]
             {
                 NSString *o_description = [[VLCMain sharedInstance]
-                    localizedString: (char *)p_parser->psz_longname];
+                    localizedString: module_GetLongName( p_parser )];
                 if( [newval isEqualToString: o_description] )
                 {
                 if( [newval isEqualToString: o_description] )
                 {
-                    returnval = strdup(p_parser->psz_object_name);
+                    returnval = strdup( module_GetObjName( p_parser ));
                     break;
                 }
             }
                     break;
                 }
             }
         {
             int i;
 
         {
             int i;
 
-            if( !strcmp( p_parser->psz_object_name, "main" ) )
+            if( !strcmp( module_GetObjName( p_parser ), "main" ) )
                 continue;
                 continue;
-
-            for ( i = 0; i < p_parser->confsize; i++ )
+            unsigned int confsize;
+            module_GetConfig( p_parser, &confsize );
+            for ( i = 0; i < confsize; i++ )
             {
             {
-                module_config_t *p_config = p_parser->p_config + i;
+                module_config_t *p_config = module_GetConfig( p_parser, NULL ) + i;
                 /* Hack: required subcategory is stored in i_min */
                 if( p_config->i_type == CONFIG_SUBCATEGORY &&
                     p_config->value.i == p_item->min.i )
                 {
                     NSString *o_description = [[VLCMain sharedInstance]
                 /* Hack: required subcategory is stored in i_min */
                 if( p_config->i_type == CONFIG_SUBCATEGORY &&
                     p_config->value.i == p_item->min.i )
                 {
                     NSString *o_description = [[VLCMain sharedInstance]
-                        localizedString: (char *)p_parser->psz_longname];
+                        localizedString: module_GetLongName( p_parser )];
                     if( [newval isEqualToString: o_description] )
                     {
                     if( [newval isEqualToString: o_description] )
                     {
-                        returnval = strdup(p_parser->psz_object_name);
+                        returnval = strdup(module_GetObjName( p_parser ));
                         break;
                     }
                 }
                         break;
                     }
                 }
@@ -2050,12 +2050,15 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST )
         int i;
         p_parser = (module_t *)p_list->p_values[i_module_index].p_object;
 
         int i;
         p_parser = (module_t *)p_list->p_values[i_module_index].p_object;
 
-        if( !strcmp( p_parser->psz_object_name, "main" ) )
+        if( !strcmp( module_GetObjName( p_parser ), "main" ) )
             continue;
 
             continue;
 
-        for ( i = 0; i < p_parser->confsize; i++ )
+        unsigned int confsize;
+        module_GetConfig( p_parser, &confsize );
+
+        for ( i = 0; i < confsize; i++ )
         {
         {
-            module_config_t *p_config = p_parser->p_config + i;
+            module_config_t *p_config = module_GetConfig( p_parser, NULL ) + i;
             NSString *o_modulelongname, *o_modulename;
             NSNumber *o_moduleenabled = nil;
 
             NSString *o_modulelongname, *o_modulename;
             NSNumber *o_moduleenabled = nil;
 
@@ -2064,12 +2067,12 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST )
                 p_config->value.i == _p_item->min.i )
             {
                 o_modulelongname = [NSString stringWithUTF8String:
                 p_config->value.i == _p_item->min.i )
             {
                 o_modulelongname = [NSString stringWithUTF8String:
-                                        p_parser->psz_longname];
+                                        module_GetLongName( p_parser )];
                 o_modulename = [NSString stringWithUTF8String:
                 o_modulename = [NSString stringWithUTF8String:
-                                        p_parser->psz_object_name];
+                                        module_GetObjName( p_parser )];
 
                 if( _p_item->value.psz &&
 
                 if( _p_item->value.psz &&
-                    strstr( _p_item->value.psz, p_parser->psz_object_name ) )
+                    strstr( _p_item->value.psz, module_GetObjName( p_parser ) ) )
                     o_moduleenabled = [NSNumber numberWithBool:YES];
                 else
                     o_moduleenabled = [NSNumber numberWithBool:NO];
                     o_moduleenabled = [NSNumber numberWithBool:YES];
                 else
                     o_moduleenabled = [NSNumber numberWithBool:NO];