diff options
author | pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-09-20 10:27:24 +0000 |
---|---|---|
committer | pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-09-20 10:27:24 +0000 |
commit | 23949ebcfa748acd703ff433b3456a131504fdc1 (patch) | |
tree | e87f4fc75510fb0e2ac92beda7f25245a7d0797f /mp_msg.c | |
parent | d4e44fe64c7c665c0d5d2201b947ad0da6574cd3 (diff) | |
download | mpv-23949ebcfa748acd703ff433b3456a131504fdc1.tar.bz2 mpv-23949ebcfa748acd703ff433b3456a131504fdc1.tar.xz |
add gui error handling jol.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1926 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mp_msg.c')
-rw-r--r-- | mp_msg.c | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -3,6 +3,14 @@ #include <stdlib.h> #include <stdarg.h> +#include "config.h" + +#ifdef HAVE_NEW_GUI +#include "Gui/mplayer/widgets.h" +extern void gtkMessageBox( int type,char * str ); +extern int use_gui; +#endif + #include "mp_msg.h" static int mp_msg_levels[MSGT_MAX]; // verbose level of this module @@ -18,8 +26,11 @@ void mp_msg_init(int verbose){ void mp_msg_c( int x, const char *format, ... ){ va_list va; + char tmp[128]; if((x&255)>mp_msg_levels[x>>8]) return; // do not display va_start(va, format); + vsnprintf( tmp,128,format,va ); +/* if((x&255)<=MSGL_ERR){ // fprintf(stderr,"%%%%%% "); vfprintf(stderr,format, va); @@ -27,7 +38,32 @@ void mp_msg_c( int x, const char *format, ... ){ // printf("%%%%%% "); vprintf(format, va); } +*/ va_end(va); + switch( x&255 ) + { + case MSGL_FATAL: + fprintf( stderr,"%s",tmp ); + #ifdef HAVE_NEW_GUI + if ( use_gui ) gtkMessageBox( GTK_MB_FATAL|GTK_MB_SIMPLE,tmp ); + #endif + break; + case MSGL_ERR: + fprintf( stderr,"%s",tmp ); + #ifdef HAVE_NEW_GUI + if ( use_gui ) gtkMessageBox( GTK_MB_ERROR|GTK_MB_SIMPLE,tmp ); + #endif + break; + case MSGL_WARN: + printf( "%s",tmp ); + #ifdef HAVE_NEW_GUI + if ( use_gui ) gtkMessageBox( GTK_MB_WARNING|GTK_MB_SIMPLE,tmp ); + #endif + break; + default: + printf( "%s",tmp ); + break; + } } #else |