[Mplayer-cvslog] CVS: main mp_msg.c,1.3,1.4

Zoltan Ponekker pontscho at mplayer.dev.hu
Thu Sep 20 12:27:26 CEST 2001


Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv12064

Modified Files:
	mp_msg.c 
Log Message:
add gui error handling jol.

Index: mp_msg.c
===================================================================
RCS file: /cvsroot/mplayer/main/mp_msg.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- mp_msg.c	17 Aug 2001 00:39:49 -0000	1.3
+++ mp_msg.c	20 Sep 2001 10:27:23 -0000	1.4
@@ -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_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 @@
 //	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




More information about the MPlayer-cvslog mailing list