[MPlayer-cvslog] r33110 - in trunk/gui: interface.c interface.h skin/skin.c

ib subversion at mplayerhq.hu
Fri Mar 25 11:33:48 CET 2011


Author: ib
Date: Fri Mar 25 11:33:48 2011
New Revision: 33110

Log:
Add message showing function.

In some cases it is necessary to show messages to the GUI users as well
or they will wonder why the GUI didn't show up.

Modified:
   trunk/gui/interface.c
   trunk/gui/interface.h
   trunk/gui/skin/skin.c

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Fri Mar 25 10:26:00 2011	(r33109)
+++ trunk/gui/interface.c	Fri Mar 25 11:33:48 2011	(r33110)
@@ -1491,3 +1491,25 @@ int import_playtree_playlist_into_gui(pl
 
     return result;
 }
+
+// NOTE TO MYSELF: This function is nonsense.
+// MPlayer should pass messages to the GUI
+// which must decide then which message has
+// to be shown (MSGL_FATAL, for example).
+// But with this function it is at least
+// possible to show GUI's very critical or
+// abort messages.
+void gmp_msg(int mod, int lev, const char *format, ...)
+{
+    char msg[512];
+    va_list va;
+
+    va_start(va, format);
+    vsnprintf(msg, sizeof(msg), format, va);
+    va_end(va);
+
+    mp_msg(mod, lev, msg);
+
+    if (mp_msg_test(mod, lev))
+        gtkMessageBox(GTK_MB_FATAL, msg);
+}

Modified: trunk/gui/interface.h
==============================================================================
--- trunk/gui/interface.h	Fri Mar 25 10:26:00 2011	(r33109)
+++ trunk/gui/interface.h	Fri Mar 25 11:33:48 2011	(r33110)
@@ -232,6 +232,7 @@ extern float gtkEquChannels[6][10];
 
 void gaddlist(char ***list, const char *entry);
 void gfree(void **p);
+void gmp_msg(int mod, int lev, const char *format, ...);
 char *gstrchr(char *str, int c);
 int gstrcmp(const char *a, const char *b);
 char *gstrdup(const char *str);

Modified: trunk/gui/skin/skin.c
==============================================================================
--- trunk/gui/skin/skin.c	Fri Mar 25 10:26:00 2011	(r33109)
+++ trunk/gui/skin/skin.c	Fri Mar 25 11:33:48 2011	(r33110)
@@ -23,6 +23,7 @@
 #include "cut.h"
 #include "font.h"
 #include "gui/app.h"
+#include "gui/interface.h"
 #include "gui/mplayer/widgets.h"
 
 #include "config.h"
@@ -49,19 +50,13 @@ static wItem *currWinItems;
 static void skin_error(const char *format, ...)
 {
     char p[512];
-    char tmp[512];
     va_list ap;
 
     va_start(ap, format);
     vsnprintf(p, sizeof(p), format, ap);
     va_end(ap);
 
-    mp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_SKIN_ERRORMESSAGE, linenumber, p);
-
-    if (mp_msg_test(MSGT_GPLAYER, MSGL_ERR)) {
-        snprintf(tmp, sizeof(tmp), MSGTR_SKIN_ERRORMESSAGE, linenumber, p);
-        gtkMessageBox(GTK_MB_FATAL, tmp);
-    }
+    gmp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_SKIN_ERRORMESSAGE, linenumber, p);
 }
 
 #define CHECKDEFLIST(str) \


More information about the MPlayer-cvslog mailing list