]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/controls.m
macosx: Ignore attachment:// in Art uri for now.
[vlc] / modules / gui / macosx / controls.m
index 3d057efa48cfb9ef3d1713210458a5a7d565cda1..9166fbf570661bbcf793530929305015c9409962 100644 (file)
 {
     [[NSNotificationCenter defaultCenter] removeObserver: self];
     
+    [o_fs_panel release];
     [o_repeat_single release];
     [o_repeat_all release];
     [o_repeat_off release];
         if( !p_input ) return;
         
         c = [[openPanel filenames] count];
-        NSLog( @"count: %i", c );
-        for (int i = 0; [[openPanel filenames] count] > i ; i++)
+
+        for (int i = 0; i < [[openPanel filenames] count] ; i++)
         {
             msg_Dbg( VLCIntf, "loading subs from %s", [[[openPanel filenames] objectAtIndex: i] UTF8String] );
             if( input_AddSubtitle( p_input, [[[openPanel filenames] objectAtIndex: i] UTF8String], TRUE ) )
     [o_mi setTitle: [[VLCMain sharedInstance] localizedString: text.psz_string ?
                                         text.psz_string : psz_variable ]];
 
-    var_Get( p_object, psz_variable, &val );
     if( i_type & VLC_VAR_HASCHOICE )
     {
         NSMenu *o_menu = [o_mi submenu];
         free( text.psz_string );
         return;
     }
+    if( var_Get( p_object, psz_variable, &val ) < 0 )
+    {
+        return;
+    }
 
     VLCAutoGeneratedMenuContent *o_data;
     switch( i_type & VLC_VAR_TYPE )
         break;
 
     default:
-        free( text.psz_string );
-        return;
+        break;
     }
 
     if( ( i_type & VLC_VAR_TYPE ) == VLC_VAR_STRING ) free( val.psz_string );
 
     for( i = 0; i < val_list.p_list->i_count; i++ )
     {
-        vlc_value_t another_val;
         NSMenuItem * o_lmi;
         NSString *o_title = @"";
         VLCAutoGeneratedMenuContent *o_data;
         switch( i_type & VLC_VAR_TYPE )
         {
         case VLC_VAR_STRING:
-            another_val.psz_string =
-                strdup(val_list.p_list->p_values[i].psz_string);
 
             o_title = [[VLCMain sharedInstance] localizedString: text_list.p_list->p_values[i].psz_string ?
                 text_list.p_list->p_values[i].psz_string : val_list.p_list->p_values[i].psz_string ];
 
             o_lmi = [o_menu addItemWithTitle: o_title action: pf_callback keyEquivalent: @""];
             o_data = [[VLCAutoGeneratedMenuContent alloc] initWithVariableName: psz_variable ofObject: p_object
-                    andValue: another_val ofType: i_type];
+                    andValue: val_list.p_list->p_values[i] ofType: i_type];
             [o_lmi setRepresentedObject: [o_data autorelease]];
             [o_lmi setTarget: self];
 
         case VLC_VAR_INTEGER:
 
              o_title = text_list.p_list->p_values[i].psz_string ?
-                                 [[VLCMain sharedInstance] localizedString: strdup( text_list.p_list->p_values[i].psz_string )] :
+                                 [[VLCMain sharedInstance] localizedString: text_list.p_list->p_values[i].psz_string] :
                                  [NSString stringWithFormat: @"%d",
                                  val_list.p_list->p_values[i].i_int];
 
 
     if( self != nil )
     {
-        psz_name = strdup( name );
         _vlc_object = vlc_object_hold( object );
-        value = val;
+        psz_name = strdup( name );
         i_type = type;
+        value = val;
+        if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING )
+            value.psz_string = strdup( val.psz_string );
     }
 
     return( self );
 - (void)dealloc
 {
     vlc_object_release( _vlc_object );
+    if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING )
+        free( value.psz_string );
     free( psz_name );
     [super dealloc];
 }