Changeset 107b78a957c386f36923338a7273ea4fd82f631a

Show
Ignore:
Timestamp:
12/22/07 13:41:56 (9 months ago)
Author:
Rémi Duraffort <ivoire@videolan.org>
git-committer:
Rémi Duraffort <ivoire@videolan.org> 1198327316 +0000
git-parent:

[8442f8adddbb55bd66a9155512fef5c0ab70ad4c]

git-author:
Rémi Duraffort <ivoire@videolan.org> 1198327316 +0000
Message:

use a pointer to a function instead of a callback

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_update.h

    rc2598291 r107b78a  
    281281VLC_EXPORT( update_t *, __update_New, ( vlc_object_t * ) ); 
    282282VLC_EXPORT( void, update_Delete, ( update_t * ) ); 
    283 VLC_EXPORT( void, update_Check, ( update_t * ) ); 
     283VLC_EXPORT( void, update_Check, ( update_t *, void (*callback)( void* ), void * ) ); 
    284284VLC_EXPORT( int, update_CompareReleaseToCurrent, ( update_t * ) ); 
    285285VLC_EXPORT( void, update_Download, ( update_t *, char* ) ); 
  • modules/gui/qt4/dialogs/help.cpp

    rf5a08fa r107b78a  
    180180 *****************************************************************************/ 
    181181/* callback to get information from the core */ 
    182 static int updateCallback( vlc_object_t *p_this, char const *psz_cmd, 
    183                            vlc_value_t oldval, vlc_value_t newval, void *data ) 
     182static void UpdateCallback( void *data ) 
    184183{ 
    185184    UpdateDialog* UDialog = (UpdateDialog *)data; 
    186185    QEvent *event = new QEvent( QEvent::User ); 
    187186    QApplication::postEvent( UDialog, event ); 
    188     return VLC_SUCCESS; 
    189187} 
    190188 
     
    216214    /* create the update structure and the callback */ 
    217215    p_update = update_New( _p_intf ); 
    218     var_AddCallback( _p_intf->p_libvlc, "update-notify", updateCallback, this ); 
    219216    b_checked = false; 
    220217} 
     
    222219UpdateDialog::~UpdateDialog() 
    223220{ 
    224     var_DelCallback( p_update->p_libvlc, "update-notify", updateCallback, this ); 
    225221    update_Delete( p_update ); 
    226222} 
     
    237233    { 
    238234        updateButton->setEnabled( false ); 
    239         update_Check( p_update ); 
     235        update_Check( p_update, UpdateCallback, this ); 
    240236    } 
    241237    else 
  • modules/gui/wxwidgets/dialogs/updatevlc.cpp

    r48c2ac8 r107b78a  
    101101void UpdateVLC::OnCheckForUpdate( wxCommandEvent& event ) 
    102102{ 
    103     update_Check( p_update ); 
     103    update_Check( p_update, NULL, this ); 
    104104    wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL ); 
    105105 
  • src/libvlc-common.c

    r12c3968 r107b78a  
    884884    /* Create volume callback system. */ 
    885885    var_Create( p_libvlc, "volume-change", VLC_VAR_BOOL ); 
    886  
    887     /* Notify interfaces that a new VLC version is available */ 
    888 #ifdef UPDATE_CHECK 
    889     var_Create( p_libvlc, "update-notify", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND ); 
    890 #endif 
    891886 
    892887    /* 
  • src/misc/update.c

    r12c3968 r107b78a  
    884884    VLC_COMMON_MEMBERS 
    885885    update_t *p_update; 
     886    void (*pf_callback)( void * ); 
     887    void *p_data; 
    886888} update_check_thread_t; 
    887889 
     
    892894 * 
    893895 * \param p_update pointer to update struct 
     896 * \param pf_callback pointer to a function to call when the update_check is finished 
     897 * \param p_data pointer to some datas to give to the callback 
    894898 * \returns nothing 
    895899 */ 
    896 void update_Check( update_t *p_update
     900void update_Check( update_t *p_update, void (*pf_callback)( void* ), void *p_data
    897901{ 
    898902    assert( p_update ); 
     
    901905                                            sizeof( update_check_thread_t ) ); 
    902906    p_uct->p_update = p_update; 
     907    p_uct->pf_callback = pf_callback; 
     908    p_uct->p_data = p_data; 
    903909 
    904910    vlc_thread_create( p_uct, "check for update", update_CheckReal, 
     
    915921    vlc_mutex_unlock( &p_uct->p_update->lock ); 
    916922 
    917     var_TriggerCallback( p_uct->p_libvlc, "update-notify" ); 
     923    if( p_uct->pf_callback ) 
     924        (p_uct->pf_callback)( p_uct->p_data ); 
    918925} 
    919926 
     
    10361043 
    10371044    /* Open the stream */ 
    1038     p_stream = stream_UrlNew( p_update->p_libvlc, p_update->release.psz_url ); 
     1045    p_stream = stream_UrlNew( p_udt, p_update->release.psz_url ); 
    10391046    if( !p_stream ) 
    10401047    { 
     
    11081115        remove( psz_destfile ); 
    11091116 
    1110     error: 
    1111         if( p_stream ) 
    1112             stream_Delete( p_stream ); 
    1113         if( p_file ) 
    1114             fclose( p_file ); 
    1115         free( psz_destdir ); 
    1116         free( psz_destfile ); 
    1117         free( p_buffer ); 
    1118         free( psz_size ); 
     1117error: 
     1118    if( p_stream ) 
     1119        stream_Delete( p_stream ); 
     1120    if( p_file ) 
     1121        fclose( p_file ); 
     1122    free( psz_destdir ); 
     1123    free( psz_destfile ); 
     1124    free( p_buffer ); 
     1125    free( psz_size ); 
    11191126} 
    11201127