1 /*****************************************************************************
2 * prefs.m: MacOS X plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2002-2003 VideoLAN
5 * $Id: prefs.m,v 1.30 2003/05/26 14:59:37 hartman Exp $
7 * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8 * Derk-Jan Hartman <thedj at users.sf.net>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
28 #include <stdlib.h> /* malloc(), free() */
29 #include <sys/param.h> /* for MAXPATHLEN */
35 /*****************************************************************************
36 * VLCPrefs implementation
37 *****************************************************************************/
38 @implementation VLCPrefs
46 o_empty_view = [[NSView alloc] init];
54 [o_empty_view release];
60 p_intf = [NSApp getIntf];
61 b_advanced = config_GetInt( p_intf, "advanced" );
64 [o_advanced_ckb setState: b_advanced];
65 [o_prefs_view setBorderType: NSGrooveBorder];
66 [o_prefs_view setHasVerticalScroller: YES];
67 [o_prefs_view setDrawsBackground: NO];
68 [o_prefs_view setRulersVisible: YES];
69 [o_prefs_view setDocumentView: o_empty_view];
70 [o_tree selectRow:0 byExtendingSelection:NO];
75 [o_prefs_window setTitle: _NS("Preferences")];
76 [o_save_btn setTitle: _NS("Save")];
77 [o_cancel_btn setTitle: _NS("Cancel")];
78 [o_reset_btn setTitle: _NS("Reset All")];
79 [o_advanced_ckb setTitle: _NS("Advanced")];
84 [o_prefs_window center];
85 [o_prefs_window makeKeyAndOrderFront:self];
88 - (IBAction)savePrefs: (id)sender
90 config_SaveConfigFile( p_intf, NULL );
91 [o_prefs_window orderOut:self];
94 - (IBAction)closePrefs: (id)sender
96 [o_prefs_window orderOut:self];
99 - (IBAction)resetAll: (id)sender
101 config_ResetAll( p_intf );
104 - (IBAction)advancedToggle: (id)sender
106 b_advanced = !b_advanced;
107 [o_advanced_ckb setState: b_advanced];
108 [self showViewForID: [[o_tree itemAtRow:[o_tree selectedRow]] getObjectID]
109 andName: [[o_tree itemAtRow:[o_tree selectedRow]] getName]];
112 - (void)loadConfigTree
117 - (void)outlineViewSelectionIsChanging:(NSNotification *)o_notification
121 - (void)outlineViewSelectionDidChange:(NSNotification *)o_notification
123 [self showViewForID: [[o_tree itemAtRow:[o_tree selectedRow]] getObjectID]
124 andName: [[o_tree itemAtRow:[o_tree selectedRow]] getName]];
127 - (void)configChanged:(id)o_unknown
129 id o_vlc_config = [o_unknown isKindOfClass: [NSNotification class]] ?
130 [o_unknown object] : o_unknown;
132 int i_type = [o_vlc_config configType];
133 NSString *o_name = [o_vlc_config configName];
134 char *psz_name = (char *)[o_name UTF8String];
139 case CONFIG_ITEM_MODULE:
142 module_t *p_a_module;
143 int i_id = [[o_vlc_config selectedItem] tag];
145 p_a_module = (module_t *)vlc_object_get( p_intf, i_id );
146 if( p_a_module == NULL || p_a_module->i_object_type != VLC_OBJECT_MODULE )
151 psz_value = ( i_id == -1 ) ? "" : p_a_module->psz_object_name ;
152 config_PutPsz( p_intf, psz_name, strdup(psz_value) );
156 case CONFIG_ITEM_STRING:
157 case CONFIG_ITEM_FILE:
158 case CONFIG_ITEM_DIRECTORY:
163 o_value = [o_vlc_config stringValue];
164 psz_value = (char *)[o_value UTF8String];
166 config_PutPsz( p_intf, psz_name, psz_value );
170 case CONFIG_ITEM_INTEGER:
171 case CONFIG_ITEM_BOOL:
173 int i_value = [o_vlc_config intValue];
175 config_PutInt( p_intf, psz_name, i_value );
179 case CONFIG_ITEM_FLOAT:
181 float f_value = [o_vlc_config floatValue];
183 config_PutFloat( p_intf, psz_name, f_value );
190 - (void)showViewForID: (int)i_id andName: (NSString *)o_item_name
194 module_config_t *p_item;
196 int i_pos, i_module_tag, i_index;
198 NSString *o_module_name;
199 NSRect s_rc; /* rect */
200 NSView *o_view; /* view */
201 NSRect s_vrc; /* view rect */
202 VLCTextField *o_text_field; /* input field / label */
204 p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
206 /* Get a pointer to the module */
207 p_parser = (module_t *)vlc_object_get( p_intf, i_id );
208 if( p_parser->i_object_type != VLC_OBJECT_MODULE )
210 /* 0OOoo something went really bad */
214 /* Enumerate config options and add corresponding config boxes */
215 o_module_name = [NSString stringWithUTF8String: p_parser->psz_object_name];
216 p_item = p_parser->p_config;
223 #define Y_ORIGIN (X_ORIGIN - 10)
225 #define CHECK_VIEW_HEIGHT \
227 float f_new_pos = s_rc.origin.y + s_rc.size.height + X_ORIGIN; \
228 if( f_new_pos > s_vrc.size.height ) \
230 s_vrc.size.height = f_new_pos; \
231 [o_view setFrame: s_vrc]; \
235 #define CONTROL_LABEL( label ) \
237 s_rc.origin.x += s_rc.size.width + 10; \
238 s_rc.size.width = s_vrc.size.width - s_rc.origin.x - X_ORIGIN - 20; \
239 o_text_field = [[NSTextField alloc] initWithFrame: s_rc]; \
240 [o_text_field setDrawsBackground: NO]; \
241 [o_text_field setBordered: NO]; \
242 [o_text_field setEditable: NO]; \
243 [o_text_field setSelectable: NO]; \
246 [o_text_field setStringValue: \
247 [NSApp localizedString: label]]; \
249 [o_text_field sizeToFit]; \
250 [o_view addSubview: [o_text_field autorelease]]; \
253 #define INPUT_FIELD( ctype, cname, label, w, msg, param, tip ) \
255 char * psz_duptip = NULL; \
256 if ( p_item->psz_longtext != NULL ) \
257 psz_duptip = strdup( p_item->psz_longtext ); \
258 s_rc.size.height = 25; \
259 s_rc.size.width = w; \
260 s_rc.origin.y += 10; \
262 o_text_field = [[VLCTextField alloc] initWithFrame: s_rc]; \
263 [o_text_field setAlignment: NSRightTextAlignment]; \
264 CONTROL_CONFIG( o_text_field, o_module_name, ctype, cname ); \
265 [o_text_field msg: param]; \
266 if ( psz_duptip != NULL ) \
268 [o_text_field setToolTip: [NSApp wrapString: [NSApp localizedString: \
269 psz_duptip] toWidth: PREFS_WRAP ]]; \
272 [o_view addSubview: [o_text_field autorelease]]; \
273 [[NSNotificationCenter defaultCenter] addObserver: self \
274 selector: @selector(configChanged:) \
275 name: NSControlTextDidChangeNotification \
276 object: o_text_field]; \
277 CONTROL_LABEL( label ); \
278 s_rc.origin.y += s_rc.size.height; \
279 s_rc.origin.x = X_ORIGIN; \
282 #define INPUT_FIELD_INTEGER( name, label, w, param, tip ) \
283 INPUT_FIELD( CONFIG_ITEM_INTEGER, name, label, w, setIntValue, param, tip )
284 #define INPUT_FIELD_FLOAT( name, label, w, param, tip ) \
285 INPUT_FIELD( CONFIG_ITEM_FLOAT, name, label, w, setFloatValue, param, tip )
286 #define INPUT_FIELD_STRING( name, label, w, param, tip ) \
287 INPUT_FIELD( CONFIG_ITEM_STRING, name, label, w, setStringValue, param, tip )
290 s_vrc = [[o_prefs_view contentView] bounds]; s_vrc.size.height -= 4;
291 o_view = [[VLCFlippedView alloc] initWithFrame: s_vrc];
292 s_rc.origin.x = X_ORIGIN;
293 s_rc.origin.y = Y_ORIGIN;
294 BOOL b_right_cat = FALSE;
298 if( p_item->i_type == CONFIG_HINT_CATEGORY )
300 if( !strcmp( p_parser->psz_object_name, "main" ) &&
301 [o_item_name isEqualToString: [NSApp localizedString: p_item->psz_text]] )
304 } else if( strcmp( p_parser->psz_object_name, "main" ) )
307 } else b_right_cat = FALSE;
308 } else if( p_item->i_type == CONFIG_HINT_END && !strcmp( p_parser->psz_object_name, "main" ) )
313 if( (p_item->b_advanced && !b_advanced ) || !b_right_cat )
317 switch( p_item->i_type )
319 case CONFIG_ITEM_MODULE:
321 VLCPopUpButton *o_modules;
322 module_t *p_a_module;
323 char * psz_duptip = NULL;
325 if ( p_item->psz_longtext != NULL )
326 psz_duptip = strdup( p_item->psz_longtext );
328 s_rc.size.height = 30;
329 s_rc.size.width = 200;
334 o_modules = [[VLCPopUpButton alloc] initWithFrame: s_rc];
335 CONTROL_CONFIG( o_modules, o_module_name,
336 CONFIG_ITEM_MODULE, p_item->psz_name );
337 [o_modules setTarget: self];
338 [o_modules setAction: @selector(configChanged:)];
339 [o_modules sendActionOn:NSLeftMouseUpMask];
341 if ( psz_duptip != NULL )
343 [o_modules setToolTip: [NSApp wrapString: [NSApp localizedString: psz_duptip] toWidth: PREFS_WRAP]];
346 [o_view addSubview: [o_modules autorelease]];
348 [o_modules addItemWithTitle: _NS("None")];
349 [[o_modules lastItem] setTag: -1];
350 [o_modules selectItem: [o_modules lastItem]];
352 /* build a list of available modules */
354 for( i_index = 0; i_index < p_list->i_count; i_index++ )
356 p_a_module = (module_t *)p_list->p_values[i_index].p_object ;
358 if( !strcmp( p_a_module->psz_capability,
361 NSString *o_description = [NSApp
362 localizedString: p_a_module->psz_longname];
363 [o_modules addItemWithTitle: o_description];
364 [[o_modules lastItem] setTag: p_a_module->i_object_id];
366 if( p_item->psz_value &&
367 !strcmp( p_item->psz_value, p_a_module->psz_object_name ) )
369 [o_modules selectItem:[o_modules lastItem]];
375 CONTROL_LABEL( p_item->psz_text );
376 s_rc.origin.y += s_rc.size.height;
377 s_rc.origin.x = X_ORIGIN;
381 case CONFIG_ITEM_STRING:
382 case CONFIG_ITEM_FILE:
383 case CONFIG_ITEM_DIRECTORY:
386 if( !p_item->ppsz_list )
388 char *psz_value = p_item->psz_value ?
389 p_item->psz_value : "";
391 INPUT_FIELD_STRING( p_item->psz_name, p_item->psz_text, 200,
392 [NSApp localizedString: psz_value],
393 p_item->psz_longtext );
398 VLCComboBox *o_combo_box;
399 char * psz_duptip = NULL;
400 if ( p_item->psz_longtext != NULL )
401 psz_duptip = strdup( p_item->psz_longtext );
403 s_rc.size.height = 27;
404 s_rc.size.width = 200;
409 o_combo_box = [[VLCComboBox alloc] initWithFrame: s_rc];
410 CONTROL_CONFIG( o_combo_box, o_module_name,
411 CONFIG_ITEM_STRING, p_item->psz_name );
412 [o_combo_box setTarget: self];
413 [o_combo_box setAction: @selector(configChanged:)];
414 [o_combo_box sendActionOn:NSLeftMouseUpMask];
416 if ( psz_duptip != NULL )
418 [o_combo_box setToolTip: [NSApp wrapString: [NSApp localizedString: psz_duptip] toWidth: PREFS_WRAP]];
421 [o_view addSubview: [o_combo_box autorelease]];
423 for( i=0; p_item->ppsz_list[i]; i++ )
425 [o_combo_box addItemWithObjectValue:
426 [NSApp localizedString: p_item->ppsz_list[i]]];
428 [o_combo_box setStringValue: [NSApp localizedString:
429 p_item->psz_value ? p_item->psz_value : ""]];
431 CONTROL_LABEL( p_item->psz_text );
433 s_rc.origin.y += s_rc.size.height;
434 s_rc.origin.x = X_ORIGIN;
440 case CONFIG_ITEM_INTEGER:
442 if( p_item->i_min == p_item->i_max )
444 INPUT_FIELD_INTEGER( p_item->psz_name, p_item->psz_text, 70,
445 p_item->i_value, p_item->psz_longtext );
451 char * psz_duptip = NULL;
452 if ( p_item->psz_longtext != NULL )
453 psz_duptip = strdup( p_item->psz_longtext );
455 s_rc.size.height = 27;
456 s_rc.size.width = 200;
461 o_slider = [[VLCSlider alloc] initWithFrame: s_rc];
462 [o_slider setMinValue: p_item->i_min];
463 [o_slider setMaxValue: p_item->i_max];
464 [o_slider setIntValue: p_item->i_value];
466 if ( psz_duptip != NULL )
468 [o_slider setToolTip: [NSApp wrapString: [NSApp localizedString: psz_duptip] toWidth: PREFS_WRAP]];
471 [o_slider setTarget: self];
472 [o_slider setAction: @selector(configChanged:)];
473 [o_slider sendActionOn:NSLeftMouseUpMask];
474 CONTROL_CONFIG( o_slider, o_module_name,
475 CONFIG_ITEM_INTEGER, p_item->psz_name );
476 [o_view addSubview: [o_slider autorelease]];
477 CONTROL_LABEL( p_item->psz_text );
479 s_rc.origin.y += s_rc.size.height;
480 s_rc.origin.x = X_ORIGIN;
485 case CONFIG_ITEM_FLOAT:
487 if( p_item->f_min == p_item->f_max )
489 INPUT_FIELD_FLOAT( p_item->psz_name, p_item->psz_text, 70,
490 p_item->f_value, p_item->psz_longtext );
494 /* create a slider */
496 char * psz_duptip = NULL;
497 if ( p_item->psz_longtext != NULL )
498 psz_duptip = strdup( p_item->psz_longtext );
500 s_rc.size.height = 27;
501 s_rc.size.width = 200;
506 o_slider = [[VLCSlider alloc] initWithFrame: s_rc];
507 [o_slider setMinValue: p_item->f_min];
508 [o_slider setMaxValue: p_item->f_max];
509 [o_slider setFloatValue: p_item->f_value];
511 if ( psz_duptip != NULL )
513 [o_slider setToolTip: [NSApp wrapString: [NSApp localizedString: psz_duptip] toWidth: PREFS_WRAP]];
516 [o_slider setTarget: self];
517 [o_slider setAction: @selector(configChanged:)];
518 [o_slider sendActionOn:NSLeftMouseUpMask];
519 CONTROL_CONFIG( o_slider, o_module_name,
520 CONFIG_ITEM_FLOAT, p_item->psz_name );
521 [o_view addSubview: [o_slider autorelease]];
522 CONTROL_LABEL( p_item->psz_text );
524 s_rc.origin.y += s_rc.size.height;
525 s_rc.origin.x = X_ORIGIN;
530 case CONFIG_ITEM_BOOL:
532 VLCButton *o_btn_bool;
533 char * psz_duptip = NULL;
535 if ( p_item->psz_longtext != NULL )
536 psz_duptip = strdup( p_item->psz_longtext );
538 s_rc.size.height = 27;
539 s_rc.size.width = s_vrc.size.width - X_ORIGIN * 2 - 20;
544 o_btn_bool = [[VLCButton alloc] initWithFrame: s_rc];
545 [o_btn_bool setButtonType: NSSwitchButton];
546 [o_btn_bool setIntValue: p_item->i_value];
547 [o_btn_bool setTitle: [NSApp localizedString: p_item->psz_text]];
548 if ( psz_duptip != NULL )
550 [o_btn_bool setToolTip: [NSApp wrapString: [NSApp localizedString: psz_duptip] toWidth: PREFS_WRAP]];
553 [o_btn_bool setTarget: self];
554 [o_btn_bool setAction: @selector(configChanged:)];
555 CONTROL_CONFIG( o_btn_bool, o_module_name,
556 CONFIG_ITEM_BOOL, p_item->psz_name );
557 [o_view addSubview: [o_btn_bool autorelease]];
559 s_rc.origin.y += s_rc.size.height;
565 #undef INPUT_FIELD_INTEGER
566 #undef INPUT_FIELD_FLOAT
567 #undef INPUT_FIELD_STRING
569 #undef CHECK_VIEW_HEIGHT
574 while( p_item->i_type != CONFIG_HINT_END && p_item++ );
575 vlc_list_release( p_list );
577 [o_prefs_view setDocumentView: o_view];
578 [o_prefs_view setNeedsDisplay: TRUE];
584 @implementation VLCPrefs (NSTableDataSource)
586 - (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item {
587 return (item == nil) ? [[VLCTreeItem rootItem] numberOfChildren] : [item numberOfChildren];
590 - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item {
591 return (item == nil) ? YES : ([item numberOfChildren] != -1);
594 - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item {
595 return (item == nil) ? [[VLCTreeItem rootItem] childAtIndex:index] : [item childAtIndex:index];
598 - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item {
599 return (item == nil) ? @"" : (id)[item getName];
604 @implementation VLCTreeItem
606 static VLCTreeItem *o_root_item = nil;
608 #define IsALeafNode ((id)-1)
610 - (id)initWithName: (NSString *)o_item_name ID: (int)i_id parent:(VLCTreeItem *)o_parent_item
616 o_name = [o_item_name copy];
618 o_parent = o_parent_item;
623 + (VLCTreeItem *)rootItem {
624 if (o_root_item == nil) o_root_item = [[VLCTreeItem alloc] initWithName:@"main" ID: 0 parent:nil];
630 if (o_children != IsALeafNode) [o_children release];
635 /* Creates and returns the array of children
636 * Loads children incrementally */
637 - (NSArray *)children {
638 if (o_children == NULL) {
639 intf_thread_t *p_intf = [NSApp getIntf];
641 module_t *p_module = NULL;
642 module_config_t *p_item;
645 /* List the plugins */
646 p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
647 if( !p_list ) return nil;
649 if( [[self getName] isEqualToString: @"main"] )
652 * Build a tree of the main options
654 for( i_index = 0; i_index < p_list->i_count; i_index++ )
656 p_module = (module_t *)p_list->p_values[i_index].p_object;
657 if( !strcmp( p_module->psz_object_name, "main" ) )
660 if( p_module == NULL )
662 msg_Err( p_intf, "Could not find the main module in our prefs" );
665 if( i_index < p_list->i_count )
667 /* We found the main module */
669 /* Enumerate config categories and store a reference so we can
670 * generate their config panel them when it is asked by the user. */
671 p_item = p_module->p_config;
672 o_children = [[NSMutableArray alloc] initWithCapacity:10];
676 NSString *o_child_name;
678 switch( p_item->i_type )
680 case CONFIG_HINT_CATEGORY:
681 o_child_name = [NSApp localizedString: p_item->psz_text];
682 [o_children addObject:[[VLCTreeItem alloc] initWithName: o_child_name
683 ID: p_module->i_object_id parent:self]];
687 while( p_item->i_type != CONFIG_HINT_END && p_item++ );
689 /* Add the plugins item */
690 [o_children addObject:[[VLCTreeItem alloc] initWithName: _NS("Modules")
695 o_children = IsALeafNode;
698 else if( [[self getName] isEqualToString: _NS("Modules")] )
700 /* Add the capabilities */
701 o_children = [[NSMutableArray alloc] initWithCapacity:10];
702 for( i_index = 0; i_index < p_list->i_count; i_index++ )
704 p_module = (module_t *)p_list->p_values[i_index].p_object;
706 /* Exclude the main module */
707 if( !strcmp( p_module->psz_object_name, "main" ) )
710 /* Exclude empty plugins */
711 p_item = p_module->p_config;
712 if( !p_item ) continue;
715 if( p_item->i_type & CONFIG_ITEM )
718 while( p_item->i_type != CONFIG_HINT_END && p_item++ );
719 if( p_item->i_type == CONFIG_HINT_END ) continue;
721 /* Create the capability tree if it doesn't already exist */
722 NSString *o_capability;
723 o_capability = [NSApp localizedString: p_module->psz_capability];
724 if( !p_module->psz_capability || !*p_module->psz_capability )
726 /* Empty capability ? Let's look at the submodules */
727 module_t * p_submodule;
728 for( j = 0; j < p_module->i_children; j++ )
730 p_submodule = (module_t*)p_module->pp_children[ j ];
731 if( p_submodule->psz_capability && *p_submodule->psz_capability )
733 o_capability = [NSApp localizedString: p_submodule->psz_capability];
734 BOOL b_found = FALSE;
735 for( j = 0; j < [o_children count]; j++ )
737 if( [[[o_children objectAtIndex:j] getName] isEqualToString: o_capability] )
745 [o_children addObject:[[VLCTreeItem alloc] initWithName: o_capability
752 BOOL b_found = FALSE;
753 for( j = 0; j < [o_children count]; j++ )
755 if( [[[o_children objectAtIndex:j] getName] isEqualToString: o_capability] )
763 [o_children addObject:[[VLCTreeItem alloc] initWithName: o_capability
768 else if( [[o_parent getName] isEqualToString: _NS("Modules")] )
770 /* Now add the modules */
771 o_children = [[NSMutableArray alloc] initWithCapacity:10];
772 for( i_index = 0; i_index < p_list->i_count; i_index++ )
774 p_module = (module_t *)p_list->p_values[i_index].p_object;
776 /* Exclude the main module */
777 if( !strcmp( p_module->psz_object_name, "main" ) )
780 /* Exclude empty plugins */
781 p_item = p_module->p_config;
782 if( !p_item ) continue;
785 if( p_item->i_type & CONFIG_ITEM )
788 while( p_item->i_type != CONFIG_HINT_END && p_item++ );
789 if( p_item->i_type == CONFIG_HINT_END ) continue;
791 /* Check the capability */
792 NSString *o_capability;
793 o_capability = [NSApp localizedString: p_module->psz_capability];
794 if( !p_module->psz_capability || !*p_module->psz_capability )
796 /* Empty capability ? Let's look at the submodules */
797 module_t * p_submodule;
798 for( j = 0; j < p_module->i_children; j++ )
800 p_submodule = (module_t*)p_module->pp_children[ j ];
801 if( p_submodule->psz_capability && *p_submodule->psz_capability )
803 o_capability = [NSApp localizedString: p_submodule->psz_capability];
804 if( [o_capability isEqualToString: [self getName]] )
806 [o_children addObject:[[VLCTreeItem alloc] initWithName:
807 [NSApp localizedString: p_module->psz_object_name ]
808 ID: p_module->i_object_id parent:self]];
813 else if( [o_capability isEqualToString: [self getName]] )
815 [o_children addObject:[[VLCTreeItem alloc] initWithName:
816 [NSApp localizedString: p_module->psz_object_name ]
817 ID: p_module->i_object_id parent:self]];
823 /* all the other stuff are leafs */
824 o_children = IsALeafNode;
835 - (NSString *)getName
840 - (VLCTreeItem *)childAtIndex:(int)i_index {
841 return [[self children] objectAtIndex:i_index];
844 - (int)numberOfChildren {
845 id i_tmp = [self children];
846 return (i_tmp == IsALeafNode) ? (-1) : [i_tmp count];
849 - (BOOL)hasPrefs:(NSString *)o_module_name
851 intf_thread_t *p_intf = [NSApp getIntf];
854 char *psz_module_name;
857 psz_module_name = (char *)[o_module_name UTF8String];
859 /* look for module */
860 p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
862 for( i_index = 0; i_index < p_list->i_count; i_index++ )
864 p_parser = (module_t *)p_list->p_values[i_index].p_object ;
866 if( !strcmp( p_parser->psz_object_name, psz_module_name ) )
868 BOOL b_has_prefs = p_parser->i_config_items != 0;
869 vlc_list_release( p_list );
870 return( b_has_prefs );
874 vlc_list_release( p_list );
882 @implementation VLCFlippedView
891 IMPL_CONTROL_CONFIG(Button);
892 IMPL_CONTROL_CONFIG(PopUpButton);
893 IMPL_CONTROL_CONFIG(ComboBox);
894 IMPL_CONTROL_CONFIG(TextField);
895 IMPL_CONTROL_CONFIG(Slider);