Mercurial > pidgin
comparison finch/gntdebug.c @ 18684:5c1ed6296b56
propagate from branch 'im.pidgin.pidgin' (head b195e262642015df66e36d33e9dd16ecae5df9d5)
to branch 'im.pidgin.soc.2007.xmpp' (head 06f9dbd73b69e26dc9f56873a9ce106146bb1b18)
author | Andreas Monitzer <pidgin@monitzer.com> |
---|---|
date | Wed, 11 Jul 2007 22:27:44 +0000 |
parents | 6b623a59cec6 |
children | 3432d37a4a77 44b4e8bd759b 315151da0dc6 |
comparison
equal
deleted
inserted
replaced
17907:8d2ea5072f6f | 18684:5c1ed6296b56 |
---|---|
219 (GDestroyNotify)g_source_remove); | 219 (GDestroyNotify)g_source_remove); |
220 } | 220 } |
221 | 221 |
222 void finch_debug_window_show() | 222 void finch_debug_window_show() |
223 { | 223 { |
224 GntWidget *wid, *box; | |
225 | |
224 debug.paused = FALSE; | 226 debug.paused = FALSE; |
225 if (debug.window == NULL) | 227 if (debug.window) { |
226 { | 228 gnt_window_present(debug.window); |
227 GntWidget *wid, *box; | 229 return; |
228 debug.window = gnt_vbox_new(FALSE); | |
229 gnt_box_set_toplevel(GNT_BOX(debug.window), TRUE); | |
230 gnt_box_set_title(GNT_BOX(debug.window), _("Debug Window")); | |
231 gnt_box_set_pad(GNT_BOX(debug.window), 0); | |
232 gnt_box_set_alignment(GNT_BOX(debug.window), GNT_ALIGN_MID); | |
233 | |
234 debug.tview = gnt_text_view_new(); | |
235 gnt_box_add_widget(GNT_BOX(debug.window), debug.tview); | |
236 gnt_widget_set_size(debug.tview, | |
237 purple_prefs_get_int(PREF_ROOT "/size/width"), | |
238 purple_prefs_get_int(PREF_ROOT "/size/height")); | |
239 g_signal_connect(G_OBJECT(debug.tview), "size_changed", G_CALLBACK(size_changed_cb), NULL); | |
240 | |
241 gnt_box_add_widget(GNT_BOX(debug.window), gnt_line_new(FALSE)); | |
242 | |
243 box = gnt_hbox_new(FALSE); | |
244 gnt_box_set_alignment(GNT_BOX(box), GNT_ALIGN_MID); | |
245 gnt_box_set_fill(GNT_BOX(box), FALSE); | |
246 | |
247 /* XXX: Setting the GROW_Y for the following widgets don't make sense. But right now | |
248 * it's necessary to make the width of the debug window resizable ... like I said, | |
249 * it doesn't make sense. The bug is likely in the packing in gntbox.c. | |
250 */ | |
251 wid = gnt_button_new(_("Clear")); | |
252 g_signal_connect(G_OBJECT(wid), "activate", G_CALLBACK(clear_debug_win), debug.tview); | |
253 GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); | |
254 gnt_box_add_widget(GNT_BOX(box), wid); | |
255 | |
256 debug.search = gnt_entry_new(purple_prefs_get_string(PREF_ROOT "/filter")); | |
257 gnt_box_add_widget(GNT_BOX(box), gnt_label_new(_("Filter: "))); | |
258 gnt_box_add_widget(GNT_BOX(box), debug.search); | |
259 g_signal_connect(G_OBJECT(debug.search), "text_changed", G_CALLBACK(update_filter_string), NULL); | |
260 | |
261 wid = gnt_check_box_new(_("Pause")); | |
262 g_signal_connect(G_OBJECT(wid), "toggled", G_CALLBACK(toggle_pause), NULL); | |
263 GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); | |
264 gnt_box_add_widget(GNT_BOX(box), wid); | |
265 | |
266 gnt_box_add_widget(GNT_BOX(debug.window), box); | |
267 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_GROW_Y); | |
268 | |
269 gnt_widget_set_name(debug.window, "debug-window"); | |
270 | |
271 g_signal_connect(G_OBJECT(debug.window), "destroy", G_CALLBACK(reset_debug_win), NULL); | |
272 gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(debug.tview), debug.window); | |
273 } | 230 } |
231 | |
232 debug.window = gnt_vbox_new(FALSE); | |
233 gnt_box_set_toplevel(GNT_BOX(debug.window), TRUE); | |
234 gnt_box_set_title(GNT_BOX(debug.window), _("Debug Window")); | |
235 gnt_box_set_pad(GNT_BOX(debug.window), 0); | |
236 gnt_box_set_alignment(GNT_BOX(debug.window), GNT_ALIGN_MID); | |
237 | |
238 debug.tview = gnt_text_view_new(); | |
239 gnt_box_add_widget(GNT_BOX(debug.window), debug.tview); | |
240 gnt_widget_set_size(debug.tview, | |
241 purple_prefs_get_int(PREF_ROOT "/size/width"), | |
242 purple_prefs_get_int(PREF_ROOT "/size/height")); | |
243 g_signal_connect(G_OBJECT(debug.tview), "size_changed", G_CALLBACK(size_changed_cb), NULL); | |
244 | |
245 gnt_box_add_widget(GNT_BOX(debug.window), gnt_line_new(FALSE)); | |
246 | |
247 box = gnt_hbox_new(FALSE); | |
248 gnt_box_set_alignment(GNT_BOX(box), GNT_ALIGN_MID); | |
249 gnt_box_set_fill(GNT_BOX(box), FALSE); | |
250 | |
251 /* XXX: Setting the GROW_Y for the following widgets don't make sense. But right now | |
252 * it's necessary to make the width of the debug window resizable ... like I said, | |
253 * it doesn't make sense. The bug is likely in the packing in gntbox.c. | |
254 */ | |
255 wid = gnt_button_new(_("Clear")); | |
256 g_signal_connect(G_OBJECT(wid), "activate", G_CALLBACK(clear_debug_win), debug.tview); | |
257 GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); | |
258 gnt_box_add_widget(GNT_BOX(box), wid); | |
259 | |
260 debug.search = gnt_entry_new(purple_prefs_get_string(PREF_ROOT "/filter")); | |
261 gnt_box_add_widget(GNT_BOX(box), gnt_label_new(_("Filter: "))); | |
262 gnt_box_add_widget(GNT_BOX(box), debug.search); | |
263 g_signal_connect(G_OBJECT(debug.search), "text_changed", G_CALLBACK(update_filter_string), NULL); | |
264 | |
265 wid = gnt_check_box_new(_("Pause")); | |
266 g_signal_connect(G_OBJECT(wid), "toggled", G_CALLBACK(toggle_pause), NULL); | |
267 GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); | |
268 gnt_box_add_widget(GNT_BOX(box), wid); | |
269 | |
270 gnt_box_add_widget(GNT_BOX(debug.window), box); | |
271 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_GROW_Y); | |
272 | |
273 gnt_widget_set_name(debug.window, "debug-window"); | |
274 | |
275 g_signal_connect(G_OBJECT(debug.window), "destroy", G_CALLBACK(reset_debug_win), NULL); | |
276 gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(debug.tview), debug.window); | |
277 gnt_text_view_attach_pager_widget(GNT_TEXT_VIEW(debug.tview), debug.window); | |
274 | 278 |
275 gnt_widget_show(debug.window); | 279 gnt_widget_show(debug.window); |
276 } | 280 } |
277 | 281 |
278 static gboolean | 282 static gboolean |
296 REGISTER_G_LOG_HANDLER("GModule"); | 300 REGISTER_G_LOG_HANDLER("GModule"); |
297 REGISTER_G_LOG_HANDLER("GLib-GObject"); | 301 REGISTER_G_LOG_HANDLER("GLib-GObject"); |
298 REGISTER_G_LOG_HANDLER("GThread"); | 302 REGISTER_G_LOG_HANDLER("GThread"); |
299 | 303 |
300 g_set_print_handler(print_stderr); /* Redirect the debug messages to stderr */ | 304 g_set_print_handler(print_stderr); /* Redirect the debug messages to stderr */ |
301 g_set_printerr_handler(suppress_error_messages); | 305 if (!purple_debug_is_enabled()) |
306 g_set_printerr_handler(suppress_error_messages); | |
302 | 307 |
303 purple_prefs_add_none(PREF_ROOT); | 308 purple_prefs_add_none(PREF_ROOT); |
304 purple_prefs_add_string(PREF_ROOT "/filter", ""); | 309 purple_prefs_add_string(PREF_ROOT "/filter", ""); |
305 purple_prefs_add_none(PREF_ROOT "/size"); | 310 purple_prefs_add_none(PREF_ROOT "/size"); |
306 purple_prefs_add_int(PREF_ROOT "/size/width", 60); | 311 purple_prefs_add_int(PREF_ROOT "/size/width", 60); |