Commit 5f5bda80 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Use module_list_get

parent 42b0c980
...@@ -336,14 +336,13 @@ mvar_t *mvar_ObjectSetNew( intf_thread_t *p_intf, char *psz_name, ...@@ -336,14 +336,13 @@ mvar_t *mvar_ObjectSetNew( intf_thread_t *p_intf, char *psz_name,
const char *psz_capability ) const char *psz_capability )
{ {
mvar_t *s = mvar_New( psz_name, "set" ); mvar_t *s = mvar_New( psz_name, "set" );
int i; size_t i;
vlc_list_t *p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, module_t **p_list = module_list_get( NULL );
FIND_ANYWHERE );
for( i = 0; i < p_list->i_count; i++ ) for( i = 0; p_list[i]; i++ )
{ {
module_t *p_parser = (module_t *)p_list->p_values[i].p_object; module_t *p_parser = p_list[i];
if( module_provides( p_parser, psz_capability ) ) if( module_provides( p_parser, psz_capability ) )
{ {
mvar_t *sd = mvar_New( "sd", module_get_object( p_parser ) ); mvar_t *sd = mvar_New( "sd", module_get_object( p_parser ) );
...@@ -353,7 +352,7 @@ mvar_t *mvar_ObjectSetNew( intf_thread_t *p_intf, char *psz_name, ...@@ -353,7 +352,7 @@ mvar_t *mvar_ObjectSetNew( intf_thread_t *p_intf, char *psz_name,
} }
} }
vlc_list_release( p_list ); module_list_free( p_list );
return s; return s;
} }
......
...@@ -308,11 +308,10 @@ static VLCTreeItem *o_root_item = nil; ...@@ -308,11 +308,10 @@ static VLCTreeItem *o_root_item = nil;
if( [ o_children count] == 0 ) if( [ o_children count] == 0 )
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
vlc_list_t *p_list; module_t **p_list;
module_t *p_module = NULL; module_t *p_module = NULL;
module_t *p_main_module; module_t *p_main_module;
module_config_t *p_items; module_config_t *p_items;
int i = 0;
if( [[self name] isEqualToString: @"main"] ) if( [[self name] isEqualToString: @"main"] )
{ {
p_main_module = module_get_main( p_intf ); p_main_module = module_get_main( p_intf );
...@@ -390,15 +389,15 @@ static VLCTreeItem *o_root_item = nil; ...@@ -390,15 +389,15 @@ static VLCTreeItem *o_root_item = nil;
vlc_object_release( (vlc_object_t *)p_main_module ); vlc_object_release( (vlc_object_t *)p_main_module );
/* List the modules */ /* List the modules */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE ); p_list = module_list_get( NULL );
if( !p_list ) return nil; if( !p_list ) return nil;
/* Build a tree of the plugins */ /* Build a tree of the plugins */
/* Add the capabilities */ /* Add the capabilities */
for( i = 0; i < p_list->i_count; i++ ) for( size_t i = 0; p_list[i]; i++ )
{ {
unsigned int confsize; unsigned int confsize;
p_module = (module_t *)p_list->p_values[i].p_object; p_module = p_list[i];
/* Exclude the main module */ /* Exclude the main module */
if( module_is_main( p_module ) ) if( module_is_main( p_module ) )
...@@ -474,7 +473,7 @@ static VLCTreeItem *o_root_item = nil; ...@@ -474,7 +473,7 @@ static VLCTreeItem *o_root_item = nil;
children:IsALeafNode children:IsALeafNode
whithCategory: -1]]; whithCategory: -1]];
} }
vlc_list_release( p_list ); module_list_free( p_list );
} }
} }
return o_children; return o_children;
...@@ -512,34 +511,22 @@ static VLCTreeItem *o_root_item = nil; ...@@ -512,34 +511,22 @@ static VLCTreeItem *o_root_item = nil;
- (BOOL)hasPrefs:(NSString *)o_module_name - (BOOL)hasPrefs:(NSString *)o_module_name
{ {
unsigned int confsize;
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
module_t *p_parser; module_t *p_parser;
vlc_list_t *p_list;
char *psz_module_name;
int i_index;
psz_module_name = (char *)[o_module_name UTF8String]; psz_module_name = (char *)[o_module_name UTF8String];
/* look for module */ /* look for module */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE ); p_parser = module_find( p_intf, psz_module_name );
if( !p_parser )
for( i_index = 0; i_index < p_list->i_count; i_index++ ) return( NO );
{
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( !strcmp( module_get_object( p_parser ), psz_module_name ) )
{
unsigned int confsize;
module_config_get( p_parser, &confsize ); module_config_get( p_parser, &confsize );
BOOL b_has_prefs = confsize != 0; BOOL b_has_prefs = confsize != 0;
vlc_list_release( p_list ); module_release( p_parser );
return( b_has_prefs ); return( b_has_prefs );
}
}
vlc_list_release( p_list );
return( NO );
} }
- (NSView *)showView:(NSScrollView *)o_prefs_view - (NSView *)showView:(NSScrollView *)o_prefs_view
......
...@@ -1254,9 +1254,8 @@ ...@@ -1254,9 +1254,8 @@
if( [super initWithFrame: mainFrame item: _p_item] != nil ) if( [super initWithFrame: mainFrame item: _p_item] != nil )
{ {
int i_index; size_t i_index;
vlc_list_t *p_list; module_t *p_parser, **p_list;
module_t *p_parser;
i_view_type = CONFIG_ITEM_MODULE; i_view_type = CONFIG_ITEM_MODULE;
o_popupTooltip = [[VLCMain sharedInstance] wrapString: o_popupTooltip = [[VLCMain sharedInstance] wrapString:
...@@ -1282,10 +1281,10 @@ ...@@ -1282,10 +1281,10 @@
[o_popup selectItem: [o_popup lastItem]]; [o_popup selectItem: [o_popup lastItem]];
/* build a list of available modules */ /* build a list of available modules */
p_list = vlc_list_find( VLCIntf, VLC_OBJECT_MODULE, FIND_ANYWHERE ); p_list = module_list_get( NULL );
for( i_index = 0; i_index < p_list->i_count; i_index++ ) for( i_index = 0; p_list[i_index]; i_index++ )
{ {
p_parser = (module_t *)p_list->p_values[i_index].p_object; p_parser = p_list[i_index];
if( p_item->i_type == CONFIG_ITEM_MODULE ) if( p_item->i_type == CONFIG_ITEM_MODULE )
{ {
...@@ -1304,7 +1303,7 @@ ...@@ -1304,7 +1303,7 @@
{ {
int i; int i;
if( !strcmp( module_get_object( p_parser ), "main" ) ) if( module_is_main( p_parser ) )
continue; continue;
unsigned int confsize; unsigned int confsize;
unsigned int unused; unsigned int unused;
...@@ -1327,7 +1326,7 @@ ...@@ -1327,7 +1326,7 @@
} }
} }
} }
vlc_list_release( p_list ); module_list_free( p_list );
[self addSubview: o_popup]; [self addSubview: o_popup];
} }
return self; return self;
...@@ -1357,14 +1356,13 @@ ...@@ -1357,14 +1356,13 @@
{ {
NSString *newval = [o_popup titleOfSelectedItem]; NSString *newval = [o_popup titleOfSelectedItem];
char *returnval = NULL; char *returnval = NULL;
int i_module_index; size_t i_module_index;
vlc_list_t *p_list; module_t *p_parser, **p_list;
module_t *p_parser;
p_list = vlc_list_find( VLCIntf, VLC_OBJECT_MODULE, FIND_ANYWHERE ); p_list = module_list_get( NULL );
for( i_module_index = 0; i_module_index < p_list->i_count; i_module_index++ ) for( i_module_index = 0; p_list[i_module_index]; i_module_index++ )
{ {
p_parser = (module_t *)p_list->p_values[i_module_index].p_object; p_parser = p_list[i_module_index];
if( p_item->i_type == CONFIG_ITEM_MODULE ) if( p_item->i_type == CONFIG_ITEM_MODULE )
{ {
...@@ -1383,7 +1381,7 @@ ...@@ -1383,7 +1381,7 @@
{ {
int i; int i;
if( !strcmp( module_get_object( p_parser ), "main" ) ) if( module_is_main( p_parser) )
continue; continue;
unsigned int confsize, unused; unsigned int confsize, unused;
module_config_get( p_parser, &confsize ); module_config_get( p_parser, &confsize );
...@@ -1405,7 +1403,7 @@ ...@@ -1405,7 +1403,7 @@
} }
} }
} }
vlc_list_release( p_list ); module_list_free( p_list );
return returnval; return returnval;
} }
@end @end
...@@ -2043,21 +2041,20 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST ) ...@@ -2043,21 +2041,20 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST )
return nil; return nil;
//Fill our array to know how may items we have... //Fill our array to know how may items we have...
vlc_list_t *p_list; module_t *p_parser, **p_list;
module_t *p_parser; size_t i_module_index;
int i_module_index;
NSRect mainFrame = [o_parent_view frame]; NSRect mainFrame = [o_parent_view frame];
NSString *o_labelString, *o_textfieldString, *o_tooltip; NSString *o_labelString, *o_textfieldString, *o_tooltip;
o_modulearray = [[NSMutableArray alloc] initWithCapacity:10]; o_modulearray = [[NSMutableArray alloc] initWithCapacity:10];
/* build a list of available modules */ /* build a list of available modules */
p_list = vlc_list_find( VLCIntf, VLC_OBJECT_MODULE, FIND_ANYWHERE ); p_list = module_list_get( );
for( i_module_index = 0; i_module_index < p_list->i_count; i_module_index++ ) for( i_module_index = 0; p_list[i_module_index]; i_module_index++ )
{ {
int i; int i;
p_parser = (module_t *)p_list->p_values[i_module_index].p_object; p_parser = p_list[i_module_index];
if( !strcmp( module_get_object( p_parser ), "main" ) ) if( module_is_main( p_parser ) )
continue; continue;
unsigned int confsize; unsigned int confsize;
...@@ -2091,7 +2088,7 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST ) ...@@ -2091,7 +2088,7 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST )
} }
} }
} }
vlc_list_release( p_list ); module_list_free( p_list );
mainFrame.size.height = 30 + 18 * [o_modulearray count]; mainFrame.size.height = 30 + 18 * [o_modulearray count];
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
......
...@@ -363,14 +363,13 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des ...@@ -363,14 +363,13 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
- (void)setupButton: (NSPopUpButton *)object forModuleList: (const char *)name - (void)setupButton: (NSPopUpButton *)object forModuleList: (const char *)name
{ {
module_config_t *p_item; module_config_t *p_item;
vlc_list_t *p_list; module_t *p_parser, **p_list;
module_t *p_parser;
int y = 0; int y = 0;
[object removeAllItems]; [object removeAllItems];
p_item = config_FindConfig( VLC_OBJECT(p_intf), name ); p_item = config_FindConfig( VLC_OBJECT(p_intf), name );
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE ); p_list = module_list_get( NULL );
if( !p_item ||!p_list ) if( !p_item ||!p_list )
{ {
if( p_list ) vlc_list_release(p_list); if( p_list ) vlc_list_release(p_list);
...@@ -379,17 +378,17 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des ...@@ -379,17 +378,17 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
} }
[object addItemWithTitle: _NS("Default")]; [object addItemWithTitle: _NS("Default")];
for( int i_index = 0; i_index < p_list->i_count; i_index++ ) for( size_t i_index = 0; p_list[i_index]; i_index++ )
{ {
p_parser = (module_t *)p_list->p_values[i_index].p_object; p_parser = p_list[i_index];
if( p_parser && module_provides( p_parser, p_item->psz_type ) ) if( module_provides( p_parser, p_item->psz_type ) )
{ {
[object addItemWithTitle: [NSString stringWithUTF8String: module_GetLongName( p_parser ) ?: ""]]; [object addItemWithTitle: [NSString stringWithUTF8String: module_GetLongName( p_parser ) ?: ""]];
if( p_item->value.psz && !strcmp( p_item->value.psz, module_get_object( p_parser ) ) ) if( p_item->value.psz && !strcmp( p_item->value.psz, module_get_object( p_parser ) ) )
[object selectItem: [object lastItem]]; [object selectItem: [object lastItem]];
} }
} }
vlc_list_release( p_list ); module_list_free( p_list );
[object setToolTip: _NS(p_item->psz_longtext)]; [object setToolTip: _NS(p_item->psz_longtext)];
} }
...@@ -675,15 +674,14 @@ static inline void save_string_list( intf_thread_t * p_intf, id object, const ch ...@@ -675,15 +674,14 @@ static inline void save_string_list( intf_thread_t * p_intf, id object, const ch
static inline void save_module_list( intf_thread_t * p_intf, id object, const char * name ) static inline void save_module_list( intf_thread_t * p_intf, id object, const char * name )
{ {
module_config_t *p_item; module_config_t *p_item;
module_t *p_parser; module_t *p_parser, **p_list;
vlc_list_t *p_list;
p_item = config_FindConfig( VLC_OBJECT(p_intf), name ); p_item = config_FindConfig( VLC_OBJECT(p_intf), name );
p_list = vlc_list_find( VLCIntf, VLC_OBJECT_MODULE, FIND_ANYWHERE ); p_list = module_list_get( NULL );
for( int i_module_index = 0; i_module_index < p_list->i_count; i_module_index++ ) for( size_t i_module_index = 0; p_list[i_module_index]; i_module_index++ )
{ {
p_parser = (module_t *)p_list->p_values[i_module_index].p_object; p_parser = p_list[i_module_index];
if( p_item->i_type == CONFIG_ITEM_MODULE && module_provides( p_parser, p_item->psz_type ) ) if( p_item->i_type == CONFIG_ITEM_MODULE && module_provides( p_parser, p_item->psz_type ) )
{ {
...@@ -694,7 +692,7 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch ...@@ -694,7 +692,7 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
} }
} }
} }
vlc_list_release( p_list ); module_list_free( p_list );
if( [[[object selectedItem] title] isEqualToString: _NS( "Default" )] ) if( [[[object selectedItem] title] isEqualToString: _NS( "Default" )] )
config_PutPsz( p_intf, name, "" ); config_PutPsz( p_intf, name, "" );
} }
......
...@@ -194,14 +194,10 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -194,14 +194,10 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
module_release( p_module ); module_release( p_module );
vlc_list_t *p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, module_t **p_list = module_list_get( NULL );
FIND_ANYWHERE );
/* Build the tree of plugins */ /* Build the tree of plugins */
for( int i_index = 0; i_index < p_list->i_count; i_index++ ) for( size_t i = 0; (p_module = p_list[i]) != NULL; i++ )
{ {
/* Take every module */
p_module = (module_t *)p_list->p_values[i_index].p_object;
// Main module excluded // Main module excluded
if( module_is_main( p_module) ) continue; if( module_is_main( p_module) ) continue;
...@@ -283,7 +279,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -283,7 +279,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
/* We got everything, just sort a bit */ /* We got everything, just sort a bit */
sortItems( 0, Qt::AscendingOrder ); sortItems( 0, Qt::AscendingOrder );
vlc_list_release( p_list ); module_list_free( p_list );
} }
PrefsTree::~PrefsTree() {} PrefsTree::~PrefsTree() {}
......
...@@ -549,18 +549,15 @@ ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this, ...@@ -549,18 +549,15 @@ ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this,
void ModuleConfigControl::finish( bool bycat ) void ModuleConfigControl::finish( bool bycat )
{ {
vlc_list_t *p_list;
module_t *p_parser; module_t *p_parser;
combo->setEditable( false ); combo->setEditable( false );
/* build a list of available modules */ /* build a list of available modules */
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE ); module_t **p_list = module_list_get( NULL );
combo->addItem( qtr("Default") ); combo->addItem( qtr("Default") );
for( int i_index = 0; i_index < p_list->i_count; i_index++ ) for( size_t i = 0; (p_parser = p_list[i]) != NULL; i++ )
{ {
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( bycat ) if( bycat )
{ {
if( !strcmp( module_get_object( p_parser ), "main" ) ) continue; if( !strcmp( module_get_object( p_parser ), "main" ) ) continue;
...@@ -592,7 +589,7 @@ void ModuleConfigControl::finish( bool bycat ) ...@@ -592,7 +589,7 @@ void ModuleConfigControl::finish( bool bycat )
combo->setCurrentIndex( combo->count() - 1 ); combo->setCurrentIndex( combo->count() - 1 );
} }
} }
vlc_list_release( p_list ); module_list_free( p_list );
combo->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); combo->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
if( label ) if( label )
label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
...@@ -670,15 +667,12 @@ ModuleListConfigControl::~ModuleListConfigControl() ...@@ -670,15 +667,12 @@ ModuleListConfigControl::~ModuleListConfigControl()
void ModuleListConfigControl::finish( bool bycat ) void ModuleListConfigControl::finish( bool bycat )
{ {
vlc_list_t *p_list;
module_t *p_parser; module_t *p_parser;
/* build a list of available modules */ /* build a list of available modules */
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE ); module_t **p_list = module_list_get( NULL );
for( int i_index = 0; i_index < p_list->i_count; i_index++ ) for( size_t i = 0; (p_parser = p_list[i]) != NULL; i++ )
{ {
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( bycat ) if( bycat )
{ {
if( !strcmp( module_get_object( p_parser ), "main" ) ) continue; if( !strcmp( module_get_object( p_parser ), "main" ) ) continue;
...@@ -703,7 +697,7 @@ void ModuleListConfigControl::finish( bool bycat ) ...@@ -703,7 +697,7 @@ void ModuleListConfigControl::finish( bool bycat )
CHECKBOX_LISTS; CHECKBOX_LISTS;
} }
} }
vlc_list_release( p_list ); module_list_free( p_list );
text->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); text->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
assert( groupBox ); assert( groupBox );
groupBox->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); groupBox->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
......
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