Commit acea7c44 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

modules/gui/macosx/prefs*.m: Fix for module_t privatization. Feel free to...

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