Mercurial > pidgin.yaz
annotate src/gtkdebug.c @ 5527:166ed121e555
[gaim-migrate @ 5927]
Ambrose LI (acli) updated the traditional Chinese (zh_TW) translation
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Mon, 26 May 2003 04:26:24 +0000 |
parents | 908f3d9ee660 |
children | 2c4c975620f0 |
rev | line source |
---|---|
5212 | 1 /** |
2 * @file gtkdebug.c GTK+ Debug API | |
3 * @ingroup gtkui | |
4 * | |
5 * gaim | |
6 * | |
7 * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org> | |
8 * | |
9 * This program is free software; you can redistribute it and/or modify | |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 */ | |
23 #include "gtkdebug.h" | |
24 #include "gaim.h" | |
25 #include "gtkimhtml.h" | |
26 #include <gtk/gtk.h> | |
27 | |
28 typedef struct | |
29 { | |
30 GtkWidget *window; | |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
31 GtkWidget *text; |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
32 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
33 gboolean timestamps; |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
34 gboolean paused; |
5212 | 35 |
36 } DebugWindow; | |
37 | |
38 static char debug_fg_colors[][8] = { | |
39 "#000000", /**< All debug levels. */ | |
40 "#666666", /**< Blather. */ | |
41 "#000000", /**< Information. */ | |
42 "#660000", /**< Warnings. */ | |
43 "#FF0000", /**< Errors. */ | |
44 "#FF0000", /**< Fatal errors. */ | |
45 }; | |
46 | |
47 static DebugWindow *debug_win = NULL; | |
48 | |
49 static gint | |
50 debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused) | |
51 { | |
52 g_free(debug_win); | |
53 debug_win = NULL; | |
54 | |
55 if (misc_options & OPT_MISC_DEBUG) | |
56 misc_options ^= OPT_MISC_DEBUG; | |
57 | |
58 save_prefs(); | |
59 | |
60 return FALSE; | |
61 } | |
62 | |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
63 static void |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
64 __clear_cb(GtkWidget *w, DebugWindow *win) |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
65 { |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
66 gtk_imhtml_clear(GTK_IMHTML(win->text)); |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
67 } |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
68 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
69 static void |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
70 __pause_cb(GtkWidget *w, DebugWindow *win) |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
71 { |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
72 win->paused = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
73 } |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
74 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
75 static void |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
76 __timestamps_cb(GtkWidget *w, DebugWindow *win) |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
77 { |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
78 win->timestamps = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
79 } |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
80 |
5212 | 81 static DebugWindow * |
82 debug_window_new(void) | |
83 { | |
84 DebugWindow *win; | |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
85 GtkWidget *vbox; |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
86 GtkWidget *toolbar; |
5212 | 87 GtkWidget *sw; |
88 | |
89 win = g_new0(DebugWindow, 1); | |
90 | |
91 GAIM_DIALOG(win->window); | |
92 gtk_window_set_default_size(GTK_WINDOW(win->window), 500, 200); | |
93 gtk_window_set_role(GTK_WINDOW(win->window), "debug"); | |
94 gtk_window_set_title(GTK_WINDOW(win->window), _("Debug Window")); | |
95 | |
96 g_signal_connect(G_OBJECT(win->window), "delete_event", | |
97 G_CALLBACK(debug_window_destroy), NULL); | |
98 | |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
99 /* Setup the vbox */ |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
100 vbox = gtk_vbox_new(FALSE, 0); |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
101 gtk_container_add(GTK_CONTAINER(win->window), vbox); |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
102 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
103 /* Setup our top button bar thingie. */ |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
104 toolbar = gtk_toolbar_new(); |
5429
7d1a44cbd347
[gaim-migrate @ 5809]
Christian Hammond <chipx86@chipx86.com>
parents:
5428
diff
changeset
|
105 gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH_HORIZ); |
7d1a44cbd347
[gaim-migrate @ 5809]
Christian Hammond <chipx86@chipx86.com>
parents:
5428
diff
changeset
|
106 gtk_toolbar_set_icon_size(GTK_TOOLBAR(toolbar), |
7d1a44cbd347
[gaim-migrate @ 5809]
Christian Hammond <chipx86@chipx86.com>
parents:
5428
diff
changeset
|
107 GTK_ICON_SIZE_SMALL_TOOLBAR); |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
108 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
109 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
110 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
111 #if 0 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
112 /* Find button */ |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
113 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_FIND, |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
114 NULL, NULL, NULL, NULL, -1); |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
115 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
116 /* Save */ |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
117 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_SAVE, |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
118 NULL, NULL, NULL, NULL, -1); |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
119 #endif |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
120 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
121 /* Clear button */ |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
122 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_CLEAR, |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
123 NULL, NULL, G_CALLBACK(__clear_cb), win, -1); |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
124 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
125 gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
126 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
127 /* Pause */ |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
128 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
129 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
130 _("Pause"), NULL, NULL, |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
131 NULL, G_CALLBACK(__pause_cb), win); |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
132 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
133 /* Timestamps */ |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
134 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
135 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
136 _("Timestamps"), NULL, NULL, |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
137 NULL, G_CALLBACK(__timestamps_cb), win); |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
138 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
139 /* Now our scrolled window... */ |
5212 | 140 sw = gtk_scrolled_window_new(NULL, NULL); |
141 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
142 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
143 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
144 GTK_SHADOW_IN); |
5212 | 145 |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
146 /* ... which has a gtkimhtml in it. */ |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
147 win->text = gtk_imhtml_new(NULL, NULL); |
5212 | 148 |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
149 gtk_container_add(GTK_CONTAINER(sw), win->text); |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
150 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
151 /* Pack it in... Not like that, sicko. */ |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
152 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
153 |
5212 | 154 gtk_widget_show_all(win->window); |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
155 |
5212 | 156 return win; |
157 } | |
158 | |
159 void | |
160 gaim_gtk_debug_window_show(void) | |
161 { | |
162 if (debug_win == NULL) | |
163 debug_win = debug_window_new(); | |
164 | |
165 gtk_widget_show(debug_win->window); | |
166 } | |
167 | |
168 void | |
169 gaim_gtk_debug_window_hide(void) | |
170 { | |
171 if (debug_win != NULL) { | |
172 gtk_widget_destroy(debug_win->window); | |
173 debug_window_destroy(NULL, NULL, NULL); | |
174 } | |
175 } | |
176 | |
177 static void | |
178 gaim_gtk_debug_print(GaimDebugLevel level, const char *category, | |
179 const char *format, va_list args) | |
180 { | |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
181 gchar *arg_s; |
5212 | 182 |
183 arg_s = g_strdup_vprintf(format, args); | |
184 | |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
185 if ((misc_options & OPT_MISC_DEBUG) && |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
186 debug_win != NULL && !debug_win->paused) { |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
187 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
188 gchar *esc_s, *cat_s, *ts_s, *s; |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
189 |
5430
908f3d9ee660
[gaim-migrate @ 5810]
Christian Hammond <chipx86@chipx86.com>
parents:
5429
diff
changeset
|
190 if (category == NULL) { |
5212 | 191 cat_s = g_strdup(""); |
5430
908f3d9ee660
[gaim-migrate @ 5810]
Christian Hammond <chipx86@chipx86.com>
parents:
5429
diff
changeset
|
192 ts_s = g_strdup(""); |
908f3d9ee660
[gaim-migrate @ 5810]
Christian Hammond <chipx86@chipx86.com>
parents:
5429
diff
changeset
|
193 } |
908f3d9ee660
[gaim-migrate @ 5810]
Christian Hammond <chipx86@chipx86.com>
parents:
5429
diff
changeset
|
194 else { |
5212 | 195 cat_s = g_strdup_printf("<b>%s:</b> ", category); |
196 | |
5430
908f3d9ee660
[gaim-migrate @ 5810]
Christian Hammond <chipx86@chipx86.com>
parents:
5429
diff
changeset
|
197 /* |
908f3d9ee660
[gaim-migrate @ 5810]
Christian Hammond <chipx86@chipx86.com>
parents:
5429
diff
changeset
|
198 * If the category is not NULL, then do timestamps. |
908f3d9ee660
[gaim-migrate @ 5810]
Christian Hammond <chipx86@chipx86.com>
parents:
5429
diff
changeset
|
199 * This IS right. :) |
908f3d9ee660
[gaim-migrate @ 5810]
Christian Hammond <chipx86@chipx86.com>
parents:
5429
diff
changeset
|
200 */ |
908f3d9ee660
[gaim-migrate @ 5810]
Christian Hammond <chipx86@chipx86.com>
parents:
5429
diff
changeset
|
201 if (debug_win->timestamps) { |
908f3d9ee660
[gaim-migrate @ 5810]
Christian Hammond <chipx86@chipx86.com>
parents:
5429
diff
changeset
|
202 gchar mdate[64]; |
908f3d9ee660
[gaim-migrate @ 5810]
Christian Hammond <chipx86@chipx86.com>
parents:
5429
diff
changeset
|
203 time_t mtime = time(NULL); |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
204 |
5430
908f3d9ee660
[gaim-migrate @ 5810]
Christian Hammond <chipx86@chipx86.com>
parents:
5429
diff
changeset
|
205 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
206 |
5430
908f3d9ee660
[gaim-migrate @ 5810]
Christian Hammond <chipx86@chipx86.com>
parents:
5429
diff
changeset
|
207 ts_s = g_strdup_printf("(%s) ", mdate); |
908f3d9ee660
[gaim-migrate @ 5810]
Christian Hammond <chipx86@chipx86.com>
parents:
5429
diff
changeset
|
208 } |
908f3d9ee660
[gaim-migrate @ 5810]
Christian Hammond <chipx86@chipx86.com>
parents:
5429
diff
changeset
|
209 else |
908f3d9ee660
[gaim-migrate @ 5810]
Christian Hammond <chipx86@chipx86.com>
parents:
5429
diff
changeset
|
210 ts_s = g_strdup(""); |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
211 } |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
212 |
5212 | 213 esc_s = g_markup_escape_text(arg_s, -1); |
214 | |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
215 s = g_strdup_printf("<font color=\"%s\">%s%s%s</font>", |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
216 debug_fg_colors[level], ts_s, cat_s, esc_s); |
5212 | 217 |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
218 g_free(ts_s); |
5212 | 219 g_free(esc_s); |
220 | |
221 if (level == GAIM_DEBUG_FATAL) { | |
222 gchar *temp = s; | |
223 | |
224 s = g_strdup_printf("<b>%s</b>", temp); | |
225 g_free(temp); | |
226 } | |
227 | |
228 g_free(cat_s); | |
229 | |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
230 gtk_imhtml_append_text(GTK_IMHTML(debug_win->text), s, -1, 0); |
5212 | 231 |
232 g_free(s); | |
233 } | |
234 | |
5214
7ea282e1f615
[gaim-migrate @ 5584]
Christian Hammond <chipx86@chipx86.com>
parents:
5212
diff
changeset
|
235 if (opt_debug) { |
7ea282e1f615
[gaim-migrate @ 5584]
Christian Hammond <chipx86@chipx86.com>
parents:
5212
diff
changeset
|
236 if (category == NULL) |
7ea282e1f615
[gaim-migrate @ 5584]
Christian Hammond <chipx86@chipx86.com>
parents:
5212
diff
changeset
|
237 g_print("%s", arg_s); |
7ea282e1f615
[gaim-migrate @ 5584]
Christian Hammond <chipx86@chipx86.com>
parents:
5212
diff
changeset
|
238 else |
5217
6afeab1955b2
[gaim-migrate @ 5587]
Christian Hammond <chipx86@chipx86.com>
parents:
5215
diff
changeset
|
239 g_print("%s: %s", category, arg_s); |
5214
7ea282e1f615
[gaim-migrate @ 5584]
Christian Hammond <chipx86@chipx86.com>
parents:
5212
diff
changeset
|
240 } |
5212 | 241 |
242 g_free(arg_s); | |
243 } | |
244 | |
245 static GaimDebugUiOps ops = | |
246 { | |
247 gaim_gtk_debug_print | |
248 }; | |
249 | |
250 GaimDebugUiOps * | |
251 gaim_get_gtk_debug_ui_ops(void) | |
252 { | |
253 return &ops; | |
254 } | |
255 |