VLC_EXPORT( bool, update_NeedUpgrade, ( update_t * ) );
VLC_EXPORT( void, update_Download, ( update_t *, const char* ) );
VLC_EXPORT( update_release_t*, update_GetRelease, ( update_t * ) );
+VLC_EXPORT( void, update_WaitDownload, ( update_t * ) );
/**
* @}
if( returnCode == NSOKButton )
{
/* perform download and pass the selected path */
- [self performDownload: [sheet filename]];
+ [NSThread detachNewThreadSelector:@selector(performDownload:) toTarget:self withObject:[sheet filename]];
}
[sheet release];
}
- (void)performDownload:(NSString *)path
{
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
update_Download( p_u, [path UTF8String] );
[o_btn_DownloadNow setEnabled: NO];
[o_update_window orderOut: self];
+ update_WaitDownload( p_u );
update_Delete( p_u );
p_u = nil;
+ [pool release];
}
@end
return i_retval == -1 ? NULL : psz_tmp;
}
+void update_WaitDownload( update_t *p_update )
+{
+ if(p_update->p_download)
+ vlc_thread_join( p_update->p_download );
+ vlc_object_release( p_update->p_download );
+ p_update->p_download = NULL;
+}
+
static void* update_DownloadReal( vlc_object_t *p_this );
/**
update_t *p_update = p_udt->p_update;
char *psz_destdir = p_udt->psz_destdir;
+ msg_Dbg( p_udt, "Opening Stream '%s'", p_update->release.psz_url );
+
/* Open the stream */
p_stream = stream_UrlNew( p_udt, p_update->release.psz_url );
if( !p_stream )
/* Create a buffer and fill it with the downloaded file */
p_buffer = (void *)malloc( 1 << 10 );
if( !p_buffer )
+ {
+ msg_Err( p_udt, "Can't malloc (1 << 10) bytes! download cancelled." );
goto end;
+ }
+
+ msg_Dbg( p_udt, "Downloading Stream '%s'", p_update->release.psz_url );
psz_size = size_str( l_size );
if( asprintf( &psz_status, "%s\nDownloading... O.O/%s %.1f%% done",
p_update->release.psz_url, psz_size ) != -1 )
{
intf_ProgressUpdate( p_udt, i_progress, psz_status, 100.0, 0 );
+ i_progress = 0;
free( psz_status );
}
}
free( p_hash );
end:
+ if( i_progress )
+ {
+ intf_ProgressUpdate( p_udt, i_progress, "Cancelled", 100.0, 0 );
+ }
if( p_stream )
stream_Delete( p_stream );
if( p_file )
return false;
}
+void update_WaitDownload( update_t *p_update )
+{
+ (void)p_update;
+}
+
void update_Download( update_t *p_update, const char *psz_destdir )
{
(void)p_update; (void)psz_destdir;