comparison finch/gntdebug.c @ 19123:576edd9c4f72

propagate from branch 'im.pidgin.pidgin' (head 96be2c6bb0b910f823a48bf0ffc247135df4a988) to branch 'im.pidgin.soc.2007.finchfeat' (head 2a7598789162e259bfd3ba6cfa189a024137c675)
author Eric Polino <aluink@pidgin.im>
date Fri, 29 Jun 2007 12:45:08 +0000
parents d8b9bea550bc 2d4df5ef0090
children c6282dc3fb9f
comparison
equal deleted inserted replaced
19122:6dded98d1c80 19123:576edd9c4f72
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);
274 277
275 gnt_widget_show(debug.window); 278 gnt_widget_show(debug.window);
276 } 279 }
277 280
278 static gboolean 281 static gboolean