Mercurial > pidgin.yaz
annotate src/gtkdebug.c @ 10229:9aa0b6d11bbf
[gaim-migrate @ 11364]
This is a heavily warmenhoved patch from Alceste Scalas. Here's what it
changes:
If the user drags an image file into the buddy list or conversation, it
presents three options (when applicable):
Set as buddy icon - sets this image to be the buddy icon for this buddy
Send image file - Initiates a file transfer to send this image.
Insert in message - Inserts in the gtkimhtml for use as an IM image.
If the user drags a .desktop web link, it will insert a hyperlink in the
conversation. All other types of .desktop files fail with an error dialog.
If anyone can think of better ways to handle any of them, let me know.
This also happens to implement gaim_request_choice, which had previously
been unimplemented.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 22 Nov 2004 02:57:34 +0000 |
parents | 53410b84336f |
children | ec140184437b |
rev | line source |
---|---|
5212 | 1 /** |
2 * @file gtkdebug.c GTK+ Debug API | |
3 * @ingroup gtkui | |
4 * | |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
10 * |
5212 | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
9791 | 25 #include "internal.h" |
26 #include "gtkgaim.h" | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5818
diff
changeset
|
27 |
9480 | 28 #include "notify.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5818
diff
changeset
|
29 #include "prefs.h" |
8953 | 30 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5818
diff
changeset
|
31 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5818
diff
changeset
|
32 |
5212 | 33 #include "gtkdebug.h" |
9709 | 34 #include "gtkdialogs.h" |
5212 | 35 #include "gtkimhtml.h" |
8953 | 36 #include "gtkutils.h" |
6009
5cd7a10c6ade
[gaim-migrate @ 6457]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
37 #include "stock.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5818
diff
changeset
|
38 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5818
diff
changeset
|
39 extern int opt_debug; |
5212 | 40 |
41 typedef struct | |
42 { | |
43 GtkWidget *window; | |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
44 GtkWidget *text; |
8953 | 45 GtkWidget *find; |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
46 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
47 gboolean timestamps; |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
48 gboolean paused; |
5212 | 49 |
50 } DebugWindow; | |
51 | |
52 static char debug_fg_colors[][8] = { | |
53 "#000000", /**< All debug levels. */ | |
7150 | 54 "#666666", /**< Misc. */ |
5212 | 55 "#000000", /**< Information. */ |
56 "#660000", /**< Warnings. */ | |
57 "#FF0000", /**< Errors. */ | |
58 "#FF0000", /**< Fatal errors. */ | |
59 }; | |
60 | |
61 static DebugWindow *debug_win = NULL; | |
62 | |
8953 | 63 struct _find { |
64 DebugWindow *window; | |
65 GtkWidget *entry; | |
66 }; | |
67 | |
5212 | 68 static gint |
69 debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused) | |
70 { | |
10087 | 71 gaim_prefs_disconnect_by_handle(gaim_gtk_debug_get_handle()); |
9502 | 72 |
73 /* If the "Save Log" dialog is open then close it */ | |
74 gaim_request_close_with_handle(debug_win); | |
5704
aa8dbb7e0a4d
[gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
75 |
5212 | 76 g_free(debug_win); |
77 debug_win = NULL; | |
78 | |
9480 | 79 gaim_prefs_set_bool("/gaim/gtk/debug/enabled", FALSE); |
80 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
81 return FALSE; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
82 } |
5212 | 83 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
84 static gboolean |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5738
diff
changeset
|
85 configure_cb(GtkWidget *w, GdkEventConfigure *event, DebugWindow *win) |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
86 { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
87 if (GTK_WIDGET_VISIBLE(w)) { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
88 gaim_prefs_set_int("/gaim/gtk/debug/width", event->width); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
89 gaim_prefs_set_int("/gaim/gtk/debug/height", event->height); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
90 } |
5212 | 91 |
92 return FALSE; | |
93 } | |
94 | |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
95 static void |
9482 | 96 do_find_cb(GtkWidget *widget, gint response, struct _find *f) |
8953 | 97 { |
9482 | 98 switch (response) { |
8953 | 99 case GTK_RESPONSE_OK: |
100 gtk_imhtml_search_find(GTK_IMHTML(f->window->text), | |
101 gtk_entry_get_text(GTK_ENTRY(f->entry))); | |
102 break; | |
103 | |
104 case GTK_RESPONSE_DELETE_EVENT: | |
105 case GTK_RESPONSE_CLOSE: | |
106 gtk_imhtml_search_clear(GTK_IMHTML(f->window->text)); | |
107 gtk_widget_destroy(f->window->find); | |
108 f->window->find = NULL; | |
109 g_free(f); | |
110 break; | |
111 } | |
112 } | |
113 | |
114 static void | |
115 find_cb(GtkWidget *w, DebugWindow *win) | |
116 { | |
117 GtkWidget *hbox, *img, *label; | |
118 struct _find *f; | |
119 | |
120 if(win->find) | |
121 { | |
122 gtk_window_present(GTK_WINDOW(win->find)); | |
123 return; | |
124 } | |
125 | |
126 f = g_malloc(sizeof(struct _find)); | |
127 f->window = win; | |
128 win->find = gtk_dialog_new_with_buttons(_("Find"), | |
129 GTK_WINDOW(win->window), GTK_DIALOG_DESTROY_WITH_PARENT, | |
130 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
131 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); | |
132 gtk_dialog_set_default_response(GTK_DIALOG(win->find), | |
133 GTK_RESPONSE_OK); | |
134 g_signal_connect(G_OBJECT(win->find), "response", | |
135 G_CALLBACK(do_find_cb), f); | |
136 | |
137 gtk_container_set_border_width(GTK_CONTAINER(win->find), 6); | |
138 gtk_window_set_resizable(GTK_WINDOW(win->find), FALSE); | |
139 gtk_dialog_set_has_separator(GTK_DIALOG(win->find), FALSE); | |
140 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(win->find)->vbox), 12); | |
141 gtk_container_set_border_width( | |
142 GTK_CONTAINER(GTK_DIALOG(win->find)->vbox), 6); | |
143 | |
144 hbox = gtk_hbox_new(FALSE, 12); | |
145 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(win->find)->vbox), | |
146 hbox); | |
147 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, | |
148 GTK_ICON_SIZE_DIALOG); | |
149 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
150 | |
151 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
152 gtk_dialog_set_response_sensitive(GTK_DIALOG(win->find), | |
153 GTK_RESPONSE_OK, FALSE); | |
154 | |
155 label = gtk_label_new(NULL); | |
156 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:")); | |
157 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
158 | |
159 f->entry = gtk_entry_new(); | |
160 gtk_entry_set_activates_default(GTK_ENTRY(f->entry), TRUE); | |
161 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(f->entry)); | |
162 g_signal_connect(G_OBJECT(f->entry), "changed", | |
163 G_CALLBACK(gaim_gtk_set_sensitive_if_input), | |
164 win->find); | |
165 gtk_box_pack_start(GTK_BOX(hbox), f->entry, FALSE, FALSE, 0); | |
166 | |
167 gtk_widget_show_all(win->find); | |
168 gtk_widget_grab_focus(f->entry); | |
169 } | |
170 | |
171 static void | |
9502 | 172 save_writefile_cb(void *user_data, const char *filename) |
8953 | 173 { |
9502 | 174 DebugWindow *win = (DebugWindow *)user_data; |
9489 | 175 FILE *fp; |
8953 | 176 char *tmp; |
177 | |
9480 | 178 if ((fp = fopen(filename, "w+")) == NULL) { |
9502 | 179 gaim_notify_error(win, NULL, _("Unable to open file."), NULL); |
8953 | 180 return; |
9480 | 181 } |
8953 | 182 |
9489 | 183 tmp = gtk_imhtml_get_text(GTK_IMHTML(win->text), NULL, NULL); |
8953 | 184 fprintf(fp, "Gaim Debug log : %s\n", gaim_date_full()); |
185 fprintf(fp, "%s", tmp); | |
186 g_free(tmp); | |
187 | |
188 fclose(fp); | |
189 } | |
190 | |
191 static void | |
192 save_cb(GtkWidget *w, DebugWindow *win) | |
193 { | |
9502 | 194 gaim_request_file(win, _("Save Debug Log"), "gaim-debug.log", TRUE, |
195 G_CALLBACK(save_writefile_cb), NULL, win); | |
8953 | 196 } |
197 | |
198 static void | |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5738
diff
changeset
|
199 clear_cb(GtkWidget *w, DebugWindow *win) |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
200 { |
6280
d330afe3ccf0
[gaim-migrate @ 6779]
Christian Hammond <chipx86@chipx86.com>
parents:
6094
diff
changeset
|
201 gtk_imhtml_clear(GTK_IMHTML(win->text)); |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
202 } |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
203 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
204 static void |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5738
diff
changeset
|
205 pause_cb(GtkWidget *w, DebugWindow *win) |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
206 { |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
207 win->paused = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); |
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 |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
210 static void |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5738
diff
changeset
|
211 timestamps_cb(GtkWidget *w, DebugWindow *win) |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
212 { |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
213 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
|
214 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
215 gaim_prefs_set_bool("/gaim/gtk/debug/timestamps", win->timestamps); |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
216 } |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
217 |
5704
aa8dbb7e0a4d
[gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
218 static void |
aa8dbb7e0a4d
[gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
219 timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
aa8dbb7e0a4d
[gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
220 gpointer data) |
aa8dbb7e0a4d
[gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
221 { |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
222 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), GPOINTER_TO_INT(value)); |
5704
aa8dbb7e0a4d
[gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
223 } |
aa8dbb7e0a4d
[gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
224 |
5212 | 225 static DebugWindow * |
226 debug_window_new(void) | |
227 { | |
228 DebugWindow *win; | |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
229 GtkWidget *vbox; |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
230 GtkWidget *toolbar; |
10175 | 231 GtkWidget *frame; |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
232 GtkWidget *button; |
6094
538c522e36e1
[gaim-migrate @ 6553]
Christian Hammond <chipx86@chipx86.com>
parents:
6009
diff
changeset
|
233 GtkWidget *image; |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
234 int width, height; |
5212 | 235 |
236 win = g_new0(DebugWindow, 1); | |
237 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
238 width = gaim_prefs_get_int("/gaim/gtk/debug/width"); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
239 height = gaim_prefs_get_int("/gaim/gtk/debug/height"); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
240 |
5212 | 241 GAIM_DIALOG(win->window); |
5642
1693a3027dc8
[gaim-migrate @ 6056]
Christian Hammond <chipx86@chipx86.com>
parents:
5636
diff
changeset
|
242 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
|
243 width, height); |
1693a3027dc8
[gaim-migrate @ 6056]
Christian Hammond <chipx86@chipx86.com>
parents:
5636
diff
changeset
|
244 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
245 gtk_window_set_default_size(GTK_WINDOW(win->window), width, height); |
5212 | 246 gtk_window_set_role(GTK_WINDOW(win->window), "debug"); |
247 gtk_window_set_title(GTK_WINDOW(win->window), _("Debug Window")); | |
248 | |
249 g_signal_connect(G_OBJECT(win->window), "delete_event", | |
250 G_CALLBACK(debug_window_destroy), NULL); | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
251 g_signal_connect(G_OBJECT(win->window), "configure_event", |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5738
diff
changeset
|
252 G_CALLBACK(configure_cb), win); |
5212 | 253 |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
254 /* Setup the vbox */ |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
255 vbox = gtk_vbox_new(FALSE, 0); |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
256 gtk_container_add(GTK_CONTAINER(win->window), vbox); |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
257 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
258 if (gaim_prefs_get_bool("/gaim/gtk/debug/toolbar")) { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
259 /* Setup our top button bar thingie. */ |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
260 toolbar = gtk_toolbar_new(); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
261 gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH_HORIZ); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
262 gtk_toolbar_set_icon_size(GTK_TOOLBAR(toolbar), |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
263 GTK_ICON_SIZE_SMALL_TOOLBAR); |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
264 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
265 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
|
266 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
267 /* Find button */ |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
268 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_FIND, |
8953 | 269 NULL, NULL, G_CALLBACK(find_cb), win, -1); |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
270 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
271 /* Save */ |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
272 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_SAVE, |
8953 | 273 NULL, NULL, G_CALLBACK(save_cb), win, -1); |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
274 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
275 /* Clear button */ |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
276 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_CLEAR, |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5738
diff
changeset
|
277 NULL, NULL, G_CALLBACK(clear_cb), win, -1); |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
278 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
279 gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
280 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
281 /* Pause */ |
6094
538c522e36e1
[gaim-migrate @ 6553]
Christian Hammond <chipx86@chipx86.com>
parents:
6009
diff
changeset
|
282 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
|
283 button = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
538c522e36e1
[gaim-migrate @ 6553]
Christian Hammond <chipx86@chipx86.com>
parents:
6009
diff
changeset
|
284 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
538c522e36e1
[gaim-migrate @ 6553]
Christian Hammond <chipx86@chipx86.com>
parents:
6009
diff
changeset
|
285 NULL, _("Pause"), NULL, NULL, |
538c522e36e1
[gaim-migrate @ 6553]
Christian Hammond <chipx86@chipx86.com>
parents:
6009
diff
changeset
|
286 image, G_CALLBACK(pause_cb), win); |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
287 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
288 /* Timestamps */ |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
289 button = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
290 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
291 NULL, _("Timestamps"), NULL, NULL, |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5738
diff
changeset
|
292 NULL, G_CALLBACK(timestamps_cb), |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
293 win); |
8953 | 294 |
295 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), | |
8002
c94f2dad3b73
[gaim-migrate @ 8679]
Christian Hammond <chipx86@chipx86.com>
parents:
7229
diff
changeset
|
296 gaim_prefs_get_bool("/gaim/gtk/debug/timestamps")); |
8953 | 297 |
10087 | 298 gaim_prefs_connect_callback(gaim_gtk_debug_get_handle(), "/gaim/gtk/debug/timestamps", |
299 timestamps_pref_cb, button); | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
300 } |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
301 |
10175 | 302 /* Add the gtkimhtml */ |
303 frame = gaim_gtk_create_imhtml(FALSE, &win->text, NULL); | |
304 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); | |
305 gtk_widget_show(frame); | |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
306 |
5212 | 307 gtk_widget_show_all(win->window); |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
308 |
5212 | 309 return win; |
310 } | |
311 | |
5625
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
312 static void |
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
313 debug_enabled_cb(const char *name, GaimPrefType type, gpointer value, |
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
314 gpointer data) |
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
315 { |
5636 | 316 if (value) |
5625
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
317 gaim_gtk_debug_window_show(); |
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
318 else |
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
319 gaim_gtk_debug_window_hide(); |
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
320 } |
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
321 |
7150 | 322 static void |
323 gaim_glib_log_handler(const gchar *domain, GLogLevelFlags flags, | |
324 const gchar *msg, gpointer user_data) | |
325 { | |
326 GaimDebugLevel level; | |
327 char *new_msg = NULL; | |
328 char *new_domain = NULL; | |
329 | |
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
330 if ((flags & G_LOG_LEVEL_ERROR) == G_LOG_LEVEL_ERROR) |
7150 | 331 level = GAIM_DEBUG_ERROR; |
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
332 else if ((flags & G_LOG_LEVEL_CRITICAL) == G_LOG_LEVEL_CRITICAL) |
7150 | 333 level = GAIM_DEBUG_FATAL; |
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
334 else if ((flags & G_LOG_LEVEL_WARNING) == G_LOG_LEVEL_WARNING) |
7150 | 335 level = GAIM_DEBUG_WARNING; |
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
336 else if ((flags & G_LOG_LEVEL_MESSAGE) == G_LOG_LEVEL_MESSAGE) |
7150 | 337 level = GAIM_DEBUG_INFO; |
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
338 else if ((flags & G_LOG_LEVEL_INFO) == G_LOG_LEVEL_INFO) |
7150 | 339 level = GAIM_DEBUG_INFO; |
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
340 else if ((flags & G_LOG_LEVEL_DEBUG) == G_LOG_LEVEL_DEBUG) |
7150 | 341 level = GAIM_DEBUG_MISC; |
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
342 else |
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
343 { |
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
344 gaim_debug_warning("gtkdebug", |
7150 | 345 "Unknown glib logging level in %d\n", flags); |
346 | |
347 level = GAIM_DEBUG_MISC; /* This will never happen. */ | |
348 } | |
349 | |
350 if (msg != NULL) | |
351 new_msg = gaim_utf8_try_convert(msg); | |
352 | |
353 if (domain != NULL) | |
354 new_domain = gaim_utf8_try_convert(domain); | |
355 | |
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
356 if (new_msg != NULL) |
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
357 { |
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
358 gaim_debug(level, (new_domain != NULL ? new_domain : "g_log"), |
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
359 "%s\n", new_msg); |
7150 | 360 |
361 g_free(new_msg); | |
362 } | |
363 | |
364 if (new_domain != NULL) | |
365 g_free(new_domain); | |
366 } | |
367 | |
368 #ifdef _WIN32 | |
369 static void | |
370 gaim_glib_dummy_print_handler(const gchar *string) | |
371 { | |
372 } | |
373 #endif | |
374 | |
5625
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
375 void |
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
376 gaim_gtk_debug_init(void) |
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
377 { |
5684 | 378 /* Debug window preferences. */ |
379 /* | |
380 * NOTE: This must be set before prefs are loaded, and the callbacks | |
381 * set after they are loaded, since prefs sets the enabled | |
382 * preference here and that loads the window, which calls the | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
383 * configure event, which overrides the width and height! :P |
5684 | 384 */ |
385 | |
386 gaim_prefs_add_none("/gaim/gtk/debug"); | |
387 gaim_prefs_add_bool("/gaim/gtk/debug/enabled", FALSE); | |
388 gaim_prefs_add_bool("/gaim/gtk/debug/timestamps", FALSE); | |
389 gaim_prefs_add_bool("/gaim/gtk/debug/toolbar", TRUE); | |
390 gaim_prefs_add_int("/gaim/gtk/debug/width", 450); | |
391 gaim_prefs_add_int("/gaim/gtk/debug/height", 250); | |
392 | |
10087 | 393 gaim_prefs_connect_callback(NULL, "/gaim/gtk/debug/enabled", |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5738
diff
changeset
|
394 debug_enabled_cb, NULL); |
7150 | 395 |
396 #define REGISTER_G_LOG_HANDLER(name) \ | |
397 g_log_set_handler((name), G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL \ | |
398 | G_LOG_FLAG_RECURSION, \ | |
399 gaim_glib_log_handler, NULL) | |
400 | |
401 /* Register the glib/gtk log handlers. */ | |
402 REGISTER_G_LOG_HANDLER(NULL); | |
403 REGISTER_G_LOG_HANDLER("Gdk"); | |
404 REGISTER_G_LOG_HANDLER("Gtk"); | |
7229
26fe5055e0b0
[gaim-migrate @ 7799]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7152
diff
changeset
|
405 REGISTER_G_LOG_HANDLER("GdkPixbuf"); |
7150 | 406 REGISTER_G_LOG_HANDLER("GLib"); |
407 REGISTER_G_LOG_HANDLER("GModule"); | |
408 REGISTER_G_LOG_HANDLER("GLib-GObject"); | |
409 REGISTER_G_LOG_HANDLER("GThread"); | |
410 | |
411 #ifdef _WIN32 | |
412 if (!opt_debug) | |
413 g_set_print_handler(gaim_glib_dummy_print_handler); | |
414 #endif | |
5625
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
415 } |
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
416 |
5212 | 417 void |
418 gaim_gtk_debug_window_show(void) | |
419 { | |
420 if (debug_win == NULL) | |
421 debug_win = debug_window_new(); | |
422 | |
423 gtk_widget_show(debug_win->window); | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
424 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
425 gaim_prefs_set_bool("/gaim/gtk/debug/enabled", TRUE); |
5212 | 426 } |
427 | |
428 void | |
429 gaim_gtk_debug_window_hide(void) | |
430 { | |
431 if (debug_win != NULL) { | |
432 gtk_widget_destroy(debug_win->window); | |
433 debug_window_destroy(NULL, NULL, NULL); | |
434 } | |
435 } | |
436 | |
437 static void | |
438 gaim_gtk_debug_print(GaimDebugLevel level, const char *category, | |
439 const char *format, va_list args) | |
440 { | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
441 gchar *arg_s, *ts_s; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
442 gboolean timestamps; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
443 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
444 timestamps = gaim_prefs_get_bool("/gaim/gtk/debug/timestamps"); |
5212 | 445 |
446 arg_s = g_strdup_vprintf(format, args); | |
447 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
448 if (category == NULL) { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
449 ts_s = g_strdup(""); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
450 } |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
451 else { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
452 /* |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
453 * If the category is not NULL, then do timestamps. |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
454 * This IS right. :) |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
455 */ |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
456 if (timestamps) { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
457 gchar mdate[64]; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
458 time_t mtime = time(NULL); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
459 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
460 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
461 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
462 ts_s = g_strdup_printf("(%s) ", mdate); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
463 } |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
464 else |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
465 ts_s = g_strdup(""); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
466 } |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
467 |
5535 | 468 if (gaim_prefs_get_bool("/gaim/gtk/debug/enabled") && |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
469 debug_win != NULL && !debug_win->paused) { |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
470 |
5738
ec032cb2f9ec
[gaim-migrate @ 6162]
Christian Hammond <chipx86@chipx86.com>
parents:
5704
diff
changeset
|
471 gchar *esc_s, *cat_s, *utf8_s, *s; |
5212 | 472 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
473 if (category == NULL) |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
474 cat_s = g_strdup(""); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
475 else |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
476 cat_s = g_strdup_printf("<b>%s:</b> ", category); |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
477 |
5212 | 478 esc_s = g_markup_escape_text(arg_s, -1); |
479 | |
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
480 s = g_strdup_printf("<font color=\"%s\">%s%s%s</font>", |
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
481 debug_fg_colors[level], ts_s, cat_s, esc_s); |
5212 | 482 |
483 g_free(esc_s); | |
484 | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
485 utf8_s = gaim_utf8_try_convert(s); |
5738
ec032cb2f9ec
[gaim-migrate @ 6162]
Christian Hammond <chipx86@chipx86.com>
parents:
5704
diff
changeset
|
486 g_free(s); |
ec032cb2f9ec
[gaim-migrate @ 6162]
Christian Hammond <chipx86@chipx86.com>
parents:
5704
diff
changeset
|
487 s = utf8_s; |
ec032cb2f9ec
[gaim-migrate @ 6162]
Christian Hammond <chipx86@chipx86.com>
parents:
5704
diff
changeset
|
488 |
5212 | 489 if (level == GAIM_DEBUG_FATAL) { |
490 gchar *temp = s; | |
491 | |
492 s = g_strdup_printf("<b>%s</b>", temp); | |
493 g_free(temp); | |
494 } | |
495 | |
496 g_free(cat_s); | |
497 | |
6982 | 498 gtk_imhtml_append_text(GTK_IMHTML(debug_win->text), s, 0); |
5212 | 499 |
500 g_free(s); | |
501 } | |
502 | |
5214
7ea282e1f615
[gaim-migrate @ 5584]
Christian Hammond <chipx86@chipx86.com>
parents:
5212
diff
changeset
|
503 if (opt_debug) { |
7ea282e1f615
[gaim-migrate @ 5584]
Christian Hammond <chipx86@chipx86.com>
parents:
5212
diff
changeset
|
504 if (category == NULL) |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
505 g_print("%s%s", ts_s, arg_s); |
5214
7ea282e1f615
[gaim-migrate @ 5584]
Christian Hammond <chipx86@chipx86.com>
parents:
5212
diff
changeset
|
506 else |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
507 g_print("%s%s: %s", ts_s, category, arg_s); |
5214
7ea282e1f615
[gaim-migrate @ 5584]
Christian Hammond <chipx86@chipx86.com>
parents:
5212
diff
changeset
|
508 } |
5212 | 509 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
510 g_free(ts_s); |
5212 | 511 g_free(arg_s); |
512 } | |
513 | |
514 static GaimDebugUiOps ops = | |
515 { | |
516 gaim_gtk_debug_print | |
517 }; | |
518 | |
519 GaimDebugUiOps * | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
520 gaim_gtk_debug_get_ui_ops(void) |
5212 | 521 { |
522 return &ops; | |
523 } | |
10087 | 524 |
525 void * | |
526 gaim_gtk_debug_get_handle() { | |
527 static int handle; | |
528 | |
529 return &handle; | |
530 } | |
531 |