Mercurial > pidgin
annotate console/gntdebug.c @ 14984:fb98e9c45607
[gaim-migrate @ 17763]
Fix a crash, plug a leak.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Fri, 17 Nov 2006 02:15:28 +0000 |
parents | c01f62c83647 |
children | 233c4a2f7b77 |
rev | line source |
---|---|
14558
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
1 /** |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
2 * @file gntdebug.c GNT Debug API |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
3 * @ingroup gntui |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
4 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
5 * gaim |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
6 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
7 * Gaim is the legal property of its developers, whose names are too numerous |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
8 * to list here. Please refer to the COPYRIGHT file distributed with this |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
9 * source distribution. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
10 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
11 * This program is free software; you can redistribute it and/or modify |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
12 * it under the terms of the GNU General Public License as published by |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
13 * the Free Software Foundation; either version 2 of the License, or |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
14 * (at your option) any later version. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
15 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
16 * This program is distributed in the hope that it will be useful, |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
19 * GNU General Public License for more details. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
20 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
21 * You should have received a copy of the GNU General Public License |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
22 * along with this program; if not, write to the Free Software |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14274
diff
changeset
|
24 */ |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 #include <gnt.h> |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 #include <gntbox.h> |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 #include <gnttextview.h> |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
28 #include <gntbutton.h> |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
29 #include <gntcheckbox.h> |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
30 #include <gntline.h> |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 #include "gntdebug.h" |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 #include "gntgaim.h" |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
34 #include "util.h" |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 #include <stdio.h> |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 #include <string.h> |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 |
14861
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
39 #define PREF_ROOT "/gaim/gnt/debug" |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
40 |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 static struct |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 GntWidget *window; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 GntWidget *tview; |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
45 gboolean paused; |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
46 gboolean timestamps; |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 } debug; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 static gboolean |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 debug_window_kpress_cb(GntWidget *wid, const char *key, GntTextView *view) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 if (key[0] == 27) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 { |
14877
c01f62c83647
[gaim-migrate @ 17646]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14861
diff
changeset
|
54 if (strcmp(key, GNT_KEY_DOWN) == 0) |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 gnt_text_view_scroll(view, 1); |
14877
c01f62c83647
[gaim-migrate @ 17646]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14861
diff
changeset
|
56 else if (strcmp(key, GNT_KEY_UP) == 0) |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 gnt_text_view_scroll(view, -1); |
14877
c01f62c83647
[gaim-migrate @ 17646]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14861
diff
changeset
|
58 else if (strcmp(key, GNT_KEY_PGDOWN) == 0) |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 gnt_text_view_scroll(view, wid->priv.height - 2); |
14877
c01f62c83647
[gaim-migrate @ 17646]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14861
diff
changeset
|
60 else if (strcmp(key, GNT_KEY_PGUP) == 0) |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 gnt_text_view_scroll(view, -(wid->priv.height - 2)); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 else |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 return FALSE; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 return TRUE; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 return FALSE; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 static void |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 gg_debug_print(GaimDebugLevel level, const char *category, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 const char *args) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 { |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
73 if (debug.window && !debug.paused) |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 { |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
75 int pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(debug.tview)); |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 GntTextFormatFlags flag = GNT_TEXT_FLAG_NORMAL; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
78 if (debug.timestamps) { |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
79 const char *mdate; |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
80 time_t mtime = time(NULL); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
81 mdate = gaim_utf8_strftime("%H:%M:%S ", localtime(&mtime)); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
82 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
83 mdate, flag); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
84 } |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
85 |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 category, GNT_TEXT_FLAG_BOLD); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 ": ", GNT_TEXT_FLAG_BOLD); |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
90 |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 switch (level) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 case GAIM_DEBUG_WARNING: |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 flag |= GNT_TEXT_FLAG_UNDERLINE; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
95 case GAIM_DEBUG_ERROR: |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
96 case GAIM_DEBUG_FATAL: |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
97 flag |= GNT_TEXT_FLAG_BOLD; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
98 break; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
99 default: |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
100 break; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
101 } |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
102 |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
103 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), args, flag); |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
104 if (pos <= 1) |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
105 gnt_text_view_scroll(GNT_TEXT_VIEW(debug.tview), 0); |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
106 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
107 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
108 |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
109 static GaimDebugUiOps uiops = |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
110 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
111 gg_debug_print, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
112 }; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
113 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
114 GaimDebugUiOps *gg_debug_get_ui_ops() |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
115 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
116 return &uiops; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
117 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
118 |
13985
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
119 static void |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
120 reset_debug_win(GntWidget *w, gpointer null) |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
121 { |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
122 debug.window = debug.tview = NULL; |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
123 } |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
124 |
14125
7dfa024c1a4a
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
125 static void |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
126 clear_debug_win(GntWidget *w, GntTextView *tv) |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
127 { |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
128 gnt_text_view_clear(tv); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
129 } |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
130 |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
131 static void |
14125
7dfa024c1a4a
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
132 print_stderr(const char *string) |
7dfa024c1a4a
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
133 { |
7dfa024c1a4a
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
134 g_printerr("%s", string); |
7dfa024c1a4a
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
135 } |
7dfa024c1a4a
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
136 |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
137 static void |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
138 toggle_pause(GntWidget *w, gpointer n) |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
139 { |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
140 debug.paused = !debug.paused; |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
141 } |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
142 |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
143 static void |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
144 toggle_timestamps(GntWidget *w, gpointer n) |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
145 { |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
146 debug.timestamps = !debug.timestamps; |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
147 gaim_prefs_set_bool("/core/debug/timestamps", debug.timestamps); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
148 } |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
149 |
14709
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
150 /* Xerox */ |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
151 static void |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
152 gaim_glib_log_handler(const gchar *domain, GLogLevelFlags flags, |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
153 const gchar *msg, gpointer user_data) |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
154 { |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
155 GaimDebugLevel level; |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
156 char *new_msg = NULL; |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
157 char *new_domain = NULL; |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
158 |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
159 if ((flags & G_LOG_LEVEL_ERROR) == G_LOG_LEVEL_ERROR) |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
160 level = GAIM_DEBUG_ERROR; |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
161 else if ((flags & G_LOG_LEVEL_CRITICAL) == G_LOG_LEVEL_CRITICAL) |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
162 level = GAIM_DEBUG_FATAL; |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
163 else if ((flags & G_LOG_LEVEL_WARNING) == G_LOG_LEVEL_WARNING) |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
164 level = GAIM_DEBUG_WARNING; |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
165 else if ((flags & G_LOG_LEVEL_MESSAGE) == G_LOG_LEVEL_MESSAGE) |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
166 level = GAIM_DEBUG_INFO; |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
167 else if ((flags & G_LOG_LEVEL_INFO) == G_LOG_LEVEL_INFO) |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
168 level = GAIM_DEBUG_INFO; |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
169 else if ((flags & G_LOG_LEVEL_DEBUG) == G_LOG_LEVEL_DEBUG) |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
170 level = GAIM_DEBUG_MISC; |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
171 else |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
172 { |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
173 gaim_debug_warning("gntdebug", |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
174 "Unknown glib logging level in %d\n", flags); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
175 |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
176 level = GAIM_DEBUG_MISC; /* This will never happen. */ |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
177 } |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
178 |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
179 if (msg != NULL) |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
180 new_msg = gaim_utf8_try_convert(msg); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
181 |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
182 if (domain != NULL) |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
183 new_domain = gaim_utf8_try_convert(domain); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
184 |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
185 if (new_msg != NULL) |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
186 { |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
187 gaim_debug(level, (new_domain != NULL ? new_domain : "g_log"), |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
188 "%s\n", new_msg); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
189 |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
190 g_free(new_msg); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
191 } |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
192 |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
193 g_free(new_domain); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
194 } |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
195 |
14861
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
196 static void |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
197 size_changed_cb(GntWidget *widget, int oldw, int oldh) |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
198 { |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
199 int w, h; |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
200 gnt_widget_get_size(widget, &w, &h); |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
201 gaim_prefs_set_int(PREF_ROOT "/size/width", w); |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
202 gaim_prefs_set_int(PREF_ROOT "/size/height", h); |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
203 } |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
204 |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
205 void gg_debug_window_show() |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
206 { |
14844
8d1a1a6c57d9
[gaim-migrate @ 17613]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14713
diff
changeset
|
207 debug.paused = FALSE; |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
208 debug.timestamps = gaim_prefs_get_bool("/core/debug/timestamps"); |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
209 if (debug.window == NULL) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
210 { |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
211 GntWidget *wid, *box; |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
212 debug.window = gnt_vbox_new(FALSE); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
213 gnt_box_set_toplevel(GNT_BOX(debug.window), TRUE); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
214 gnt_box_set_title(GNT_BOX(debug.window), _("Debug Window")); |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
215 gnt_box_set_pad(GNT_BOX(debug.window), 0); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
216 gnt_box_set_alignment(GNT_BOX(debug.window), GNT_ALIGN_MID); |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
217 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
218 debug.tview = gnt_text_view_new(); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
219 gnt_box_add_widget(GNT_BOX(debug.window), debug.tview); |
14861
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
220 gnt_widget_set_size(debug.tview, |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
221 gaim_prefs_get_int(PREF_ROOT "/size/width"), |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
222 gaim_prefs_get_int(PREF_ROOT "/size/height")); |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
223 g_signal_connect(G_OBJECT(debug.tview), "size_changed", G_CALLBACK(size_changed_cb), NULL); |
13985
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
224 |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
225 gnt_box_add_widget(GNT_BOX(debug.window), gnt_line_new(FALSE)); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
226 |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
227 box = gnt_hbox_new(FALSE); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
228 gnt_box_set_alignment(GNT_BOX(box), GNT_ALIGN_MID); |
14713
07f572e08773
[gaim-migrate @ 17467]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14709
diff
changeset
|
229 gnt_box_set_fill(GNT_BOX(box), FALSE); |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
230 |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
231 /* XXX: Setting the GROW_Y for the following widgets don't make sense. But right now |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
232 * it's necessary to make the width of the debug window resizable ... like I said, |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
233 * it doesn't make sense. The bug is likely in the packing in gntbox.c. |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
234 */ |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
235 wid = gnt_button_new(_("Clear")); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
236 g_signal_connect(G_OBJECT(wid), "activate", G_CALLBACK(clear_debug_win), debug.tview); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
237 GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
238 gnt_box_add_widget(GNT_BOX(box), wid); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
239 |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
240 wid = gnt_check_box_new(_("Pause")); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
241 g_signal_connect(G_OBJECT(wid), "toggled", G_CALLBACK(toggle_pause), NULL); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
242 GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
243 gnt_box_add_widget(GNT_BOX(box), wid); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
244 |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
245 wid = gnt_check_box_new(_("Timestamps")); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
246 gnt_check_box_set_checked(GNT_CHECK_BOX(wid), debug.timestamps); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
247 g_signal_connect(G_OBJECT(wid), "toggled", G_CALLBACK(toggle_timestamps), NULL); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
248 GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
249 gnt_box_add_widget(GNT_BOX(box), wid); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
250 |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
251 gnt_box_add_widget(GNT_BOX(debug.window), box); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
252 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_GROW_Y); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
253 |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
254 gnt_widget_set_name(debug.window, "debug-window"); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
255 |
13985
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
256 g_signal_connect(G_OBJECT(debug.window), "destroy", G_CALLBACK(reset_debug_win), NULL); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
257 g_signal_connect(G_OBJECT(debug.window), "key_pressed", G_CALLBACK(debug_window_kpress_cb), debug.tview); |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
258 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
259 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
260 gnt_widget_show(debug.window); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
261 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
262 |
14274
43d9afee9c3c
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
263 static gboolean |
43d9afee9c3c
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
264 start_with_debugwin(gpointer null) |
43d9afee9c3c
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
265 { |
43d9afee9c3c
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
266 gg_debug_window_show(); |
43d9afee9c3c
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
267 return FALSE; |
43d9afee9c3c
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
268 } |
43d9afee9c3c
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
269 |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
270 void gg_debug_init() |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
271 { |
14709
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
272 /* Xerox */ |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
273 #define REGISTER_G_LOG_HANDLER(name) \ |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
274 g_log_set_handler((name), G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL \ |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
275 | G_LOG_FLAG_RECURSION, \ |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
276 gaim_glib_log_handler, NULL) |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
277 |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
278 /* Register the glib log handlers. */ |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
279 REGISTER_G_LOG_HANDLER(NULL); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
280 REGISTER_G_LOG_HANDLER("GLib"); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
281 REGISTER_G_LOG_HANDLER("GModule"); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
282 REGISTER_G_LOG_HANDLER("GLib-GObject"); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
283 REGISTER_G_LOG_HANDLER("GThread"); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
284 |
14125
7dfa024c1a4a
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
285 g_set_print_handler(print_stderr); /* Redirect the debug messages to stderr */ |
14861
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
286 |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
287 gaim_prefs_add_none(PREF_ROOT); |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
288 gaim_prefs_add_none(PREF_ROOT "/size"); |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
289 gaim_prefs_add_int(PREF_ROOT "/size/width", 60); |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
290 gaim_prefs_add_int(PREF_ROOT "/size/height", 15); |
dd2ef00759a7
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14844
diff
changeset
|
291 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13985
diff
changeset
|
292 if (gaim_debug_is_enabled()) |
14274
43d9afee9c3c
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
293 g_timeout_add(0, start_with_debugwin, NULL); |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
294 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
295 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
296 void gg_debug_uninit() |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
297 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
298 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
299 |