Mercurial > pidgin
annotate console/gntdebug.c @ 14802:4138063d89c9
[gaim-migrate @ 17567]
res_init build fix?
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 23 Oct 2006 19:05:14 +0000 |
parents | 07f572e08773 |
children | 8d1a1a6c57d9 |
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 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 static struct |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 GntWidget *window; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 GntWidget *tview; |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
43 gboolean paused; |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
44 gboolean timestamps; |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 } debug; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 static gboolean |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 debug_window_kpress_cb(GntWidget *wid, const char *key, GntTextView *view) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 if (key[0] == 27) |
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 (strcmp(key+1, GNT_KEY_DOWN) == 0) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 gnt_text_view_scroll(view, 1); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 else if (strcmp(key+1, GNT_KEY_UP) == 0) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 gnt_text_view_scroll(view, -1); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 else if (strcmp(key+1, GNT_KEY_PGDOWN) == 0) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 gnt_text_view_scroll(view, wid->priv.height - 2); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 else if (strcmp(key+1, GNT_KEY_PGUP) == 0) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 gnt_text_view_scroll(view, -(wid->priv.height - 2)); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 else |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 return FALSE; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 return TRUE; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 return FALSE; |
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 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 static void |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 gg_debug_print(GaimDebugLevel level, const char *category, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 const char *args) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 { |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
71 if (debug.window && !debug.paused) |
13983
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 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
|
74 GntTextFormatFlags flag = GNT_TEXT_FLAG_NORMAL; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
76 if (debug.timestamps) { |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
77 const char *mdate; |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
78 time_t mtime = time(NULL); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
79 mdate = gaim_utf8_strftime("%H:%M:%S ", localtime(&mtime)); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
80 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
|
81 mdate, flag); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
82 } |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
83 |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 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
|
85 category, GNT_TEXT_FLAG_BOLD); |
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 ": ", GNT_TEXT_FLAG_BOLD); |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
88 |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 switch (level) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 case GAIM_DEBUG_WARNING: |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 flag |= GNT_TEXT_FLAG_UNDERLINE; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 case GAIM_DEBUG_ERROR: |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 case GAIM_DEBUG_FATAL: |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
95 flag |= GNT_TEXT_FLAG_BOLD; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
96 break; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
97 default: |
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 } |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
100 |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
101 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
|
102 if (pos <= 1) |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
103 gnt_text_view_scroll(GNT_TEXT_VIEW(debug.tview), 0); |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
104 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
105 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
106 |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
107 static GaimDebugUiOps uiops = |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
108 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
109 gg_debug_print, |
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 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
112 GaimDebugUiOps *gg_debug_get_ui_ops() |
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 return &uiops; |
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 |
13985
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
117 static void |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
118 reset_debug_win(GntWidget *w, gpointer null) |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
119 { |
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
120 debug.window = debug.tview = 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 |
14125
7dfa024c1a4a
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
123 static void |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
124 clear_debug_win(GntWidget *w, GntTextView *tv) |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
125 { |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
126 gnt_text_view_clear(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 |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
129 static void |
14125
7dfa024c1a4a
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
130 print_stderr(const char *string) |
7dfa024c1a4a
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
131 { |
7dfa024c1a4a
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
132 g_printerr("%s", 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 |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
135 static void |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
136 toggle_pause(GntWidget *w, gpointer n) |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
137 { |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
138 debug.paused = !debug.paused; |
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 |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
141 static void |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
142 toggle_timestamps(GntWidget *w, gpointer n) |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
143 { |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
144 debug.timestamps = !debug.timestamps; |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
145 gaim_prefs_set_bool("/core/debug/timestamps", debug.timestamps); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
146 } |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
147 |
14709
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
148 /* Xerox */ |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
149 static void |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
150 gaim_glib_log_handler(const gchar *domain, GLogLevelFlags flags, |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
151 const gchar *msg, gpointer user_data) |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
152 { |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
153 GaimDebugLevel level; |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
154 char *new_msg = NULL; |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
155 char *new_domain = NULL; |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
156 |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
157 if ((flags & G_LOG_LEVEL_ERROR) == G_LOG_LEVEL_ERROR) |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
158 level = GAIM_DEBUG_ERROR; |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
159 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
|
160 level = GAIM_DEBUG_FATAL; |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
161 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
|
162 level = GAIM_DEBUG_WARNING; |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
163 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
|
164 level = GAIM_DEBUG_INFO; |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
165 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
|
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_DEBUG) == G_LOG_LEVEL_DEBUG) |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
168 level = GAIM_DEBUG_MISC; |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
169 else |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
170 { |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
171 gaim_debug_warning("gntdebug", |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
172 "Unknown glib logging level in %d\n", flags); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
173 |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
174 level = GAIM_DEBUG_MISC; /* This will never happen. */ |
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 |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
177 if (msg != NULL) |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
178 new_msg = gaim_utf8_try_convert(msg); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
179 |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
180 if (domain != NULL) |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
181 new_domain = gaim_utf8_try_convert(domain); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
182 |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
183 if (new_msg != NULL) |
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 gaim_debug(level, (new_domain != NULL ? new_domain : "g_log"), |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
186 "%s\n", new_msg); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
187 |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
188 g_free(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 |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
191 g_free(new_domain); |
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 |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
194 void gg_debug_window_show() |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
195 { |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
196 debug.paused = false; |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
197 debug.timestamps = gaim_prefs_get_bool("/core/debug/timestamps"); |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
198 if (debug.window == NULL) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
199 { |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
200 GntWidget *wid, *box; |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
201 debug.window = gnt_vbox_new(FALSE); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 gnt_box_set_toplevel(GNT_BOX(debug.window), TRUE); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
203 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
|
204 gnt_box_set_pad(GNT_BOX(debug.window), 0); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
205 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
|
206 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
207 debug.tview = gnt_text_view_new(); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
208 gnt_box_add_widget(GNT_BOX(debug.window), debug.tview); |
13985
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
209 |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
210 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
|
211 |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
212 box = gnt_hbox_new(FALSE); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
213 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
|
214 gnt_box_set_fill(GNT_BOX(box), FALSE); |
14693
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
215 |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
216 /* 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
|
217 * 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
|
218 * 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
|
219 */ |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
220 wid = gnt_button_new(_("Clear")); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
221 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
|
222 GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
223 gnt_box_add_widget(GNT_BOX(box), wid); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
224 |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
225 wid = gnt_check_box_new(_("Pause")); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
226 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
|
227 GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
228 gnt_box_add_widget(GNT_BOX(box), wid); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
229 |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
230 wid = gnt_check_box_new(_("Timestamps")); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
231 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
|
232 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
|
233 GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
234 gnt_box_add_widget(GNT_BOX(box), wid); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
235 |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
236 gnt_box_add_widget(GNT_BOX(debug.window), box); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
237 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_GROW_Y); |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
238 |
ae0136b0a3ae
[gaim-migrate @ 17445]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14558
diff
changeset
|
239 gnt_widget_set_name(debug.window, "debug-window"); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
240 |
13985
a7b1d2ab9cb0
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
241 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
|
242 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
|
243 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
244 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
245 gnt_widget_show(debug.window); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
246 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
247 |
14274
43d9afee9c3c
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
248 static gboolean |
43d9afee9c3c
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
249 start_with_debugwin(gpointer null) |
43d9afee9c3c
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
250 { |
43d9afee9c3c
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
251 gg_debug_window_show(); |
43d9afee9c3c
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
252 return FALSE; |
43d9afee9c3c
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
253 } |
43d9afee9c3c
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
254 |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
255 void gg_debug_init() |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
256 { |
14709
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
257 /* Xerox */ |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
258 #define REGISTER_G_LOG_HANDLER(name) \ |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
259 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
|
260 | G_LOG_FLAG_RECURSION, \ |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
261 gaim_glib_log_handler, NULL) |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
262 |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
263 /* Register the glib log handlers. */ |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
264 REGISTER_G_LOG_HANDLER(NULL); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
265 REGISTER_G_LOG_HANDLER("GLib"); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
266 REGISTER_G_LOG_HANDLER("GModule"); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
267 REGISTER_G_LOG_HANDLER("GLib-GObject"); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
268 REGISTER_G_LOG_HANDLER("GThread"); |
3b5c732458ec
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14693
diff
changeset
|
269 |
14125
7dfa024c1a4a
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
270 g_set_print_handler(print_stderr); /* Redirect the debug messages to stderr */ |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13985
diff
changeset
|
271 if (gaim_debug_is_enabled()) |
14274
43d9afee9c3c
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
272 g_timeout_add(0, start_with_debugwin, NULL); |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
273 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
274 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
275 void gg_debug_uninit() |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
276 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
277 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
278 |