Mercurial > mplayer.hg
changeset 1925:633a7f0d72a4
add gui error handling jol.
author | pontscho |
---|---|
date | Thu, 20 Sep 2001 10:27:24 +0000 |
parents | 6185fef2703a |
children | 0b14f254ae9b |
files | Gui/mplayer/gtk/mb.h Gui/mplayer/psignal.c Gui/mplayer/widgets.c Gui/mplayer/widgets.h mp_msg.c |
diffstat | 5 files changed, 91 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/Gui/mplayer/gtk/mb.h Thu Sep 20 10:26:22 2001 +0000 +++ b/Gui/mplayer/gtk/mb.h Thu Sep 20 10:27:24 2001 +0000 @@ -6,7 +6,14 @@ void on_MessageBox_destroy( GtkObject * object,gpointer user_data ) { - gtk_widget_hide( MessageBox ); +/* + switch( (int)user_data ) + { + case GTK_MB_ERROR: gtk_widget_hide( ErrorMessageBox ); break; + case GTK_MB_WARNING: gtk_widget_hide( WarningMessageBox ); break; + } +*/ + gtk_widget_hide( MessageBox ); gtkVisibleMessageBox=0; } @@ -100,16 +107,25 @@ gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0); pixmapstyle=gtk_widget_get_style( MessageBox ); + + pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )warning_xpm ); + WarningPixmap=gtk_pixmap_new( pixmapwid,mask ); pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )error_xpm ); - pixmap1=gtk_pixmap_new( pixmapwid,mask ); + ErrorPixmap=gtk_pixmap_new( pixmapwid,mask ); - gtk_widget_set_name (pixmap1, "pixmap1"); - gtk_widget_ref (pixmap1); - gtk_object_set_data_full (GTK_OBJECT (MessageBox), "pixmap1", pixmap1, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (pixmap1); - gtk_box_pack_start (GTK_BOX (hbox1), pixmap1, FALSE, FALSE, 0); - gtk_widget_set_usize (pixmap1, 55, -2); + gtk_widget_set_name (WarningPixmap, "pixmap1"); + gtk_widget_ref (WarningPixmap); + gtk_object_set_data_full (GTK_OBJECT (MessageBox), "pixmap1", WarningPixmap,(GtkDestroyNotify)gtk_widget_unref); + gtk_widget_hide (WarningPixmap); + gtk_box_pack_start (GTK_BOX (hbox1), WarningPixmap, FALSE, FALSE, 0); + gtk_widget_set_usize (WarningPixmap, 55, -2); + + gtk_widget_set_name (ErrorPixmap, "pixmap1"); + gtk_widget_ref (ErrorPixmap); + gtk_object_set_data_full (GTK_OBJECT (MessageBox), "pixmap1", ErrorPixmap,(GtkDestroyNotify)gtk_widget_unref); + gtk_widget_hide (ErrorPixmap); + gtk_box_pack_start (GTK_BOX (hbox1), ErrorPixmap, FALSE, FALSE, 0); + gtk_widget_set_usize (ErrorPixmap, 55, -2); gtkMessageBoxText = gtk_label_new ( "Text jol. Ha ezt megerted, akkor neked nagyon jo a magyar tudasod, te."); gtk_widget_set_name (gtkMessageBoxText, "gtkMessageBoxText");
--- a/Gui/mplayer/psignal.c Thu Sep 20 10:26:22 2001 +0000 +++ b/Gui/mplayer/psignal.c Thu Sep 20 10:27:24 2001 +0000 @@ -95,7 +95,25 @@ break; case evMessageBox: gtk_label_set_text( gtkMessageBoxText,(char *)gtkShMem->mb.str ); - if ( gtkVisibleMessageBox ) gtk_widget_hide( MessageBox ); + if( gtkVisibleMessageBox ) gtk_widget_hide( MessageBox ); + switch( gtkShMem->mb.type) + { + case GTK_MB_FATAL: + gtk_window_set_title (GTK_WINDOW (MessageBox), "fatal error ..."); + gtk_widget_hide( WarningPixmap ); + gtk_widget_show( ErrorPixmap ); + break; + case GTK_MB_ERROR: + gtk_window_set_title (GTK_WINDOW (MessageBox), "error ..."); + gtk_widget_hide( WarningPixmap ); + gtk_widget_show( ErrorPixmap ); + break; + case GTK_MB_WARNING: + gtk_window_set_title (GTK_WINDOW (MessageBox), "warning ..."); + gtk_widget_show( WarningPixmap ); + gtk_widget_hide( ErrorPixmap ); + break; + } gtk_widget_show( MessageBox ); gtkVisibleMessageBox=1; break;
--- a/Gui/mplayer/widgets.c Thu Sep 20 10:26:22 2001 +0000 +++ b/Gui/mplayer/widgets.c Thu Sep 20 10:27:24 2001 +0000 @@ -25,19 +25,21 @@ #include "pixmaps/up.xpm" #include "pixmaps/dir.xpm" #include "pixmaps/file.xpm" -#include "pixmaps/logo.xpm" #include "pixmaps/about.xpm" -#include "pixmaps/stop.xpm" #include "pixmaps/error.xpm" #include "pixmaps/warning.xpm" GtkWidget * SkinBrowser; GtkWidget * PlayList; GtkWidget * FileSelect; -GtkWidget * MessageBox; GtkWidget * AboutBox; GtkWidget * Options; +GtkWidget * MessageBox; + +GtkWidget * WarningPixmap; +GtkWidget * ErrorPixmap; + int gtkVisibleSkinBrowser = 0; int gtkVisiblePlayList = 0; int gtkVisibleFileSelect = 0;
--- a/Gui/mplayer/widgets.h Thu Sep 20 10:26:22 2001 +0000 +++ b/Gui/mplayer/widgets.h Thu Sep 20 10:27:24 2001 +0000 @@ -59,10 +59,14 @@ extern GtkWidget * SkinBrowser; extern GtkWidget * PlayList; extern GtkWidget * FileSelect; -extern GtkWidget * MessageBox; extern GtkWidget * AboutBox; extern GtkWidget * Options; +extern GtkWidget * MessageBox; + +extern GtkWidget * WarningPixmap; +extern GtkWidget * ErrorPixmap; + extern GtkWidget * SkinList; extern GtkWidget * gtkMessageBoxText; @@ -86,4 +90,4 @@ extern void gtkSetDefaultToCList( GtkWidget * list,char * item ); extern int gtkFindCList( GtkWidget * list,char * item ); -#endif \ No newline at end of file +#endif
--- a/mp_msg.c Thu Sep 20 10:26:22 2001 +0000 +++ b/mp_msg.c Thu Sep 20 10:27:24 2001 +0000 @@ -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