1 /* -*- c-basic-offset:2; tab-width:2; indent-tabs-mode:nil -*- */
2 
3 #include "bl_dialog.h"
4 
5 #include "bl_debug.h"
6 
7 /* --- static variables --- */
8 
9 static int (*callback)(bl_dialog_style_t, const char *);
10 
11 /* --- global functions --- */
12 
bl_dialog_set_callback(int (* cb)(bl_dialog_style_t,const char *))13 void bl_dialog_set_callback(int (*cb)(bl_dialog_style_t, const char *)) {
14   callback = cb;
15 }
16 
17 #if 0
18 int bl_dialog_set_exec_file(bl_dialog_style_t style, const char *path) { return 1; }
19 #endif
20 
bl_dialog(bl_dialog_style_t style,const char * msg)21 int bl_dialog(bl_dialog_style_t style, const char *msg) {
22   int ret;
23 
24   if (callback && (ret = (*callback)(style, msg)) != -1) {
25     return ret;
26   } else {
27     bl_msg_printf("%s\n", msg);
28 
29     return -1;
30   }
31 }
32