[d1d6776] | 1 | // PropLog.cpp : implementation file |
---|
| 2 | // |
---|
[abe53d3] | 3 | |
---|
[d1d6776] | 4 | #include "PropLog.h" |
---|
| 5 | |
---|
| 6 | #ifdef _DEBUG |
---|
| 7 | #define new DEBUG_NEW |
---|
| 8 | #undef THIS_FILE |
---|
| 9 | static char THIS_FILE[] = __FILE__; |
---|
| 10 | #endif |
---|
| 11 | |
---|
| 12 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 13 | // CPropLog dialog |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | CPropLog::CPropLog() |
---|
| 17 | : CPropertyPage(CPropLog::IDD) |
---|
| 18 | { |
---|
| 19 | //{{AFX_DATA_INIT(CPropLog) |
---|
| 20 | // NOTE: the ClassWizard will add member initialization here |
---|
| 21 | //}}AFX_DATA_INIT |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | void CPropLog::DoDataExchange(CDataExchange* pDX) |
---|
| 26 | { |
---|
| 27 | CPropertyPage::DoDataExchange(pDX); |
---|
| 28 | //{{AFX_DATA_MAP(CPropLog) |
---|
| 29 | DDX_Control(pDX, IDC_LOG, m_log); |
---|
| 30 | //}}AFX_DATA_MAP |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | BEGIN_MESSAGE_MAP(CPropLog, CPropertyPage) |
---|
| 35 | //{{AFX_MSG_MAP(CPropLog) |
---|
| 36 | //}}AFX_MSG_MAP |
---|
| 37 | END_MESSAGE_MAP() |
---|
| 38 | |
---|
| 39 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 40 | // CPropLog message handlers |
---|
| 41 | |
---|
| 42 | static GList *log = NULL; |
---|
| 43 | |
---|
| 44 | extern "C" { |
---|
| 45 | void glib_logger (const gchar *log_domain, GLogLevelFlags log_level, const gchar *msg, gpointer user_data) |
---|
| 46 | { |
---|
| 47 | log = g_list_append(log, g_strdup_printf("%s: %s", log_domain, msg)); |
---|
| 48 | } |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | void log_message(int level, char *message, ... ) { |
---|
| 52 | #define LOG_MAXLEN 300 |
---|
| 53 | va_list ap; |
---|
| 54 | va_start(ap, message); |
---|
| 55 | char *msg = (char *)g_malloc(LOG_MAXLEN); |
---|
| 56 | g_vsnprintf(msg, LOG_MAXLEN, message, ap); |
---|
| 57 | va_end(ap); |
---|
| 58 | log = g_list_append(log, msg); |
---|
| 59 | if(level == LOGLVL_ERROR) ::MessageBox(NULL, msg, "Bitlbee", MB_OK | MB_ICONINFORMATION); |
---|
| 60 | TRACE("%d: %s\n", level, msg); |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | BOOL CPropLog::OnInitDialog() |
---|
| 65 | { |
---|
| 66 | CPropertyPage::OnInitDialog(); |
---|
| 67 | |
---|
| 68 | m_log.ResetContent(); |
---|
| 69 | GList *gl = log; |
---|
| 70 | while(gl) { |
---|
| 71 | char *d = (char *)gl->data; |
---|
| 72 | m_log.AddString(d); |
---|
| 73 | gl = gl->next; |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | return TRUE; // return TRUE unless you set the focus to a control |
---|
| 77 | // EXCEPTION: OCX Property Pages should return FALSE |
---|
| 78 | } |
---|