/** * Sends an error message through the user interface (if any). * @param obj the VLC object emitting the error * @param modal whether to wait for user to acknowledge the error * before returning control to the caller * @param title title of the error dialog * @param fmt format string for the error message * @param ap parameters list for the formatted error message */ void dialog_VFatal (vlc_object_t *obj, bool modal, const char *title, const char *fmt, va_list ap) { char *text; if (obj->i_flags & OBJECT_FLAGS_NOINTERACT) return; vlc_object_t *provider = dialog_GetProvider (obj); if (provider == NULL) { msg_Err (obj, "%s", title); msg_GenericVa (obj, VLC_MSG_ERR, MODULE_STRING, fmt, ap); return; } if (vasprintf (&text, fmt, ap) != -1) { dialog_fatal_t dialog = { title, text, }; var_SetAddress (provider, modal ? "dialog-critical" : "dialog-error", &dialog); free (text); } vlc_object_release (provider); }
/***************************************************************************** * msg_*: print a message ***************************************************************************** * These functions queue a message for later printing. *****************************************************************************/ void msg_Generic( vlc_object_t *p_this, int i_type, const char *psz_module, const char *psz_format, ... ) { va_list args; va_start( args, psz_format ); msg_GenericVa (p_this, i_type, psz_module, psz_format, args); va_end( args ); }
int vlc_dialog_display_error_va(vlc_object_t *p_obj, const char *psz_title, const char *psz_fmt, va_list ap) { assert(p_obj != NULL && psz_title != NULL && psz_fmt != NULL); int i_ret; vlc_dialog_provider *p_provider = get_dialog_provider(p_obj, true); if (p_provider != NULL) i_ret = dialog_display_error_va(p_provider, psz_title, psz_fmt, ap); else i_ret = VLC_EGENERIC; if (i_ret != VLC_SUCCESS) { msg_Err(p_obj, "%s", psz_title); msg_GenericVa(p_obj, VLC_MSG_ERR, psz_fmt, ap); } return i_ret; }