-#define FORMAT_DESC \
- va_start( args, psz_format ); \
- if( vasprintf( &p_new->psz_description, psz_format, args ) == -1 ) \
- return VLC_EGENERIC; \
- va_end( args )
-
-/**
- * Send an error message, both in a blocking and non-blocking way
- *
- * \param p_this Parent vlc_object
- * \param b_blocking Is this dialog blocking or not?
- * \param psz_title Title for the dialog
- * \param psz_format The message to display
- * \return VLC_SUCCESS or VLC_EGENERIC
- */
-int __intf_UserFatal( vlc_object_t *p_this, bool b_blocking,
- const char *psz_title,
- const char *psz_format, ... )
-{
- va_list args;
- DIALOG_INIT( ONEWAY );
-
- p_new->psz_title = strdup( psz_title );
- FORMAT_DESC;
-
- if( b_blocking )
- p_new->i_flags = DIALOG_BLOCKING_ERROR;
- else
- p_new->i_flags = DIALOG_NONBLOCKING_ERROR;
-
- return DialogSend( p_this, p_new );
-}
-
-/**
- * Helper function to send a warning, which is always shown non-blocking
- *
- * \param p_this Parent vlc_object
- * \param psz_title Title for the dialog
- * \param psz_format The message to display
- * \return VLC_SUCCESS or VLC_EGENERIC
- */
-int __intf_UserWarn( vlc_object_t *p_this,
- const char *psz_title,
- const char *psz_format, ... )
-{
- va_list args;
- DIALOG_INIT( ONEWAY );
-
- p_new->psz_title = strdup( psz_title );
- FORMAT_DESC;
-
- p_new->i_flags = DIALOG_WARNING;
-
- return DialogSend( p_this, p_new );
-}
-
-/**
- * Helper function to ask a yes-no-cancel question
- *
- * \param p_this Parent vlc_object
- * \param psz_title Title for the dialog
- * \param psz_description A description
- * \param psz_default caption for the default button
- * \param psz_alternate caption for the alternate button
- * \param psz_other caption for the optional 3rd button (== cancel)
- * \return Clicked button code
- */
-int __intf_UserYesNo( vlc_object_t *p_this,
- const char *psz_title,
- const char *psz_description,
- const char *psz_default,
- const char *psz_alternate,
- const char *psz_other )
-{
- DIALOG_INIT( TWOWAY );
-
- p_new->psz_title = strdup( psz_title );
- p_new->psz_description = strdup( psz_description );
- p_new->i_flags = DIALOG_YES_NO_CANCEL;
- p_new->psz_default_button = strdup( psz_default );
- p_new->psz_alternate_button = strdup( psz_alternate );
- if( psz_other )
- p_new->psz_other_button = strdup( psz_other );
-
- return DialogSend( p_this, p_new );
-}
-