VLC_EXPORT( update_t *, __update_New, ( vlc_object_t * ) );
VLC_EXPORT( void, update_Delete, ( update_t * ) );
-VLC_EXPORT( void, update_Check, ( update_t * ) );
+VLC_EXPORT( void, update_Check, ( update_t *, void (*callback)( void* ), void * ) );
VLC_EXPORT( int, update_CompareReleaseToCurrent, ( update_t * ) );
VLC_EXPORT( void, update_Download, ( update_t *, char* ) );
* UpdateDialog
*****************************************************************************/
/* callback to get information from the core */
-static int updateCallback( vlc_object_t *p_this, char const *psz_cmd,
- vlc_value_t oldval, vlc_value_t newval, void *data )
+static void UpdateCallback( void *data )
{
UpdateDialog* UDialog = (UpdateDialog *)data;
QEvent *event = new QEvent( QEvent::User );
QApplication::postEvent( UDialog, event );
- return VLC_SUCCESS;
}
UpdateDialog *UpdateDialog::instance = NULL;
/* create the update structure and the callback */
p_update = update_New( _p_intf );
- var_AddCallback( _p_intf->p_libvlc, "update-notify", updateCallback, this );
b_checked = false;
}
UpdateDialog::~UpdateDialog()
{
- var_DelCallback( p_update->p_libvlc, "update-notify", updateCallback, this );
update_Delete( p_update );
}
if( !b_checked )
{
updateButton->setEnabled( false );
- update_Check( p_update );
+ update_Check( p_update, UpdateCallback, this );
}
else
{
void UpdateVLC::OnCheckForUpdate( wxCommandEvent& event )
{
- update_Check( p_update );
+ update_Check( p_update, NULL, this );
wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
DestroyChildren();
/* Create volume callback system. */
var_Create( p_libvlc, "volume-change", VLC_VAR_BOOL );
- /* Notify interfaces that a new VLC version is available */
-#ifdef UPDATE_CHECK
- var_Create( p_libvlc, "update-notify", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
-#endif
-
/*
* Get input filenames given as commandline arguments
*/
{
VLC_COMMON_MEMBERS
update_t *p_update;
+ void (*pf_callback)( void * );
+ void *p_data;
} update_check_thread_t;
void update_CheckReal( update_check_thread_t *p_uct );
* Check for updates
*
* \param p_update pointer to update struct
+ * \param pf_callback pointer to a function to call when the update_check is finished
+ * \param p_data pointer to some datas to give to the callback
* \returns nothing
*/
-void update_Check( update_t *p_update )
+void update_Check( update_t *p_update, void (*pf_callback)( void* ), void *p_data )
{
assert( p_update );
update_check_thread_t *p_uct = vlc_object_create( p_update->p_libvlc,
sizeof( update_check_thread_t ) );
p_uct->p_update = p_update;
+ p_uct->pf_callback = pf_callback;
+ p_uct->p_data = p_data;
vlc_thread_create( p_uct, "check for update", update_CheckReal,
VLC_THREAD_PRIORITY_LOW, VLC_FALSE );
vlc_mutex_unlock( &p_uct->p_update->lock );
- var_TriggerCallback( p_uct->p_libvlc, "update-notify" );
+ if( p_uct->pf_callback )
+ (p_uct->pf_callback)( p_uct->p_data );
}
/**
char *psz_destdir = p_udt->psz_destdir;
/* Open the stream */
- p_stream = stream_UrlNew( p_update->p_libvlc, p_update->release.psz_url );
+ p_stream = stream_UrlNew( p_udt, p_update->release.psz_url );
if( !p_stream )
{
msg_Err( p_udt, "Failed to open %s for reading", p_update->release.psz_url );
else
remove( psz_destfile );
- error:
- if( p_stream )
- stream_Delete( p_stream );
- if( p_file )
- fclose( p_file );
- free( psz_destdir );
- free( psz_destfile );
- free( p_buffer );
- free( psz_size );
+error:
+ if( p_stream )
+ stream_Delete( p_stream );
+ if( p_file )
+ fclose( p_file );
+ free( psz_destdir );
+ free( psz_destfile );
+ free( p_buffer );
+ free( psz_size );
}
#endif