]> git.sesse.net Git - vlc/commitdiff
dialog: support modal fatal errors
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 7 Mar 2009 16:09:23 +0000 (18:09 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 7 Mar 2009 16:29:36 +0000 (18:29 +0200)
include/vlc_dialog.h
src/interface/dialog.c
src/libvlccore.sym

index 01c164a33a07f22ceba20db44a17f7ac3ba247d2..9758243b6c83a070d47d3b4569f642c112a782b9 100644 (file)
@@ -20,6 +20,7 @@
 
 #ifndef VLC_DIALOG_H_
 #define VLC_DIALOG_H_
+# include <stdarg.h>
 
 /**
  * \file vlc_dialog.h
@@ -34,12 +35,35 @@ typedef struct dialog_fatal_t
 {
     const char *title;
     const char *message;
+    bool modal;
 } dialog_fatal_t;
 
-VLC_EXPORT( void, dialog_Fatal, (vlc_object_t *, const char *, const char *, ...) ) LIBVLC_FORMAT(3, 4);
+VLC_EXPORT( void, dialog_VFatal, (vlc_object_t *, bool, const char *, const char *, va_list) );
+
+static inline LIBVLC_FORMAT(3, 4)
+void dialog_Fatal (vlc_object_t *obj, const char *title, const char *fmt, ...)
+{
+     va_list ap;
+
+     va_start (ap, fmt);
+     dialog_VFatal(obj, false, title, fmt, ap);
+     va_end (ap);
+}
 #define dialog_Fatal(o, t, ...) \
         dialog_Fatal(VLC_OBJECT(o), t, __VA_ARGS__)
 
+static inline LIBVLC_FORMAT(3, 4)
+void dialog_FatalWait (vlc_object_t *obj, const char *title,
+                       const char *fmt, ...){
+     va_list ap;
+
+     va_start (ap, fmt);
+     dialog_VFatal(obj, true, title, fmt, ap);
+     va_end (ap);
+}
+#define dialog_FatalWait(o, t, ...) \
+        dialog_FatalWait(VLC_OBJECT(o), t, __VA_ARGS__)
+
 VLC_EXPORT( int, dialog_Register, (vlc_object_t *) );
 VLC_EXPORT( int, dialog_Unregister, (vlc_object_t *) );
 #define dialog_Register(o) dialog_Register(VLC_OBJECT(o))
index 424f188449bff159a6dc0a16b6955c41648d9541..29a0466fa3869988610dad8983838313d4a4f50c 100644 (file)
@@ -92,9 +92,8 @@ static vlc_object_t *dialog_GetProvider (vlc_object_t *obj)
     return provider;
 }
 
-static
-void dialog_FatalVa (vlc_object_t *obj, const char *title,
-                     const char *fmt, va_list ap)
+void dialog_VFatal (vlc_object_t *obj, bool modal, const char *title,
+                    const char *fmt, va_list ap)
 {
     char *text;
 
@@ -112,22 +111,8 @@ void dialog_FatalVa (vlc_object_t *obj, const char *title,
     if (vasprintf (&text, fmt, ap) == -1)
         return;
 
-    dialog_fatal_t dialog = { title, text, };
+    dialog_fatal_t dialog = { title, text, modal, };
     var_SetAddress (provider, "dialog-fatal", &dialog);
     free (text);
     vlc_object_release (provider);
 }
-
-#undef dialog_Fatal
-/**
- * Notify the user of some fatal error.
- * This is a fire and forget function.
- */
-void dialog_Fatal (vlc_object_t *obj, const char *title, const char *fmt, ...)
-{
-    va_list ap;
-
-    va_start (ap, fmt);
-    dialog_FatalVa (obj, title, fmt, ap);
-    va_end (ap);
-}
index d46ecb0b642b54eac429d7f465fc1ab36baa8cd1..3e0edc27ed48a67c69b25e10f4116a79fff6ba26 100644 (file)
@@ -102,9 +102,9 @@ decode_URI_duplicate
 demux_PacketizerDestroy
 demux_PacketizerNew
 demux_vaControlHelper
-dialog_Fatal
 dialog_Register
 dialog_Unregister
+dialog_VFatal
 encode_URI_component
 EndMD5
 EnsureUTF8