annotate src/gtkdebug.c @ 6274:b6c883e1d5a1

[gaim-migrate @ 6771] a few corrections committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Tue, 22 Jul 2003 16:49:03 +0000
parents 538c522e36e1
children d330afe3ccf0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file gtkdebug.c GTK+ Debug API
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 * @ingroup gtkui
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 *
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 * gaim
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 *
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5818
diff changeset
7 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 *
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * (at your option) any later version.
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 *
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * GNU General Public License for more details.
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 *
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 */
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5818
diff changeset
23 #include "internal.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5818
diff changeset
24
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5818
diff changeset
25 #include "prefs.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5818
diff changeset
26 #include "util.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5818
diff changeset
27
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 #include "gtkdebug.h"
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 #include "gtkimhtml.h"
6009
5cd7a10c6ade [gaim-migrate @ 6457]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
30 #include "stock.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5818
diff changeset
31
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5818
diff changeset
32 #include "ui.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5818
diff changeset
33
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5818
diff changeset
34 extern int opt_debug;
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 typedef struct
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 {
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38 GtkWidget *window;
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
39 GtkWidget *text;
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
40
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
41 gboolean timestamps;
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
42 gboolean paused;
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43
5704
aa8dbb7e0a4d [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
44 guint timestamps_handle;
aa8dbb7e0a4d [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
45
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 } DebugWindow;
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 static char debug_fg_colors[][8] = {
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 "#000000", /**< All debug levels. */
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 "#666666", /**< Blather. */
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 "#000000", /**< Information. */
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 "#660000", /**< Warnings. */
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 "#FF0000", /**< Errors. */
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 "#FF0000", /**< Fatal errors. */
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 };
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 static DebugWindow *debug_win = NULL;
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 static gint
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused)
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 {
5704
aa8dbb7e0a4d [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
62 if (debug_win->timestamps_handle != 0)
aa8dbb7e0a4d [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
63 gaim_prefs_disconnect_callback(debug_win->timestamps_handle);
aa8dbb7e0a4d [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
64
aa8dbb7e0a4d [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
65 gaim_prefs_set_bool("/gaim/gtk/debug/enabled", FALSE);
aa8dbb7e0a4d [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
66
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 g_free(debug_win);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 debug_win = NULL;
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
70 return FALSE;
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
71 }
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
73 static gboolean
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5738
diff changeset
74 configure_cb(GtkWidget *w, GdkEventConfigure *event, DebugWindow *win)
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
75 {
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
76 if (GTK_WIDGET_VISIBLE(w)) {
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
77 gaim_prefs_set_int("/gaim/gtk/debug/width", event->width);
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
78 gaim_prefs_set_int("/gaim/gtk/debug/height", event->height);
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
79 }
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 return FALSE;
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 }
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
84 static void
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5738
diff changeset
85 clear_cb(GtkWidget *w, DebugWindow *win)
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
86 {
5818
eb9cfee31244 [gaim-migrate @ 6248]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
87 GtkWidget *parent;
eb9cfee31244 [gaim-migrate @ 6248]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
88
eb9cfee31244 [gaim-migrate @ 6248]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
89 /* I HATE THIS! It's necessary though... Clearing a GtkTextView is SLOW. */
eb9cfee31244 [gaim-migrate @ 6248]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
90 parent = gtk_widget_get_parent(win->text);
eb9cfee31244 [gaim-migrate @ 6248]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
91
eb9cfee31244 [gaim-migrate @ 6248]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
92 gtk_container_remove(GTK_CONTAINER(parent), win->text);
eb9cfee31244 [gaim-migrate @ 6248]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
93
eb9cfee31244 [gaim-migrate @ 6248]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
94 win->text = gtk_imhtml_new(NULL, NULL);
eb9cfee31244 [gaim-migrate @ 6248]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
95 gtk_container_add(GTK_CONTAINER(parent), win->text);
eb9cfee31244 [gaim-migrate @ 6248]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
96 gtk_widget_show(win->text);
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
97 }
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
98
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
99 static void
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5738
diff changeset
100 pause_cb(GtkWidget *w, DebugWindow *win)
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
101 {
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
102 win->paused = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
103 }
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
104
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
105 static void
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5738
diff changeset
106 timestamps_cb(GtkWidget *w, DebugWindow *win)
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
107 {
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
108 win->timestamps = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
109
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
110 gaim_prefs_set_bool("/gaim/gtk/debug/timestamps", win->timestamps);
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
111 }
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
112
5704
aa8dbb7e0a4d [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
113 static void
aa8dbb7e0a4d [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
114 timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value,
aa8dbb7e0a4d [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
115 gpointer data)
aa8dbb7e0a4d [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
116 {
aa8dbb7e0a4d [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
117 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), (gboolean)value);
aa8dbb7e0a4d [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
118 }
aa8dbb7e0a4d [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
119
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120 static DebugWindow *
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
121 debug_window_new(void)
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122 {
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123 DebugWindow *win;
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
124 GtkWidget *vbox;
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
125 GtkWidget *toolbar;
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
126 GtkWidget *sw;
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
127 GtkWidget *button;
6094
538c522e36e1 [gaim-migrate @ 6553]
Christian Hammond <chipx86@chipx86.com>
parents: 6009
diff changeset
128 GtkWidget *image;
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
129 int width, height;
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
130
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131 win = g_new0(DebugWindow, 1);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
132
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
133 width = gaim_prefs_get_int("/gaim/gtk/debug/width");
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
134 height = gaim_prefs_get_int("/gaim/gtk/debug/height");
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
135
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136 GAIM_DIALOG(win->window);
5642
1693a3027dc8 [gaim-migrate @ 6056]
Christian Hammond <chipx86@chipx86.com>
parents: 5636
diff changeset
137 gaim_debug(GAIM_DEBUG_INFO, "gtkdebug", "Setting dimensions to %d, %d\n",
1693a3027dc8 [gaim-migrate @ 6056]
Christian Hammond <chipx86@chipx86.com>
parents: 5636
diff changeset
138 width, height);
1693a3027dc8 [gaim-migrate @ 6056]
Christian Hammond <chipx86@chipx86.com>
parents: 5636
diff changeset
139
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
140 gtk_window_set_default_size(GTK_WINDOW(win->window), width, height);
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141 gtk_window_set_role(GTK_WINDOW(win->window), "debug");
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142 gtk_window_set_title(GTK_WINDOW(win->window), _("Debug Window"));
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
143
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144 g_signal_connect(G_OBJECT(win->window), "delete_event",
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145 G_CALLBACK(debug_window_destroy), NULL);
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
146 g_signal_connect(G_OBJECT(win->window), "configure_event",
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5738
diff changeset
147 G_CALLBACK(configure_cb), win);
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
148
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
149 /* Setup the vbox */
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
150 vbox = gtk_vbox_new(FALSE, 0);
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
151 gtk_container_add(GTK_CONTAINER(win->window), vbox);
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
152
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
153 if (gaim_prefs_get_bool("/gaim/gtk/debug/toolbar")) {
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
154 /* Setup our top button bar thingie. */
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
155 toolbar = gtk_toolbar_new();
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
156 gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH_HORIZ);
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
157 gtk_toolbar_set_icon_size(GTK_TOOLBAR(toolbar),
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
158 GTK_ICON_SIZE_SMALL_TOOLBAR);
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
159
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
160 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
161
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
162 #if 0
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
163 /* Find button */
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
164 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_FIND,
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
165 NULL, NULL, NULL, NULL, -1);
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
166
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
167 /* Save */
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
168 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_SAVE,
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
169 NULL, NULL, NULL, NULL, -1);
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
170 #endif
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
171
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
172 /* Clear button */
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
173 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_CLEAR,
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5738
diff changeset
174 NULL, NULL, G_CALLBACK(clear_cb), win, -1);
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
175
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
176 gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1);
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
177
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
178 /* Pause */
6094
538c522e36e1 [gaim-migrate @ 6553]
Christian Hammond <chipx86@chipx86.com>
parents: 6009
diff changeset
179 image = gtk_image_new_from_stock(GAIM_STOCK_PAUSE, GTK_ICON_SIZE_MENU);
538c522e36e1 [gaim-migrate @ 6553]
Christian Hammond <chipx86@chipx86.com>
parents: 6009
diff changeset
180 button = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
538c522e36e1 [gaim-migrate @ 6553]
Christian Hammond <chipx86@chipx86.com>
parents: 6009
diff changeset
181 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
538c522e36e1 [gaim-migrate @ 6553]
Christian Hammond <chipx86@chipx86.com>
parents: 6009
diff changeset
182 NULL, _("Pause"), NULL, NULL,
538c522e36e1 [gaim-migrate @ 6553]
Christian Hammond <chipx86@chipx86.com>
parents: 6009
diff changeset
183 image, G_CALLBACK(pause_cb), win);
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
184
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
185 /* Timestamps */
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
186 button = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
187 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
188 NULL, _("Timestamps"), NULL, NULL,
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5738
diff changeset
189 NULL, G_CALLBACK(timestamps_cb),
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
190 win);
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
191
5704
aa8dbb7e0a4d [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
192 win->timestamps_handle =
aa8dbb7e0a4d [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
193 gaim_prefs_connect_callback("/gaim/gtk/debug/timestamps",
aa8dbb7e0a4d [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
194 timestamps_pref_cb, button);
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
195 }
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
196
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
197 /* Now our scrolled window... */
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198 sw = gtk_scrolled_window_new(NULL, NULL);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
200 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
201 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
202 GTK_SHADOW_IN);
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
204 /* ... which has a gtkimhtml in it. */
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
205 win->text = gtk_imhtml_new(NULL, NULL);
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
206
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
207 gtk_container_add(GTK_CONTAINER(sw), win->text);
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
208
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
209 /* Pack it in... Not like that, sicko. */
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
210 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
211
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212 gtk_widget_show_all(win->window);
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
213
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214 return win;
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215 }
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216
5625
73c9dc20e41a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
217 static void
73c9dc20e41a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
218 debug_enabled_cb(const char *name, GaimPrefType type, gpointer value,
73c9dc20e41a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
219 gpointer data)
73c9dc20e41a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
220 {
5636
11233ca9f533 [gaim-migrate @ 6043]
Nathan Walp <nwalp@pidgin.im>
parents: 5631
diff changeset
221 if (value)
5625
73c9dc20e41a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
222 gaim_gtk_debug_window_show();
73c9dc20e41a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
223 else
73c9dc20e41a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
224 gaim_gtk_debug_window_hide();
73c9dc20e41a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
225 }
73c9dc20e41a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
226
73c9dc20e41a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
227 void
73c9dc20e41a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
228 gaim_gtk_debug_init(void)
73c9dc20e41a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
229 {
5684
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
230 /* Debug window preferences. */
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
231 /*
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
232 * NOTE: This must be set before prefs are loaded, and the callbacks
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
233 * set after they are loaded, since prefs sets the enabled
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
234 * preference here and that loads the window, which calls the
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
235 * configure event, which overrrides the width and height! :P
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
236 */
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
237
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
238 gaim_prefs_add_none("/gaim/gtk/debug");
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
239 gaim_prefs_add_bool("/gaim/gtk/debug/enabled", FALSE);
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
240 gaim_prefs_add_bool("/gaim/gtk/debug/timestamps", FALSE);
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
241 gaim_prefs_add_bool("/gaim/gtk/debug/toolbar", TRUE);
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
242 gaim_prefs_add_int("/gaim/gtk/debug/width", 450);
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
243 gaim_prefs_add_int("/gaim/gtk/debug/height", 250);
b61520e71679 [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
244
5625
73c9dc20e41a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
245 gaim_prefs_connect_callback("/gaim/gtk/debug/enabled",
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5738
diff changeset
246 debug_enabled_cb, NULL);
5625
73c9dc20e41a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
247 }
73c9dc20e41a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
248
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
249 void
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
250 gaim_gtk_debug_window_show(void)
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251 {
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252 if (debug_win == NULL)
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
253 debug_win = debug_window_new();
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
254
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
255 gtk_widget_show(debug_win->window);
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
256
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
257 gaim_prefs_set_bool("/gaim/gtk/debug/enabled", TRUE);
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
258 }
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
259
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260 void
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
261 gaim_gtk_debug_window_hide(void)
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
262 {
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
263 if (debug_win != NULL) {
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
264 gtk_widget_destroy(debug_win->window);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265 debug_window_destroy(NULL, NULL, NULL);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 }
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267 }
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
268
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
269 static void
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
270 gaim_gtk_debug_print(GaimDebugLevel level, const char *category,
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271 const char *format, va_list args)
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
272 {
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
273 gchar *arg_s, *ts_s;
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
274 gboolean timestamps;
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
275
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
276 timestamps = gaim_prefs_get_bool("/gaim/gtk/debug/timestamps");
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
277
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
278 arg_s = g_strdup_vprintf(format, args);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
279
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
280 if (category == NULL) {
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
281 ts_s = g_strdup("");
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
282 }
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
283 else {
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
284 /*
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
285 * If the category is not NULL, then do timestamps.
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
286 * This IS right. :)
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
287 */
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
288 if (timestamps) {
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
289 gchar mdate[64];
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
290 time_t mtime = time(NULL);
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
291
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
292 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime));
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
293
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
294 ts_s = g_strdup_printf("(%s) ", mdate);
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
295 }
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
296 else
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
297 ts_s = g_strdup("");
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
298 }
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
299
5535
933739f789f9 [gaim-migrate @ 5935]
Nathan Walp <nwalp@pidgin.im>
parents: 5530
diff changeset
300 if (gaim_prefs_get_bool("/gaim/gtk/debug/enabled") &&
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
301 debug_win != NULL && !debug_win->paused) {
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
302
5738
ec032cb2f9ec [gaim-migrate @ 6162]
Christian Hammond <chipx86@chipx86.com>
parents: 5704
diff changeset
303 gchar *esc_s, *cat_s, *utf8_s, *s;
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
304
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
305 if (category == NULL)
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
306 cat_s = g_strdup("");
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
307 else
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
308 cat_s = g_strdup_printf("<b>%s:</b> ", category);
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
309
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
310 esc_s = g_markup_escape_text(arg_s, -1);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
311
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
312 s = g_strdup_printf("<font color=\"%s\">%s%s%s</font>",
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
313 debug_fg_colors[level], ts_s, cat_s, esc_s);
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
314
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
315 g_free(esc_s);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
316
5738
ec032cb2f9ec [gaim-migrate @ 6162]
Christian Hammond <chipx86@chipx86.com>
parents: 5704
diff changeset
317 utf8_s = gaim_try_conv_to_utf8(s);
ec032cb2f9ec [gaim-migrate @ 6162]
Christian Hammond <chipx86@chipx86.com>
parents: 5704
diff changeset
318 g_free(s);
ec032cb2f9ec [gaim-migrate @ 6162]
Christian Hammond <chipx86@chipx86.com>
parents: 5704
diff changeset
319 s = utf8_s;
ec032cb2f9ec [gaim-migrate @ 6162]
Christian Hammond <chipx86@chipx86.com>
parents: 5704
diff changeset
320
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
321 if (level == GAIM_DEBUG_FATAL) {
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
322 gchar *temp = s;
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
323
5738
ec032cb2f9ec [gaim-migrate @ 6162]
Christian Hammond <chipx86@chipx86.com>
parents: 5704
diff changeset
324 g_free(s);
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
325 s = g_strdup_printf("<b>%s</b>", temp);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
326 g_free(temp);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
327 }
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
328
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
329 g_free(cat_s);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
330
5428
96bde36bb76b [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
331 gtk_imhtml_append_text(GTK_IMHTML(debug_win->text), s, -1, 0);
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
332
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
333 g_free(s);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
334 }
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
335
5214
7ea282e1f615 [gaim-migrate @ 5584]
Christian Hammond <chipx86@chipx86.com>
parents: 5212
diff changeset
336 if (opt_debug) {
7ea282e1f615 [gaim-migrate @ 5584]
Christian Hammond <chipx86@chipx86.com>
parents: 5212
diff changeset
337 if (category == NULL)
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
338 g_print("%s%s", ts_s, arg_s);
5214
7ea282e1f615 [gaim-migrate @ 5584]
Christian Hammond <chipx86@chipx86.com>
parents: 5212
diff changeset
339 else
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
340 g_print("%s%s: %s", ts_s, category, arg_s);
5214
7ea282e1f615 [gaim-migrate @ 5584]
Christian Hammond <chipx86@chipx86.com>
parents: 5212
diff changeset
341 }
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
342
5530
2c4c975620f0 [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
343 g_free(ts_s);
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
344 g_free(arg_s);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
345 }
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
346
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
347 static GaimDebugUiOps ops =
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
348 {
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
349 gaim_gtk_debug_print
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
350 };
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
351
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
352 GaimDebugUiOps *
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
353 gaim_get_gtk_debug_ui_ops(void)
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
354 {
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
355 return &ops;
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
356 }
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
357