Changeset 1334901b0bc60f735f2d677242400f7c1c62bb37

Show
Ignore:
Timestamp:
21/12/07 15:31:00 (1 year ago)
Author:
Pierre d'Herbemont <pdherbemont@videolan.org>
git-committer:
Pierre d'Herbemont <pdherbemont@videolan.org> 1198247460 +0000
git-parent:

[2ea15499285e7022db965319b587c129e5e9ad05]

git-author:
Pierre d'Herbemont <pdherbemont@videolan.org> 1198247460 +0000
Message:

MacOSX/Framework/VLCMediaList.m: Implement -description: and fix -flatAspect and -hierarchicalAspect when used with bindings.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • extras/MacOSX/Framework/Headers/Public/VLCMediaList.h

    r40e325a r1334901  
    4545    id <VLCMediaListDelegate,NSObject> delegate;                //< Delegate object 
    4646    NSMutableArray *cachedMedia; /* We need that private copy because of Cocoa Bindings, that need to be working on first thread */ 
     47    VLCMediaListAspect * flatAspect; 
     48    VLCMediaListAspect * hierarchicalAspect; 
    4749} 
    4850 
  • extras/MacOSX/Framework/Sources/VLCMediaList.m

    r73afb6b r1334901  
    9494        // Initialize internals to defaults 
    9595        cachedMedia = [[NSMutableArray alloc] init]; 
    96         delegate = nil; 
     96        delegate = flatAspect = hierarchicalAspect = nil; 
    9797        [self initInternalMediaList]; 
    9898    } 
     
    122122    libvlc_media_list_release(p_mlist); 
    123123    [cachedMedia release]; 
     124    [flatAspect release]; 
     125    [hierarchicalAspect release]; 
    124126    [super dealloc]; 
     127} 
     128 
     129- (NSString *)description 
     130{ 
     131    NSMutableString *content = [NSMutableString string]; 
     132    int i; 
     133    [self lock]; 
     134    for( i = 0; i < [self count]; i++) 
     135    { 
     136        [content appendFormat:@"%@\n", [self mediaAtIndex: i]]; 
     137    } 
     138    [self unlock]; 
     139    return [NSString stringWithFormat:@"<%@ %p> {\n%@}", [self className], self, content]; 
    125140} 
    126141 
     
    197212- (VLCMediaListAspect *)hierarchicalAspect 
    198213{ 
    199     VLCMediaListAspect * hierarchicalAspect; 
     214    if( hierarchicalAspect ) 
     215        return hierarchicalAspect; 
    200216    libvlc_media_list_view_t * p_mlv = libvlc_media_list_hierarchical_view( p_mlist, NULL ); 
    201     hierarchicalAspect = [VLCMediaListAspect mediaListAspectWithLibVLCMediaListView: p_mlv]; 
     217    hierarchicalAspect = [[VLCMediaListAspect mediaListAspectWithLibVLCMediaListView: p_mlv] retain]; 
    202218    libvlc_media_list_view_release( p_mlv ); 
    203219    return hierarchicalAspect; 
     
    206222- (VLCMediaListAspect *)flatAspect 
    207223{ 
    208     VLCMediaListAspect * flatAspect; 
     224    if( flatAspect ) 
     225        return flatAspect; 
    209226    libvlc_media_list_view_t * p_mlv = libvlc_media_list_flat_view( p_mlist, NULL ); 
    210     flatAspect = [VLCMediaListAspect mediaListAspectWithLibVLCMediaListView: p_mlv]; 
     227    flatAspect = [[VLCMediaListAspect mediaListAspectWithLibVLCMediaListView: p_mlv] retain]; 
    211228    libvlc_media_list_view_release( p_mlv ); 
    212229    return flatAspect;