Changeset 9b8c613da0c3fb5bd7078cf0b2869abbf6bfd4f8

Show
Ignore:
Timestamp:
19/11/07 15:06:52 (1 year ago)
Author:
Pierre d'Herbemont <pdherbemont@videolan.org>
git-committer:
Pierre d'Herbemont <pdherbemont@videolan.org> 1195481212 +0000
git-parent:

[3d958c183a2fdf505842c4508030cc9a45631468]

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

src/control: Implement flat_media_list_view construction.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/control/flat_media_list_view.c

    rd71d800 r9b8c613  
    4343 * Private functions 
    4444 */ 
    45 static void flat_media_list_view_release( libvlc_media_list_view_t * p_mlv ); 
    4645 
     46/************************************************************************** 
     47 *       ml_item_added  (private) (Callback from media_list_view item_added) 
     48 **************************************************************************/ 
     49static void 
     50ml_item_added( const libvlc_event_t * p_event, libvlc_media_list_view_t * p_mlv ) 
     51{ 
     52    libvlc_media_descriptor_t * p_md = p_event->u.media_list_item_added.item; 
     53    libvlc_media_descriptor_retain( p_md ); 
     54    vlc_array_append( &p_mlv->p_this_view_data->array, p_md ); 
     55} 
     56 
     57/************************************************************************** 
     58 *       ml_item_removed  (private) (Callback from media_list_view) 
     59 **************************************************************************/ 
     60static void 
     61ml_item_removed( const libvlc_event_t * p_event, libvlc_media_list_view_t * p_mlv ) 
     62{ 
     63    libvlc_media_descriptor_t * p_md = p_event->u.media_list_item_deleted.item; 
     64    int i = vlc_array_index_of_item( &p_mlv->p_this_view_data->array, p_md ); 
     65    if( i >= 0 ) 
     66    { 
     67        vlc_array_remove( &p_mlv->p_this_view_data->array, i ); 
     68        libvlc_media_descriptor_release( p_md ); 
     69    } 
     70} 
    4771 
    4872/************************************************************************** 
     
    121145                                        p_this_view_data, 
    122146                                        p_e ); 
     147    libvlc_media_list_view_set_ml_notification_callback( p_mlv, 
     148        ml_item_added, 
     149        ml_item_removed ); 
     150 
    123151    return p_mlv; 
    124152} 
  • src/control/libvlc_internal.h

    rd71d800 r9b8c613  
    305305VLC_EXPORT ( void, libvlc_media_list_view_set_ml_notification_callback, ( 
    306306                libvlc_media_list_view_t * p_mlv, 
    307                 void (*item_added)(const libvlc_event_t *, void *), 
    308                 void (*item_removed)(const libvlc_event_t *, void *) )); 
     307                void (*item_added)(const libvlc_event_t *, libvlc_media_list_view_t *), 
     308                void (*item_removed)(const libvlc_event_t *, libvlc_media_list_view_t *) )); 
    309309 
    310310/* Events */ 
  • src/control/media_list_view.c

    rd71d800 r9b8c613  
    5757                             media_list_item_removed, p_mlv, NULL ); 
    5858    } 
    59     if( p_mlv->pf_ml_item_added ) p_mlv->pf_ml_item_added( p_event, p_user_data ); 
     59    if( p_mlv->pf_ml_item_added ) p_mlv->pf_ml_item_added( p_event, p_mlv ); 
    6060} 
    6161 
     
    7575                             media_list_item_removed, p_mlv, NULL ); 
    7676    } 
    77     if( p_mlv->pf_ml_item_removed ) p_mlv->pf_ml_item_removed( p_event, p_user_data ); 
     77    if( p_mlv->pf_ml_item_removed ) p_mlv->pf_ml_item_removed( p_event, p_mlv ); 
    7878} 
    7979 
     
    8585libvlc_media_list_view_set_ml_notification_callback( 
    8686                libvlc_media_list_view_t * p_mlv, 
    87                 void (*item_added)(const libvlc_event_t *, void *), 
    88                 void (*item_removed)(const libvlc_event_t *, void *) ) 
     87                void (*item_added)(const libvlc_event_t *, libvlc_media_list_view_t *), 
     88                void (*item_removed)(const libvlc_event_t *, libvlc_media_list_view_t *) ) 
    8989{ 
    9090    p_mlv->pf_ml_item_added = item_added;