BEAST/BSE - Better Audio System and Sound Engine  0.8.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
bstusermessage.hh
Go to the documentation of this file.
00001  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
00002 #ifndef __BST_USER_MESSAGE_H__
00003 #define __BST_USER_MESSAGE_H__
00004 #include        "bstutils.hh"
00005 G_BEGIN_DECLS
00006 
00007 /* --- structures --- */
00008 typedef enum {
00009   BST_MSG_ERROR         = Bse::ERROR,
00010   BST_MSG_WARNING       = Bse::WARNING,
00011   BST_MSG_INFO          = Bse::INFO,
00012   BST_MSG_DEBUG         = Bse::DEBUG,
00013   BST_MSG_SCRIPT,
00014 } BstMsgType;
00015 const char* bst_msg_type_ident (BstMsgType);
00016 
00017 typedef struct {
00018   guint             id;
00019   gchar            *text;
00020   gchar            *stock_icon;
00021   gchar            *options;
00022 } BstMsgBit;
00023 typedef struct {
00024   const char    *log_domain;
00025   BstMsgType     type;
00026   const char    *ident;         /* type identifier */
00027   const char    *label;         /* type label (translated) */
00028   const char    *title;
00029   const char    *primary;
00030   const char    *secondary;
00031   const char    *details;
00032   const char    *config_check;
00033   SfiProxy       janitor;
00034   const char    *process;
00035   guint          pid;
00036   guint          n_msg_bits;
00037   BstMsgBit    **msg_bits;
00038 } BstMessage;
00039 
00040 typedef struct {
00041   guint        type;
00042   const gchar *ident;
00043   const gchar *label; /* maybe NULL */
00044 } BstMsgID;
00045 
00046 /* --- prototypes --- */
00047 void              bst_message_connect_to_server (void);
00048 void              bst_message_dialogs_popdown   (void);
00049 guint             bst_message_handler           (const BstMessage       *message);
00050 guint             bst_message_dialog_display    (const char             *log_domain,
00051                                                  BstMsgType              type,
00052                                                  guint                   n_bits,
00053                                                  BstMsgBit             **bits);
00054 void              bst_msg_bit_free              (BstMsgBit              *mbit);
00055 #define           bst_msg_bit_printf(msg_part_id, ...)  bst_msg_bit_create (msg_part_id, Rapicorn::string_format (__VA_ARGS__))
00056 BstMsgBit*        bst_msg_bit_create            (guint8 msg_part_id, const std::string &text);
00057 BstMsgBit*        bst_msg_bit_create_choice     (guint                   id,
00058                                                  const gchar            *name,
00059                                                  const gchar            *stock_icon,
00060                                                  const gchar            *options);
00061 #define           bst_msg_dialog(level, ...)    BST_MSG_DIALOG (level, __VA_ARGS__)
00062 /* SFI message bit equivalents */
00063 #define BST_MSG_TEXT0(...)                      bst_msg_bit_printf ('0', __VA_ARGS__)
00064 #define BST_MSG_TEXT1(...)                      bst_msg_bit_printf ('1', __VA_ARGS__)
00065 #define BST_MSG_TEXT2(...)                      bst_msg_bit_printf ('2', __VA_ARGS__)
00066 #define BST_MSG_TEXT3(...)                      bst_msg_bit_printf ('3', __VA_ARGS__)
00067 #define BST_MSG_CHECK(...)                      bst_msg_bit_printf ('c', __VA_ARGS__)
00068 #define BST_MSG_TITLE                           BST_MSG_TEXT0 /* alias */
00069 #define BST_MSG_PRIMARY                         BST_MSG_TEXT1 /* alias */
00070 #define BST_MSG_SECONDARY                       BST_MSG_TEXT2 /* alias */
00071 #define BST_MSG_DETAIL                          BST_MSG_TEXT3 /* alias */
00072 /* BST specific message bits */
00073 #define BST_MSG_CHOICE(id, name, stock_icon)    bst_msg_bit_create_choice (id, name, stock_icon, "C")          /* choice */
00074 #define BST_MSG_CHOICE_D(id, name, stock_icon)  bst_msg_bit_create_choice (id, name, stock_icon, "D")          /* default */
00075 #define BST_MSG_CHOICE_S(id, name, sticn, sens) bst_msg_bit_create_choice (id, name, sticn, (sens) ? "" : "I") /* insensitive */
00076 #define BST_MSG_DIALOG(lvl, ...)                ({ BstMsgType __mt = lvl; uint __result = 0;                  \
00077                                                    BstMsgBit *__ba[] = { __VA_ARGS__ };                       \
00078                                                    __result = bst_message_dialog_display ("BEAST",  \
00079                                                                __mt, RAPICORN_ARRAY_SIZE (__ba), __ba);         \
00080                                                    __result; })
00081 
00082 G_END_DECLS
00083 
00084 #endif  /* __BST_USER_MESSAGE_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines