Commit 4488be3b authored by Thomas Guillem's avatar Thomas Guillem

dialog: fix win32 build

parent 5a9609c7
...@@ -225,17 +225,16 @@ static int Create( vlc_object_t *p_this ) ...@@ -225,17 +225,16 @@ static int Create( vlc_object_t *p_this )
#ifdef HAVE_FONTCONFIG #ifdef HAVE_FONTCONFIG
#if defined(_WIN32) #if defined(_WIN32)
int i_ret = vlc_dialog_id *p_dialog_id =
vlc_dialog_display_progress( p_dec, true, 0.0, NULL, vlc_dialog_display_progress( p_dec, true, 0.0, NULL,
_("Building font cache"), _("Building font cache"),
_( "Please wait while your font cache is rebuilt.\n" _( "Please wait while your font cache is rebuilt.\n"
"This should take less than a minute." ) ); "This should take less than a minute." ) );
unsigned int i_dialog_id = i_ret > 0 ? i_ret : 0;
#endif #endif
ass_set_fonts( p_renderer, psz_font, psz_family, 1, NULL, 1 ); // setup default font/family ass_set_fonts( p_renderer, psz_font, psz_family, 1, NULL, 1 ); // setup default font/family
#if defined(_WIN32) #if defined(_WIN32)
if( i_dialog_id != 0 ) if( p_dialog_id != 0 )
vlc_dialog_cancel( p_dec, i_dialog_id ); vlc_dialog_release( p_dec, p_dialog_id );
#endif #endif
#else #else
ass_set_fonts( p_renderer, psz_font, psz_family, 1, NULL, 1 ); ass_set_fonts( p_renderer, psz_font, psz_family, 1, NULL, 1 );
......
...@@ -529,8 +529,6 @@ void update_Download( update_t *p_update, const char *psz_destdir ) ...@@ -529,8 +529,6 @@ void update_Download( update_t *p_update, const char *psz_destdir )
static void* update_DownloadReal( void *obj ) static void* update_DownloadReal( void *obj )
{ {
update_download_thread_t *p_udt = (update_download_thread_t *)obj; update_download_thread_t *p_udt = (update_download_thread_t *)obj;
int i_ret;
unsigned int i_dialog_id = 0;
uint64_t l_size; uint64_t l_size;
uint64_t l_downloaded = 0; uint64_t l_downloaded = 0;
float f_progress; float f_progress;
...@@ -545,6 +543,7 @@ static void* update_DownloadReal( void *obj ) ...@@ -545,6 +543,7 @@ static void* update_DownloadReal( void *obj )
int i_read; int i_read;
int canc; int canc;
vlc_dialog_id *p_dialog_id = NULL;
update_t *p_update = p_udt->p_update; update_t *p_update = p_udt->p_update;
char *psz_destdir = p_udt->psz_destdir; char *psz_destdir = p_udt->psz_destdir;
...@@ -594,20 +593,19 @@ static void* update_DownloadReal( void *obj ) ...@@ -594,20 +593,19 @@ static void* update_DownloadReal( void *obj )
psz_size = size_str( l_size ); psz_size = size_str( l_size );
i_ret = p_dialog_id =
vlc_dialog_display_progress( p_udt, false, 0.0, _("Cancel"), vlc_dialog_display_progress( p_udt, false, 0.0, _("Cancel"),
( "Downloading..."), ( "Downloading..."),
_("%s\nDownloading... %s/%s %.1f%% done"), _("%s\nDownloading... %s/%s %.1f%% done"),
p_update->release.psz_url, "0.0", psz_size, p_update->release.psz_url, "0.0", psz_size,
0.0 ); 0.0 );
if( i_ret <= 0 ) if( p_dialog_id == NULL )
goto end; goto end;
i_dialog_id = i_ret;
while( !atomic_load( &p_udt->aborted ) && while( !atomic_load( &p_udt->aborted ) &&
( i_read = stream_Read( p_stream, p_buffer, 1 << 10 ) ) && ( i_read = stream_Read( p_stream, p_buffer, 1 << 10 ) ) &&
!vlc_dialog_cancelled( p_udt, i_dialog_id ) ) !vlc_dialog_is_cancelled( p_udt, p_dialog_id ) )
{ {
if( fwrite( p_buffer, i_read, 1, p_file ) < 1 ) if( fwrite( p_buffer, i_read, 1, p_file ) < 1 )
{ {
...@@ -619,7 +617,7 @@ static void* update_DownloadReal( void *obj ) ...@@ -619,7 +617,7 @@ static void* update_DownloadReal( void *obj )
psz_downloaded = size_str( l_downloaded ); psz_downloaded = size_str( l_downloaded );
f_progress = (float)l_downloaded/(float)l_size; f_progress = (float)l_downloaded/(float)l_size;
vlc_dialog_update_progress_text( p_udt, i_dialog_id, f_pos, vlc_dialog_update_progress_text( p_udt, p_dialog_id, f_progress,
"%s\nDownloading... %s/%s - %.1f%% done", "%s\nDownloading... %s/%s - %.1f%% done",
p_update->release.psz_url, p_update->release.psz_url,
psz_downloaded, psz_size, psz_downloaded, psz_size,
...@@ -632,10 +630,10 @@ static void* update_DownloadReal( void *obj ) ...@@ -632,10 +630,10 @@ static void* update_DownloadReal( void *obj )
p_file = NULL; p_file = NULL;
if( !atomic_load( &p_udt->aborted ) && if( !atomic_load( &p_udt->aborted ) &&
!vlc_dialog_cancelled( p_udt, i_dialog_id ) ) !vlc_dialog_is_cancelled( p_udt, p_dialog_id ) )
{ {
vlc_dialog_cancel( p_udt, i_dialog_id ); vlc_dialog_release( p_udt, p_dialog_id );
i_dialog_id = 0; p_dialog_id = NULL;
} }
else else
{ {
...@@ -722,12 +720,12 @@ static void* update_DownloadReal( void *obj ) ...@@ -722,12 +720,12 @@ static void* update_DownloadReal( void *obj )
free( p_hash ); free( p_hash );
#ifdef _WIN32 #ifdef _WIN32
static const char *psz_msg = const char *psz_msg =
_("The new version was successfully downloaded." _("The new version was successfully downloaded."
"Do you want to close VLC and install it now?"); "Do you want to close VLC and install it now?");
int answer = vlc_dialog_wait_question( p_udt, VLC_DIALOG_QUESTION_NORMAL, int answer = vlc_dialog_wait_question( p_udt, VLC_DIALOG_QUESTION_NORMAL,
_("Cancel"), _("Install"), NULL, _("Cancel"), _("Install"), NULL,
_("Update VLC media player"), _("Update VLC media player"), "%s",
psz_msg ); psz_msg );
if(answer == 1) if(answer == 1)
{ {
...@@ -739,8 +737,8 @@ static void* update_DownloadReal( void *obj ) ...@@ -739,8 +737,8 @@ static void* update_DownloadReal( void *obj )
} }
#endif #endif
end: end:
if( i_dialog_id != 0 ) if( p_dialog_id != NULL )
vlc_dialog_cancel( p_udt, i_dialog_id ); vlc_dialog_release( p_udt, p_dialog_id );
if( p_stream ) if( p_stream )
stream_Delete( p_stream ); stream_Delete( p_stream );
if( p_file ) if( p_file )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment