source: win32/admin/PropLog.cpp @ abe53d3

Last change on this file since abe53d3 was abe53d3, checked in by Jelmer Vernooij <jelmer@…>, at 2005-11-07T16:42:49Z

More work on config manager

  • Property mode set to 100644
File size: 1.7 KB
Line 
1// PropLog.cpp : implementation file
2//
3
4#include "PropLog.h"
5
6#ifdef _DEBUG
7#define new DEBUG_NEW
8#undef THIS_FILE
9static char THIS_FILE[] = __FILE__;
10#endif
11
12/////////////////////////////////////////////////////////////////////////////
13// CPropLog dialog
14
15
16CPropLog::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
25void 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
34BEGIN_MESSAGE_MAP(CPropLog, CPropertyPage)
35        //{{AFX_MSG_MAP(CPropLog)
36        //}}AFX_MSG_MAP
37END_MESSAGE_MAP()
38
39/////////////////////////////////////////////////////////////////////////////
40// CPropLog message handlers
41
42static GList *log = NULL;
43
44extern "C" {
45void 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
51void 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
64BOOL 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}
Note: See TracBrowser for help on using the repository browser.