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