diff gui/interface.c @ 33023:ba432e34dc7e

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.
author ib
date Fri, 25 Mar 2011 10:33:48 +0000
parents 66d908462d76
children 21e0de9c355f
line wrap: on
line diff
--- a/gui/interface.c	Fri Mar 25 09:26:00 2011 +0000
+++ b/gui/interface.c	Fri Mar 25 10:33:48 2011 +0000
@@ -1491,3 +1491,25 @@
 
     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);
+}