+ else
+ {
+ playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
+ FIND_ANYWHERE );
+
+ if( p_playlist && ( [o_title isEqualToString: _NS("Fullscreen")] ||
+ [sender isKindOfClass:[NSButton class]] ) )
+ {
+ vlc_value_t val;
+ var_Get( p_playlist, "fullscreen", &val );
+ var_Set( p_playlist, "fullscreen", (vlc_value_t)!val.b_bool );
+ }
+ if( p_playlist ) vlc_object_release( (vlc_object_t *)p_playlist );
+ }
+
+}
+
+- (void)setupVarMenuItem:(NSMenuItem *)o_mi
+ target:(vlc_object_t *)p_object
+ var:(const char *)psz_variable
+ selector:(SEL)pf_callback
+{
+ vlc_value_t val, text;
+ int i_type = var_Type( p_object, psz_variable );
+
+ switch( i_type & VLC_VAR_TYPE )
+ {
+ case VLC_VAR_VOID:
+ case VLC_VAR_BOOL:
+ case VLC_VAR_VARIABLE:
+ case VLC_VAR_STRING:
+ case VLC_VAR_INTEGER:
+ break;
+ default:
+ /* Variable doesn't exist or isn't handled */
+ return;
+ }
+
+ /* Make sure we want to display the variable */
+ if( i_type & VLC_VAR_HASCHOICE )
+ {
+ var_Change( p_object, psz_variable, VLC_VAR_CHOICESCOUNT, &val, NULL );
+ if( val.i_int == 0 ) return;
+ if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 )
+ return;
+ }
+
+ /* Get the descriptive name of the variable */
+ var_Change( p_object, psz_variable, VLC_VAR_GETTEXT, &text, NULL );
+ [o_mi setTitle: [[VLCMain sharedInstance] localizedString: text.psz_string ?
+ text.psz_string : strdup( psz_variable ) ]];
+
+ var_Get( p_object, psz_variable, &val );
+ if( i_type & VLC_VAR_HASCHOICE )
+ {
+ NSMenu *o_menu = [o_mi submenu];
+
+ [self setupVarMenu: o_menu forMenuItem: o_mi target:p_object
+ var:psz_variable selector:pf_callback];
+
+ if( text.psz_string ) free( text.psz_string );
+ return;
+ }
+
+ VLCMenuExt *o_data;
+ switch( i_type & VLC_VAR_TYPE )
+ {
+ case VLC_VAR_VOID:
+ o_data = [[VLCMenuExt alloc] initWithVar: psz_variable Object: p_object->i_object_id
+ Value: val ofType: i_type];
+ [o_mi setRepresentedObject: [NSValue valueWithPointer:[o_data retain]]];
+ break;
+
+ case VLC_VAR_BOOL:
+ o_data = [[VLCMenuExt alloc] initWithVar: psz_variable Object: p_object->i_object_id
+ Value: val ofType: i_type];
+ [o_mi setRepresentedObject: [NSValue valueWithPointer:[o_data retain]]];
+ if( !( i_type & VLC_VAR_ISCOMMAND ) )
+ [o_mi setState: val.b_bool ? TRUE : FALSE ];
+ break;
+
+ default:
+ if( text.psz_string ) free( text.psz_string );
+ return;
+ }
+
+ if( ( i_type & VLC_VAR_TYPE ) == VLC_VAR_STRING ) free( val.psz_string );
+ if( text.psz_string ) free( text.psz_string );