Commit 065f7608 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Progress interaction: remove useless parameter

parent 647ff1a2
...@@ -294,12 +294,9 @@ VLC_EXPORT( int, __intf_UserStringInput,(vlc_object_t*, const char*, const char* ...@@ -294,12 +294,9 @@ VLC_EXPORT( int, __intf_UserStringInput,(vlc_object_t*, const char*, const char*
#define intf_IntfProgress( a, b, c ) __intf_Progress( VLC_OBJECT(a), NULL, b,c, -1 ) #define intf_IntfProgress( a, b, c ) __intf_Progress( VLC_OBJECT(a), NULL, b,c, -1 )
#define intf_UserProgress( a, b, c, d, e ) __intf_Progress( VLC_OBJECT(a),b,c,d,e ) #define intf_UserProgress( a, b, c, d, e ) __intf_Progress( VLC_OBJECT(a),b,c,d,e )
VLC_EXPORT( interaction_dialog_t *, __intf_Progress,( vlc_object_t*, const char*, const char*, float, int) ); VLC_EXPORT( interaction_dialog_t *, __intf_Progress,( vlc_object_t*, const char*, const char*, float, int) );
#define intf_ProgressUpdate( a, b, c, d, e ) __intf_ProgressUpdate( VLC_OBJECT(a),b,c,d,e ) VLC_EXPORT( void, intf_ProgressUpdate,( interaction_dialog_t *, const char*, float, int) );
VLC_EXPORT( void, __intf_ProgressUpdate,( vlc_object_t*, interaction_dialog_t *, const char*, float, int) ); VLC_EXPORT( bool, intf_ProgressIsCancelled,( interaction_dialog_t * ) );
#define intf_ProgressIsCancelled( a, b ) __intf_UserProgressIsCancelled( VLC_OBJECT(a),b ) VLC_EXPORT( void, intf_UserHide,( interaction_dialog_t * ));
VLC_EXPORT( bool, __intf_UserProgressIsCancelled,( vlc_object_t*, interaction_dialog_t * ) );
#define intf_UserHide( a, b ) __intf_UserHide( VLC_OBJECT(a), b )
VLC_EXPORT( void, __intf_UserHide,( vlc_object_t *, interaction_dialog_t * ));
/** @} */ /** @} */
/** @} */ /** @} */
......
...@@ -136,7 +136,7 @@ int scan_Init( vlc_object_t *p_obj, scan_t *p_scan, const scan_parameter_t *p_pa ...@@ -136,7 +136,7 @@ int scan_Init( vlc_object_t *p_obj, scan_t *p_scan, const scan_parameter_t *p_pa
void scan_Clean( scan_t *p_scan ) void scan_Clean( scan_t *p_scan )
{ {
if( p_scan->p_dialog != NULL ) if( p_scan->p_dialog != NULL )
intf_UserHide( p_scan->p_obj, p_scan->p_dialog ); intf_UserHide( p_scan->p_dialog );
for( int i = 0; i < p_scan->i_service; i++ ) for( int i = 0; i < p_scan->i_service; i++ )
scan_service_Delete( p_scan->pp_service[i] ); scan_service_Delete( p_scan->pp_service[i] );
...@@ -320,7 +320,7 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg ) ...@@ -320,7 +320,7 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg )
if( p_scan->p_dialog == NULL ) if( p_scan->p_dialog == NULL )
p_scan->p_dialog = intf_UserProgress( p_scan->p_obj, _("Scanning DVB-T"), psz_text, 100.0 * f_position, -1 ); p_scan->p_dialog = intf_UserProgress( p_scan->p_obj, _("Scanning DVB-T"), psz_text, 100.0 * f_position, -1 );
else else
intf_ProgressUpdate( p_scan->p_obj, p_scan->p_dialog, psz_text, 100 * f_position, -1 ); intf_ProgressUpdate( p_scan->p_dialog, psz_text, 100 * f_position, -1 );
free( psz_text ); free( psz_text );
} }
...@@ -330,7 +330,7 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg ) ...@@ -330,7 +330,7 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg )
bool scan_IsCancelled( scan_t *p_scan ) bool scan_IsCancelled( scan_t *p_scan )
{ {
return p_scan->p_dialog && intf_ProgressIsCancelled( p_scan->p_obj, p_scan->p_dialog ); return p_scan->p_dialog && intf_ProgressIsCancelled( p_scan->p_dialog );
} }
static scan_service_t *ScanFindService( scan_t *p_scan, int i_service_start, int i_program ) static scan_service_t *ScanFindService( scan_t *p_scan, int i_service_start, int i_program )
......
...@@ -2414,12 +2414,12 @@ static void AVI_IndexCreate( demux_t *p_demux ) ...@@ -2414,12 +2414,12 @@ static void AVI_IndexCreate( demux_t *p_demux )
/* Don't update/check dialog too often */ /* Don't update/check dialog too often */
if( p_dialog && mdate() - i_dialog_update > 100000 ) if( p_dialog && mdate() - i_dialog_update > 100000 )
{ {
if( intf_ProgressIsCancelled( p_demux, p_dialog ) ) if( intf_ProgressIsCancelled( p_dialog ) )
break; break;
double f_pos = 100.0 * stream_Tell( p_demux->s ) / double f_pos = 100.0 * stream_Tell( p_demux->s ) /
stream_Size( p_demux->s ); stream_Size( p_demux->s );
intf_ProgressUpdate( p_demux, p_dialog, intf_ProgressUpdate( p_dialog,
_( "Fixing AVI Index..." ), f_pos, -1 ); _( "Fixing AVI Index..." ), f_pos, -1 );
i_dialog_update = mdate(); i_dialog_update = mdate();
...@@ -2484,7 +2484,7 @@ static void AVI_IndexCreate( demux_t *p_demux ) ...@@ -2484,7 +2484,7 @@ static void AVI_IndexCreate( demux_t *p_demux )
print_stat: print_stat:
if( p_dialog != NULL ) if( p_dialog != NULL )
intf_UserHide( p_demux, p_dialog ); intf_UserHide( p_dialog );
for( i_stream = 0; i_stream < p_sys->i_track; i_stream++ ) for( i_stream = 0; i_stream < p_sys->i_track; i_stream++ )
{ {
......
...@@ -204,20 +204,17 @@ __intf_Progress( vlc_object_t *p_this, const char *psz_title, ...@@ -204,20 +204,17 @@ __intf_Progress( vlc_object_t *p_this, const char *psz_title,
/** /**
* Update a progress bar in a dialogue * Update a progress bar in a dialogue
* *
* \param p_this Parent vlc_object
* \param p_dialog Dialog * \param p_dialog Dialog
* \param psz_status New status * \param psz_status New status
* \param f_position New position (0.0->100.0) * \param f_position New position (0.0->100.0)
* \param i_timeToGo Time (in sec) to go until process is finished * \param i_timeToGo Time (in sec) to go until process is finished
* \return nothing * \return nothing
*/ */
void __intf_ProgressUpdate( vlc_object_t *p_this, void intf_ProgressUpdate( interaction_dialog_t *p_dialog,
interaction_dialog_t *p_dialog,
const char *psz_status, float f_pos, int i_time ) const char *psz_status, float f_pos, int i_time )
{ {
interaction_t *p_interaction = InteractionGet( p_this ); interaction_t *p_interaction = InteractionGet( p_dialog->p_parent );
assert( p_interaction );
if( !p_interaction ) return;
vlc_object_lock( p_interaction ); vlc_object_lock( p_interaction );
free( p_dialog->psz_description ); free( p_dialog->psz_description );
...@@ -237,18 +234,15 @@ void __intf_ProgressUpdate( vlc_object_t *p_this, ...@@ -237,18 +234,15 @@ void __intf_ProgressUpdate( vlc_object_t *p_this,
* Helper function to communicate dialogue cancellations between the * Helper function to communicate dialogue cancellations between the
* interface module and the caller * interface module and the caller
* *
* \param p_this Parent vlc_object
* \param p_dialog Dialog * \param p_dialog Dialog
* \return Either true or false * \return Either true or false
*/ */
bool __intf_UserProgressIsCancelled( vlc_object_t *p_this, bool intf_ProgressIsCancelled( interaction_dialog_t *p_dialog )
interaction_dialog_t *p_dialog )
{ {
interaction_t *p_interaction = InteractionGet( p_this ); interaction_t *p_interaction = InteractionGet( p_dialog->p_parent );
bool b_cancel; bool b_cancel;
if( !p_interaction ) return true; assert( p_interaction );
vlc_object_lock( p_interaction ); vlc_object_lock( p_interaction );
b_cancel = p_dialog->b_cancelled; b_cancel = p_dialog->b_cancelled;
vlc_object_unlock( p_interaction ); vlc_object_unlock( p_interaction );
...@@ -329,15 +323,13 @@ int __intf_UserStringInput( vlc_object_t *p_this, ...@@ -329,15 +323,13 @@ int __intf_UserStringInput( vlc_object_t *p_this,
/** /**
* Hide an interaction dialog * Hide an interaction dialog
* *
* \param p_this the parent vlc object
* \param p_dialog the dialog to hide * \param p_dialog the dialog to hide
* \return nothing * \return nothing
*/ */
void __intf_UserHide( vlc_object_t *p_this, interaction_dialog_t *p_dialog ) void intf_UserHide( interaction_dialog_t *p_dialog )
{ {
interaction_t *p_interaction = InteractionGet( p_this ); interaction_t *p_interaction = InteractionGet( p_dialog->p_parent );
assert( p_interaction );
if( !p_interaction ) return;
vlc_object_lock( p_interaction ); vlc_object_lock( p_interaction );
p_dialog->i_status = ANSWERED_DIALOG; p_dialog->i_status = ANSWERED_DIALOG;
...@@ -442,7 +434,7 @@ int interaction_Unregister( intf_thread_t *intf ) ...@@ -442,7 +434,7 @@ int interaction_Unregister( intf_thread_t *intf )
* The following functions are local * The following functions are local
**********************************************************************/ **********************************************************************/
/* Get the interaction object. Create it if needed */ /* Get the interaction object */
static interaction_t * InteractionGet( vlc_object_t *p_this ) static interaction_t * InteractionGet( vlc_object_t *p_this )
{ {
interaction_t *obj = libvlc_priv(p_this->p_libvlc)->p_interaction; interaction_t *obj = libvlc_priv(p_this->p_libvlc)->p_interaction;
...@@ -482,7 +474,7 @@ static void DialogDestroy( interaction_dialog_t *p_dialog ) ...@@ -482,7 +474,7 @@ static void DialogDestroy( interaction_dialog_t *p_dialog )
* if required */ * if required */
static int DialogSend( vlc_object_t *p_this, interaction_dialog_t *p_dialog ) static int DialogSend( vlc_object_t *p_this, interaction_dialog_t *p_dialog )
{ {
interaction_t *p_interaction = InteractionGet( p_this ); interaction_t *p_interaction = InteractionGet( p_dialog->p_parent );
if( !p_interaction ) if( !p_interaction )
return VLC_EGENERIC; return VLC_EGENERIC;
......
...@@ -192,13 +192,13 @@ interaction_Unregister ...@@ -192,13 +192,13 @@ interaction_Unregister
__intf_Create __intf_Create
__intf_Eject __intf_Eject
__intf_Progress __intf_Progress
__intf_ProgressUpdate intf_ProgressIsCancelled
intf_ProgressUpdate
intf_RunThread intf_RunThread
intf_StopThread intf_StopThread
__intf_UserFatal __intf_UserFatal
__intf_UserHide intf_UserHide
__intf_UserLoginPassword __intf_UserLoginPassword
__intf_UserProgressIsCancelled
__intf_UserStringInput __intf_UserStringInput
__intf_UserWarn __intf_UserWarn
__intf_UserYesNo __intf_UserYesNo
......
...@@ -1597,7 +1597,7 @@ static void* update_DownloadReal( vlc_object_t *p_this ) ...@@ -1597,7 +1597,7 @@ static void* update_DownloadReal( vlc_object_t *p_this )
vlc_object_lock( p_udt ); vlc_object_lock( p_udt );
while( vlc_object_alive( p_udt ) && while( vlc_object_alive( p_udt ) &&
( i_read = stream_Read( p_stream, p_buffer, 1 << 10 ) ) && ( i_read = stream_Read( p_stream, p_buffer, 1 << 10 ) ) &&
!intf_ProgressIsCancelled( p_udt, p_progress ) ) !intf_ProgressIsCancelled( p_progress ) )
{ {
vlc_object_unlock( p_udt ); vlc_object_unlock( p_udt );
if( fwrite( p_buffer, i_read, 1, p_file ) < 1 ) if( fwrite( p_buffer, i_read, 1, p_file ) < 1 )
...@@ -1614,7 +1614,7 @@ static void* update_DownloadReal( vlc_object_t *p_this ) ...@@ -1614,7 +1614,7 @@ static void* update_DownloadReal( vlc_object_t *p_this )
p_update->release.psz_url, psz_downloaded, psz_size, p_update->release.psz_url, psz_downloaded, psz_size,
f_progress ) != -1 ) f_progress ) != -1 )
{ {
intf_ProgressUpdate( p_udt, p_progress, psz_status, f_progress, 0 ); intf_ProgressUpdate( p_progress, psz_status, f_progress, 0 );
free( psz_status ); free( psz_status );
} }
free( psz_downloaded ); free( psz_downloaded );
...@@ -1626,13 +1626,13 @@ static void* update_DownloadReal( vlc_object_t *p_this ) ...@@ -1626,13 +1626,13 @@ static void* update_DownloadReal( vlc_object_t *p_this )
p_file = NULL; p_file = NULL;
if( vlc_object_alive( p_udt ) && if( vlc_object_alive( p_udt ) &&
!intf_ProgressIsCancelled( p_udt, p_progress ) ) !intf_ProgressIsCancelled( p_progress ) )
{ {
vlc_object_unlock( p_udt ); vlc_object_unlock( p_udt );
if( asprintf( &psz_status, _("%s\nDone %s (100.0%%)"), if( asprintf( &psz_status, _("%s\nDone %s (100.0%%)"),
p_update->release.psz_url, psz_size ) != -1 ) p_update->release.psz_url, psz_size ) != -1 )
{ {
intf_ProgressUpdate( p_udt, p_progress, psz_status, 100.0, 0 ); intf_ProgressUpdate( p_progress, psz_status, 100.0, 0 );
p_progress = NULL p_progress = NULL
free( psz_status ); free( psz_status );
} }
...@@ -1725,7 +1725,7 @@ static void* update_DownloadReal( vlc_object_t *p_this ) ...@@ -1725,7 +1725,7 @@ static void* update_DownloadReal( vlc_object_t *p_this )
end: end:
if( p_progress ) if( p_progress )
{ {
intf_ProgressUpdate( p_udt, p_progress, _("Cancelled"), 100.0, 0 ); intf_ProgressUpdate( p_progress, _("Cancelled"), 100.0, 0 );
} }
if( p_stream ) if( p_stream )
stream_Delete( p_stream ); stream_Delete( p_stream );
......
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