+- (void)setupButton: (NSPopUpButton *)object forStringList: (const char *)name
+{
+ module_config_t *p_item;
+
+ [object removeAllItems];
+ p_item = config_FindConfig( VLC_OBJECT(p_intf), name );
+
+ /* serious problem, if no item found */
+ assert( p_item );
+
+ for( int i = 0; i < p_item->i_list; i++ )
+ {
+ NSMenuItem *mi;
+ if( p_item->ppsz_list_text != NULL )
+ mi = [[NSMenuItem alloc] initWithTitle: _NS( p_item->ppsz_list_text[i] ) action:NULL keyEquivalent: @""];
+ else if( p_item->ppsz_list[i] && p_item->ppsz_list[i] == "" )
+ {
+ [[object menu] addItem: [NSMenuItem separatorItem]];
+ continue;
+ }
+ else if( p_item->ppsz_list[i] )
+ mi = [[NSMenuItem alloc] initWithTitle: [NSString stringWithUTF8String: p_item->ppsz_list[i]] action:NULL keyEquivalent: @""];
+ else NSLog( @"item %d of pref %s failed to be created", i, name);
+ [mi setRepresentedObject:[NSString stringWithUTF8String: p_item->ppsz_list[i]]];
+ [[object menu] addItem: [mi autorelease]];
+ if( p_item->value.psz && !strcmp( p_item->value.psz, p_item->ppsz_list[i] ) )
+ [object selectItem:[object lastItem]];
+ }
+ [object setToolTip: _NS( p_item->psz_longtext )];
+}
+
+- (void)setupButton: (NSPopUpButton *)object forIntList: (const char *)name
+{
+ module_config_t *p_item;
+
+ [object removeAllItems];
+ p_item = config_FindConfig( VLC_OBJECT(p_intf), name );
+
+ /* serious problem, if no item found */
+ assert( p_item );
+
+ for( int i = 0; i < p_item->i_list; i++ )
+ {
+ NSMenuItem *mi;
+ if( p_item->ppsz_list_text != NULL)
+ mi = [[NSMenuItem alloc] initWithTitle: _NS( p_item->ppsz_list_text[i] ) action:NULL keyEquivalent: @""];
+ else if( p_item->pi_list[i] )
+ mi = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: @"%d", p_item->pi_list[i]] action:NULL keyEquivalent: @""];
+ else NSLog( @"item %d of pref %s failed to be created", i, name);
+ [mi setRepresentedObject:[NSNumber numberWithInt: p_item->pi_list[i]]];
+ [[object menu] addItem: [mi autorelease]];
+ if( p_item->value.i == p_item->pi_list[i] )
+ [object selectItem:[object lastItem]];
+ }
+ [object setToolTip: _NS( p_item->psz_longtext )];
+}
+
+- (void)setupButton: (NSPopUpButton *)object forModuleList: (const char *)name
+{
+ module_config_t *p_item;
+ module_t *p_parser, **p_list;
+ int y = 0;
+
+ [object removeAllItems];
+
+ p_item = config_FindConfig( VLC_OBJECT(p_intf), name );
+ p_list = module_list_get( NULL );
+ if( !p_item ||!p_list )
+ {
+ if( p_list ) vlc_list_release(p_list);
+ NSLog( @"serious problem, item or list not found" );
+ return;
+ }
+
+ [object addItemWithTitle: _NS("Default")];
+ for( size_t i_index = 0; p_list[i_index]; i_index++ )
+ {
+ 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]];
+ }
+ }
+ module_list_free( p_list );
+ [object setToolTip: _NS(p_item->psz_longtext)];
+}
+