Mercurial > pidgin
annotate src/prefs.c @ 109:45bcfa3b584c
[gaim-migrate @ 119]
Added an option to not play 'login' sounds when people first sign on.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 12 Apr 2000 21:30:29 +0000 |
parents | 51943f1a97a0 |
children | d4e99c17e399 |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
22 #include <string.h> | |
23 #include <sys/time.h> | |
24 | |
25 #include <sys/types.h> | |
26 #include <sys/stat.h> | |
27 | |
28 #include <unistd.h> | |
29 #include <stdio.h> | |
30 #include <stdlib.h> | |
31 #include <gtk/gtk.h> | |
32 #include "gaim.h" | |
33 #include "proxy.h" | |
34 | |
35 struct prefs_data *pd = NULL; | |
36 struct debug_window *dw = NULL; | |
37 | |
38 GtkWidget *debugbutton; | |
39 | |
40 struct chat_page { | |
41 GtkWidget *list1; | |
42 GtkWidget *list2; | |
43 }; | |
44 | |
45 | |
46 char debug_buff[BUF_LONG]; | |
47 | |
48 void do_chat_page(GtkWidget *page); | |
49 | |
50 void list_clicked( GtkWidget *widget, struct away_message *a); | |
51 void list_unclicked( GtkWidget *widget, struct away_message *a); | |
52 | |
53 | |
54 void remove_away_message(GtkWidget *widget, void *dummy) | |
55 { | |
56 GList *i; | |
57 struct away_message *a; | |
58 | |
59 i = GTK_LIST(pd->away_list)->selection; | |
60 | |
61 a = gtk_object_get_user_data(GTK_OBJECT(i->data)); | |
62 | |
63 rem_away_mess(NULL, a); | |
64 } | |
65 | |
66 void away_list_clicked( GtkWidget *widget, struct away_message *a) | |
67 { | |
68 gchar buffer[2048]; | |
69 guint text_len; | |
70 | |
71 pd->cur_message = a; | |
72 | |
73 /* Get proper Length */ | |
74 text_len = gtk_text_get_length(GTK_TEXT(pd->away_text)); | |
75 pd->edited_message = gtk_editable_get_chars(GTK_EDITABLE(pd->away_text), 0, text_len); | |
76 | |
77 /* Clear the Box */ | |
78 gtk_text_set_point(GTK_TEXT(pd->away_text), 0 ); | |
79 gtk_text_forward_delete (GTK_TEXT(pd->away_text), text_len); | |
80 | |
81 /* Fill the text box with new message */ | |
82 strcpy(buffer, a->message); | |
83 gtk_text_insert(GTK_TEXT(pd->away_text), NULL, NULL, NULL, buffer, -1); | |
84 | |
85 | |
86 } | |
87 | |
88 void away_list_unclicked( GtkWidget *widget, struct away_message *a) | |
89 { | |
90 if (pd == NULL) | |
91 return; | |
92 strcpy(a->message, pd->edited_message); | |
93 save_prefs(); | |
94 } | |
95 | |
96 | |
97 void set_option(GtkWidget *w, int *option) | |
98 { | |
99 *option = !(*option); | |
100 } | |
101 | |
102 void set_display_option(GtkWidget *w, int *option) | |
103 { | |
104 display_options = display_options ^ (int)option; | |
9 | 105 |
18 | 106 if (blist) update_button_pix(); |
9 | 107 |
84 | 108 #ifdef USE_APPLET |
82 | 109 update_pixmaps(); |
110 #endif | |
111 | |
1 | 112 save_prefs(); |
113 } | |
114 | |
115 void set_sound_option(GtkWidget *w, int *option) | |
116 { | |
117 sound_options = sound_options ^ (int)option; | |
118 save_prefs(); | |
119 } | |
120 | |
121 void set_font_option(GtkWidget *w, int *option) | |
122 { | |
123 font_options = font_options ^ (int)option; | |
124 | |
125 update_font_buttons(); | |
126 | |
127 save_prefs(); | |
128 } | |
129 | |
130 void set_general_option(GtkWidget *w, int *option) | |
131 { | |
132 general_options = general_options ^ (int)option; | |
133 | |
134 if ((int)option == OPT_GEN_SHOW_LAGMETER) | |
135 update_lagometer(-1); | |
136 if ((int)option == OPT_GEN_LOG_ALL) | |
137 update_log_convs(); | |
138 save_prefs(); | |
139 | |
140 /* | |
141 if (data == &show_grp_nums) | |
142 update_num_groups(); | |
143 if (data == &showidle || data == &showpix) | |
144 update_show_idlepix(); | |
18 | 145 if (data == &button_pix && blist) |
1 | 146 update_button_pix(); |
147 if (data == &transparent) | |
148 update_transparency(); | |
149 */ | |
150 | |
151 } | |
152 | |
153 | |
154 static gint debug_delete(GtkWidget *w, GdkEvent *event, void *dummy) | |
155 { | |
156 if(debugbutton && (general_options & OPT_GEN_DEBUG)) | |
157 { | |
158 gtk_button_clicked(GTK_BUTTON(debugbutton)); | |
159 } | |
160 g_free(dw); | |
161 dw=NULL; | |
162 return FALSE; | |
163 | |
164 } | |
165 | |
166 static gint handle_delete(GtkWidget *w, GdkEvent *event, void *dummy) | |
167 { | |
168 guint text_len; | |
169 struct away_message *a; | |
170 | |
171 | |
172 if (pd->cur_message) { | |
173 | |
174 a = pd->cur_message; | |
175 | |
176 | |
177 /* Get proper Length and grab data */ | |
178 text_len = gtk_text_get_length(GTK_TEXT(pd->away_text)); | |
179 pd->edited_message = gtk_editable_get_chars(GTK_EDITABLE(pd->away_text), 0, text_len); | |
180 | |
181 /* Store the data for later use */ | |
182 strcpy(a->message, pd->edited_message); | |
183 | |
184 } | |
185 | |
186 save_prefs(); | |
187 | |
188 if (event == NULL) | |
189 { | |
190 gtk_widget_destroy(pd->window); | |
191 debugbutton=NULL; | |
192 } | |
193 g_free(pd); | |
194 pd = NULL; | |
195 | |
196 | |
197 return FALSE; | |
198 } | |
199 | |
200 static int | |
201 manualentry_key_pressed(GtkWidget *w, GdkEvent *event, void *dummy) | |
202 { | |
203 g_snprintf(web_command, sizeof(web_command), "%s", gtk_entry_get_text(GTK_ENTRY(pd->browser_entry))); | |
204 save_prefs(); | |
205 return TRUE; | |
206 } | |
207 | |
208 static int | |
209 connection_key_pressed(GtkWidget *w, GdkEvent *event, void *dummy) | |
210 { | |
211 g_snprintf(aim_host, sizeof(aim_host), "%s", gtk_entry_get_text(GTK_ENTRY(pd->aim_host_entry))); | |
212 sscanf(gtk_entry_get_text(GTK_ENTRY(pd->aim_port_entry)), "%d", &aim_port); | |
213 g_snprintf(proxy_host, sizeof(proxy_host), "%s", gtk_entry_get_text(GTK_ENTRY(pd->http_proxy_host_entry))); | |
214 sscanf(gtk_entry_get_text(GTK_ENTRY(pd->http_proxy_port_entry)), "%d", &proxy_port); | |
215 | |
216 g_snprintf(login_host, sizeof(login_host), "%s", gtk_entry_get_text(GTK_ENTRY(pd->login_host_entry))); | |
217 sscanf(gtk_entry_get_text(GTK_ENTRY(pd->login_port_entry)), "%d", &login_port); | |
218 save_prefs(); | |
219 return TRUE; | |
220 } | |
221 | |
222 | |
223 | |
224 | |
225 static void set_browser(GtkWidget *w, int *data) | |
226 { | |
227 web_browser = (int)data; | |
228 if (web_browser != BROWSER_MANUAL) { | |
229 if (pd->browser_entry) | |
230 gtk_widget_set_sensitive(pd->browser_entry, FALSE); | |
231 } else { | |
232 if (pd->browser_entry) | |
233 gtk_widget_set_sensitive(pd->browser_entry, TRUE); | |
234 } | |
235 | |
236 if (web_browser != BROWSER_NETSCAPE) { | |
237 if (pd->nwbutton) | |
238 gtk_widget_set_sensitive(pd->nwbutton, FALSE); | |
239 } else { | |
240 if (pd->nwbutton) | |
241 gtk_widget_set_sensitive(pd->nwbutton, TRUE); | |
242 } | |
243 | |
244 | |
245 save_prefs(); | |
246 } | |
247 | |
248 static void set_connect(GtkWidget *w, int *data) | |
249 { | |
250 proxy_type = (int)data; | |
251 if (proxy_type == PROXY_HTTP) { | |
252 if (pd->http_proxy_host_entry) | |
253 gtk_widget_set_sensitive(pd->http_proxy_host_entry, TRUE); | |
254 if (pd->http_proxy_port_entry) | |
255 gtk_widget_set_sensitive(pd->http_proxy_port_entry, TRUE); | |
256 | |
257 } else { | |
258 if (pd->http_proxy_host_entry) | |
259 gtk_widget_set_sensitive(pd->http_proxy_host_entry, FALSE); | |
260 if (pd->http_proxy_port_entry) | |
261 gtk_widget_set_sensitive(pd->http_proxy_port_entry, FALSE); | |
262 | |
263 } | |
264 | |
265 save_prefs(); | |
266 } | |
267 | |
268 static void set_idle(GtkWidget *w, int *data) | |
269 { | |
270 report_idle = (int)data; | |
271 save_prefs(); | |
272 } | |
273 | |
274 | |
275 GtkWidget *gaim_button(const char *text, int *options, int option, GtkWidget *page) | |
276 { | |
277 GtkWidget *button; | |
278 button = gtk_check_button_new_with_label(text); | |
279 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (*options & option)); | |
280 gtk_box_pack_start(GTK_BOX(page), button, FALSE, FALSE, 0); | |
281 | |
282 if (options == &font_options) | |
283 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_font_option), (int *)option); | |
284 | |
285 if (options == &sound_options) | |
286 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_sound_option), (int *)option); | |
287 if (options == &display_options) | |
288 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_display_option), (int *)option); | |
289 | |
290 if (options == &general_options) | |
291 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_general_option), (int *)option); | |
292 gtk_widget_show(button); | |
293 | |
294 return button; | |
295 } | |
296 | |
297 | |
298 void build_prefs() | |
299 { | |
300 GtkWidget *bbox; | |
301 GtkWidget *vbox; | |
302 GtkWidget *hbox; | |
303 GtkWidget *hbox2; | |
304 GtkWidget *idlebox; | |
305 GtkWidget *idleframe; | |
306 GtkWidget *genbox; | |
307 GtkWidget *fontbox; | |
308 GtkWidget *fontframe; | |
309 GtkWidget *appbox; | |
310 GtkWidget *away_topbox; | |
311 GtkWidget *away_botbox; | |
312 GtkWidget *add_away; | |
313 GtkWidget *remove_away; | |
314 GtkWidget *close; | |
315 GtkWidget *notebook; | |
316 GtkWidget *sound_page; | |
317 /* GtkWidget *debug_page; */ | |
318 GtkWidget *general_page; | |
319 GtkWidget *appearance_page; | |
320 GtkWidget *chat_page; | |
321 GtkWidget *browser_page; | |
322 GtkWidget *connection_page; | |
323 GtkWidget *label; | |
324 GtkWidget *browseropt; | |
325 GtkWidget *connectopt; | |
326 GtkWidget *idleopt; | |
327 | |
328 GList *awy = away_messages; | |
329 struct away_message *a; | |
330 GtkWidget *sw; | |
331 GtkWidget *sw2; | |
332 GtkWidget *away_page; | |
333 | |
334 GtkWidget *list_item; | |
335 | |
336 gchar buffer[64]; | |
337 | |
338 | |
339 if (!pd) | |
340 pd = g_new0(struct prefs_data, 1); | |
341 | |
342 pd->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
343 gtk_widget_realize(pd->window); | |
344 aol_icon(pd->window->window); | |
345 gtk_container_border_width(GTK_CONTAINER(pd->window), 10); | |
346 gtk_window_set_title(GTK_WINDOW(pd->window), "Gaim - Preferences"); | |
347 | |
348 vbox = gtk_vbox_new(FALSE, 5); | |
349 gtk_container_add(GTK_CONTAINER(pd->window), vbox); | |
350 | |
351 /* Notebooks */ | |
352 notebook = gtk_notebook_new(); | |
353 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 5); | |
354 | |
355 | |
356 /* General page */ | |
357 general_page = gtk_hbox_new(FALSE, 0); | |
358 label = gtk_label_new("General"); | |
359 gtk_widget_show(label); | |
360 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), general_page, label); | |
361 | |
362 genbox = gtk_vbox_new(FALSE, 5); | |
363 idleframe = gtk_frame_new("Idle"); | |
364 idlebox = gtk_vbox_new(FALSE, 5); | |
365 | |
366 gtk_box_pack_start(GTK_BOX(general_page), genbox, TRUE, TRUE, 5); | |
367 gtk_box_pack_start(GTK_BOX(general_page), idleframe, TRUE, TRUE, 5); | |
368 gtk_container_add(GTK_CONTAINER(idleframe), idlebox); | |
369 | |
370 | |
371 gaim_button("Enter sends message", &general_options, OPT_GEN_ENTER_SENDS, genbox); | |
372 gaim_button("Auto-login", &general_options, OPT_GEN_AUTO_LOGIN, genbox); | |
373 gaim_button("Log All Conversations", &general_options, OPT_GEN_LOG_ALL, genbox); | |
374 gaim_button("Strip HTML from log files", &general_options, OPT_GEN_STRIP_HTML, genbox); | |
375 #ifdef USE_APPLET | |
10 | 376 gaim_button("Automatically Show Buddy List", &general_options, OPT_GEN_APP_BUDDY_SHOW, genbox); |
1 | 377 #endif |
378 gaim_button("Raise windows when message recieved", &general_options, OPT_GEN_POPUP_WINDOWS, genbox); | |
379 gaim_button("Send URLs as links", &general_options, OPT_GEN_SEND_LINKS, genbox); | |
380 gaim_button("Show Lag-O-Meter", &general_options, OPT_GEN_SHOW_LAGMETER, genbox); | |
381 gaim_button("Save some window size/positions", &general_options, OPT_GEN_SAVED_WINDOWS, genbox); | |
382 gaim_button("Ignore new conversations when away", &general_options, OPT_GEN_DISCARD_WHEN_AWAY, genbox); | |
383 debugbutton = gaim_button("Enable debug mode", &general_options, OPT_GEN_DEBUG, genbox); | |
384 | |
385 | |
386 idleopt = gtk_radio_button_new_with_label(NULL, "No Idle"); | |
387 gtk_box_pack_start(GTK_BOX(idlebox), idleopt, FALSE, FALSE, 0); | |
388 gtk_signal_connect(GTK_OBJECT(idleopt), "clicked", GTK_SIGNAL_FUNC(set_idle), (void *)IDLE_NONE); | |
389 gtk_widget_show(idleopt); | |
390 if (report_idle == IDLE_NONE) | |
391 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(idleopt), TRUE); | |
392 | |
393 idleopt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(idleopt)), "GAIM Use"); | |
394 gtk_box_pack_start(GTK_BOX(idlebox), idleopt, FALSE, FALSE, 0); | |
395 gtk_signal_connect(GTK_OBJECT(idleopt), "clicked", GTK_SIGNAL_FUNC(set_idle), (void *)IDLE_GAIM); | |
396 gtk_widget_show(idleopt); | |
397 if (report_idle == IDLE_GAIM) | |
398 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(idleopt), TRUE); | |
399 | |
400 /* idleopt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(idleopt)), "X Use"); | |
401 gtk_box_pack_start(GTK_BOX(idlebox), idleopt, FALSE, FALSE, 0); | |
402 gtk_signal_connect(GTK_OBJECT(idleopt), "clicked", GTK_SIGNAL_FUNC(set_idle), (void *)IDLE_SYSTEM); | |
403 gtk_widget_show(idleopt); | |
404 if (report_idle == IDLE_SYSTEM) | |
405 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(idleopt), TRUE); | |
406 */ | |
407 | |
408 gtk_widget_show(general_page); | |
409 gtk_widget_show(genbox); | |
410 gtk_widget_show(idlebox); | |
411 gtk_widget_show(idleframe); | |
412 | |
413 | |
414 // gtk_signal_connect_object( GTK_OBJECT(debugbutton), "clicked", GTK_SIGNAL_FUNC(show_debug), NULL); | |
415 | |
416 /* Connection */ | |
417 | |
418 connection_page = gtk_vbox_new(FALSE, 0); | |
419 label = gtk_label_new("Connection"); | |
420 gtk_widget_show(label); | |
421 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), connection_page, label); | |
422 | |
423 hbox = gtk_hbox_new(FALSE, 0); | |
424 label = gtk_label_new("TOC Host:"); | |
425 gtk_widget_show(label); | |
426 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
427 pd->aim_host_entry = gtk_entry_new(); | |
428 gtk_widget_show(pd->aim_host_entry); | |
429 gtk_box_pack_start(GTK_BOX(hbox), pd->aim_host_entry, FALSE, FALSE, 0); | |
430 | |
431 label = gtk_label_new("Port:"); | |
432 gtk_widget_show(label); | |
433 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
434 pd->aim_port_entry = gtk_entry_new(); | |
435 gtk_widget_show(pd->aim_port_entry); | |
436 gtk_box_pack_start(GTK_BOX(hbox), pd->aim_port_entry, FALSE, FALSE, 0); | |
437 gtk_widget_show(hbox); | |
438 | |
439 gtk_box_pack_start(GTK_BOX(connection_page), hbox, FALSE, FALSE, 0); | |
440 gtk_entry_set_text(GTK_ENTRY(pd->aim_host_entry), aim_host); | |
441 | |
442 g_snprintf(buffer, sizeof(buffer), "%d", aim_port); | |
443 gtk_entry_set_text(GTK_ENTRY(pd->aim_port_entry), buffer); | |
444 | |
445 hbox2 = gtk_hbox_new(FALSE, 0); | |
446 label = gtk_label_new("Login Host:"); | |
447 gtk_widget_show(label); | |
448 gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 5); | |
449 pd->login_host_entry = gtk_entry_new(); | |
450 gtk_widget_show(pd->login_host_entry); | |
451 gtk_box_pack_start(GTK_BOX(hbox2), pd->login_host_entry, FALSE, FALSE, 0); | |
452 | |
453 label = gtk_label_new("Port:"); | |
454 gtk_widget_show(label); | |
455 gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 5); | |
456 pd->login_port_entry = gtk_entry_new(); | |
457 gtk_widget_show(pd->login_port_entry); | |
458 gtk_box_pack_start(GTK_BOX(hbox2), pd->login_port_entry, FALSE, FALSE, 0); | |
459 gtk_widget_show(hbox2); | |
460 | |
461 gtk_box_pack_start(GTK_BOX(connection_page), hbox2, FALSE, FALSE, 0); | |
462 gtk_entry_set_text(GTK_ENTRY(pd->login_host_entry), login_host); | |
463 | |
464 g_snprintf(buffer, sizeof(buffer), "%d", login_port); | |
465 gtk_entry_set_text(GTK_ENTRY(pd->login_port_entry), buffer); | |
466 | |
467 connectopt = gtk_radio_button_new_with_label(NULL, "No Proxy"); | |
468 gtk_box_pack_start(GTK_BOX(connection_page), connectopt, FALSE, FALSE, 0); | |
469 gtk_signal_connect(GTK_OBJECT(connectopt), "clicked", GTK_SIGNAL_FUNC(set_connect), (void *)PROXY_NONE); | |
470 gtk_widget_show(connectopt); | |
471 if (proxy_type == PROXY_NONE) | |
472 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(connectopt), TRUE); | |
473 | |
474 connectopt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(connectopt)), "HTTP Proxy"); | |
475 gtk_box_pack_start(GTK_BOX(connection_page), connectopt, FALSE, FALSE, 0); | |
476 gtk_signal_connect(GTK_OBJECT(connectopt), "clicked", GTK_SIGNAL_FUNC(set_connect), (void *)PROXY_HTTP); | |
477 gtk_widget_show(connectopt); | |
478 if (proxy_type == PROXY_HTTP) | |
479 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(connectopt), TRUE); | |
480 | |
481 | |
482 hbox = gtk_hbox_new(FALSE, 0); | |
483 label = gtk_label_new("Proxy Host:"); | |
484 gtk_widget_show(label); | |
485 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
486 pd->http_proxy_host_entry = gtk_entry_new(); | |
487 gtk_widget_show(pd->http_proxy_host_entry); | |
488 gtk_box_pack_start(GTK_BOX(hbox), pd->http_proxy_host_entry, FALSE, FALSE, 0); | |
489 | |
490 label = gtk_label_new("Port:"); | |
491 gtk_widget_show(label); | |
492 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
493 pd->http_proxy_port_entry = gtk_entry_new(); | |
494 gtk_widget_show(pd->http_proxy_port_entry); | |
495 gtk_box_pack_start(GTK_BOX(hbox), pd->http_proxy_port_entry, FALSE, FALSE, 0); | |
496 gtk_widget_show(hbox); | |
497 | |
498 gtk_box_pack_start(GTK_BOX(connection_page), hbox, FALSE, FALSE, 0); | |
499 gtk_entry_set_text(GTK_ENTRY(pd->http_proxy_host_entry), proxy_host); | |
500 | |
501 g_snprintf(buffer, sizeof(buffer), "%d", proxy_port); | |
502 gtk_entry_set_text(GTK_ENTRY(pd->http_proxy_port_entry), buffer); | |
503 | |
504 | |
505 gtk_widget_show(connection_page); | |
506 | |
507 | |
508 if (proxy_type == PROXY_HTTP) { | |
509 if (pd->http_proxy_host_entry) | |
510 gtk_widget_set_sensitive(pd->http_proxy_host_entry, TRUE); | |
511 if (pd->http_proxy_port_entry) | |
512 gtk_widget_set_sensitive(pd->http_proxy_port_entry, TRUE); | |
513 | |
514 } else { | |
515 if (pd->http_proxy_host_entry) | |
516 gtk_widget_set_sensitive(pd->http_proxy_host_entry, FALSE); | |
517 if (pd->http_proxy_port_entry) | |
518 gtk_widget_set_sensitive(pd->http_proxy_port_entry, FALSE); | |
519 | |
520 } | |
521 | |
522 | |
523 | |
524 gtk_signal_connect(GTK_OBJECT(pd->aim_host_entry), "focus_out_event", GTK_SIGNAL_FUNC(connection_key_pressed), NULL); | |
525 gtk_signal_connect(GTK_OBJECT(pd->aim_port_entry), "focus_out_event", GTK_SIGNAL_FUNC(connection_key_pressed), NULL); | |
526 gtk_signal_connect(GTK_OBJECT(pd->login_host_entry), "focus_out_event", GTK_SIGNAL_FUNC(connection_key_pressed), NULL); | |
527 gtk_signal_connect(GTK_OBJECT(pd->login_port_entry), "focus_out_event", GTK_SIGNAL_FUNC(connection_key_pressed), NULL); | |
528 gtk_signal_connect(GTK_OBJECT(pd->http_proxy_host_entry), "focus_out_event", GTK_SIGNAL_FUNC(connection_key_pressed), NULL); | |
529 gtk_signal_connect(GTK_OBJECT(pd->http_proxy_port_entry), "focus_out_event", GTK_SIGNAL_FUNC(connection_key_pressed), NULL); | |
530 | |
531 | |
532 /* Away */ | |
533 | |
534 a = awaymessage; | |
535 pd->cur_message = NULL; | |
536 pd->nwbutton = NULL; | |
537 pd->browser_entry = NULL; | |
538 | |
539 away_page = gtk_vbox_new(FALSE, 0); | |
540 away_topbox = gtk_hbox_new(FALSE, 0); | |
541 away_botbox = gtk_hbox_new(FALSE, 0); | |
542 | |
543 label = gtk_label_new("Away"); | |
544 gtk_widget_show(label); | |
545 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), away_page, label); | |
546 gtk_widget_show(away_page); | |
547 | |
548 sw2 = gtk_scrolled_window_new(NULL, NULL); | |
549 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), | |
550 GTK_POLICY_AUTOMATIC, | |
551 GTK_POLICY_AUTOMATIC); | |
552 gtk_widget_show(sw2); | |
553 | |
554 pd->away_list = gtk_list_new(); | |
555 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), pd->away_list); | |
556 gtk_box_pack_start(GTK_BOX(away_topbox), sw2, TRUE, TRUE, 0); | |
557 | |
558 sw = gtk_scrolled_window_new(NULL, NULL); | |
559 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
560 GTK_POLICY_AUTOMATIC, | |
561 GTK_POLICY_AUTOMATIC); | |
562 gtk_widget_show(sw); | |
563 | |
564 pd->away_text = gtk_text_new(NULL, NULL); | |
565 gtk_container_add(GTK_CONTAINER(sw), pd->away_text); | |
566 gtk_box_pack_start(GTK_BOX(away_topbox), sw, TRUE, TRUE, 0); | |
567 gtk_text_set_word_wrap(GTK_TEXT(pd->away_text), TRUE); | |
568 gtk_text_set_editable(GTK_TEXT(pd->away_text), TRUE ); | |
569 | |
570 add_away = gtk_button_new_with_label("Create Message"); | |
571 gtk_signal_connect(GTK_OBJECT(add_away), "clicked", GTK_SIGNAL_FUNC(create_away_mess), NULL); | |
572 gtk_box_pack_start(GTK_BOX(away_botbox), add_away, TRUE, FALSE, 5); | |
573 | |
574 remove_away = gtk_button_new_with_label("Remove Message"); | |
575 gtk_signal_connect(GTK_OBJECT(remove_away), "clicked", GTK_SIGNAL_FUNC(remove_away_message), NULL); | |
576 gtk_box_pack_start(GTK_BOX(away_botbox), remove_away, TRUE, FALSE, 5); | |
577 | |
578 gtk_box_pack_start(GTK_BOX(away_page), away_topbox, TRUE, TRUE, 0); | |
579 gtk_box_pack_start(GTK_BOX(away_page), away_botbox, FALSE, FALSE, 0); | |
580 | |
581 gtk_widget_show(add_away); | |
582 gtk_widget_show(remove_away); | |
583 gtk_widget_show(pd->away_list); | |
584 gtk_widget_show(pd->away_text); | |
585 gtk_widget_show(away_topbox); | |
586 gtk_widget_show(away_botbox); | |
587 | |
588 if (awy != NULL) { | |
589 a = (struct away_message *)awy->data; | |
590 g_snprintf(buffer, sizeof(buffer), "%s", a->message); | |
591 gtk_text_insert(GTK_TEXT(pd->away_text), NULL, NULL, NULL, buffer, -1); | |
592 } | |
593 | |
594 while(awy) { | |
595 a = (struct away_message *)awy->data; | |
596 label = gtk_label_new(a->name); | |
597 list_item = gtk_list_item_new(); | |
598 gtk_container_add(GTK_CONTAINER(list_item), label); | |
599 gtk_signal_connect(GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(away_list_clicked), a); | |
600 gtk_signal_connect(GTK_OBJECT(list_item), "deselect", GTK_SIGNAL_FUNC(away_list_unclicked), a); | |
601 gtk_object_set_user_data(GTK_OBJECT(list_item), a); | |
602 | |
603 gtk_widget_show(label); | |
604 gtk_container_add(GTK_CONTAINER(pd->away_list), list_item); | |
605 gtk_widget_show(list_item); | |
606 | |
607 awy = awy->next; | |
608 | |
609 } | |
610 | |
611 /* Sound */ | |
612 sound_page = gtk_vbox_new(FALSE, 0); | |
613 label = gtk_label_new("Sounds"); | |
614 gtk_widget_show(label); | |
615 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), sound_page, label); | |
616 gaim_button("Sound when buddy logs in", &sound_options, OPT_SOUND_LOGIN, sound_page); | |
617 gaim_button("Sound when buddy logs out", &sound_options, OPT_SOUND_LOGOUT, sound_page); | |
618 gaim_button("Sound when message is received", &sound_options, OPT_SOUND_RECV, sound_page); | |
619 gaim_button("Sound when message is sent", &sound_options, OPT_SOUND_SEND, sound_page); | |
620 gaim_button("Sound when first message is received", &sound_options, OPT_SOUND_FIRST_RCV, sound_page); | |
621 gaim_button("Sound when message is received if away", &sound_options, OPT_SOUND_WHEN_AWAY, sound_page); | |
109
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
84
diff
changeset
|
622 gaim_button("No sound for buddies signed on when you log in", &sound_options, OPT_SOUND_SILENT_SIGNON, sound_page); |
1 | 623 gtk_widget_show(sound_page); |
624 | |
625 | |
626 /* Browser */ | |
627 browser_page = gtk_vbox_new(FALSE, 0); | |
628 | |
629 label = gtk_label_new("Browser"); | |
630 gtk_widget_show(label); | |
631 | |
632 | |
633 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), browser_page, label); | |
634 browseropt = gtk_radio_button_new_with_label(NULL, "Netscape"); | |
635 gtk_box_pack_start(GTK_BOX(browser_page), browseropt, FALSE, FALSE, 0); | |
636 gtk_signal_connect(GTK_OBJECT(browseropt), "clicked", GTK_SIGNAL_FUNC(set_browser), (void *)BROWSER_NETSCAPE); | |
637 gtk_widget_show(browseropt); | |
638 if (web_browser == BROWSER_NETSCAPE) | |
639 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(browseropt), TRUE); | |
640 | |
641 browseropt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(browseropt)), "KFM (The KDE browser)"); | |
642 gtk_box_pack_start(GTK_BOX(browser_page), browseropt, FALSE, FALSE, 0); | |
643 gtk_signal_connect(GTK_OBJECT(browseropt), "clicked", GTK_SIGNAL_FUNC(set_browser), (void *)BROWSER_KFM); | |
644 gtk_widget_show(browseropt); | |
645 if (web_browser == BROWSER_KFM) | |
646 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(browseropt), TRUE); | |
647 | |
648 | |
649 browseropt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(browseropt)), "Internal HTML widget (Quite likely a bad idea!)"); | |
650 gtk_box_pack_start(GTK_BOX(browser_page), browseropt, FALSE, FALSE, 0); | |
651 gtk_signal_connect(GTK_OBJECT(browseropt), "clicked", GTK_SIGNAL_FUNC(set_browser), (void *)BROWSER_INTERNAL); | |
652 gtk_widget_show(browseropt); | |
653 if (web_browser == BROWSER_INTERNAL) | |
654 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(browseropt), TRUE); | |
655 | |
656 | |
657 browseropt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(browseropt)), "Manual"); | |
658 gtk_box_pack_start(GTK_BOX(browser_page), browseropt, FALSE, FALSE, 0); | |
659 gtk_signal_connect(GTK_OBJECT(browseropt), "clicked", GTK_SIGNAL_FUNC(set_browser), (void *)BROWSER_MANUAL); | |
660 gtk_widget_show(browseropt); | |
661 if (web_browser == BROWSER_MANUAL) | |
662 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(browseropt), TRUE); | |
663 | |
664 | |
665 pd->browser_entry = gtk_entry_new(); | |
666 gtk_widget_show(pd->browser_entry); | |
667 | |
668 gtk_box_pack_start(GTK_BOX(browser_page), pd->browser_entry, FALSE, FALSE, 0); | |
669 gtk_entry_set_text(GTK_ENTRY(pd->browser_entry), web_command); | |
670 | |
671 pd->nwbutton = gaim_button("Pop up new window by default", &general_options, OPT_GEN_BROWSER_POPUP, browser_page); | |
672 gtk_widget_show(browser_page); | |
673 | |
674 gtk_signal_connect(GTK_OBJECT(pd->browser_entry), "focus_out_event", GTK_SIGNAL_FUNC(manualentry_key_pressed), NULL); | |
675 | |
676 | |
677 | |
678 if (web_browser != BROWSER_MANUAL) { | |
679 gtk_widget_set_sensitive(pd->browser_entry, FALSE); | |
680 } else { | |
681 gtk_widget_set_sensitive(pd->browser_entry, TRUE); | |
682 } | |
683 | |
684 if (web_browser != BROWSER_NETSCAPE) { | |
685 gtk_widget_set_sensitive(pd->nwbutton, FALSE); | |
686 } else { | |
687 gtk_widget_set_sensitive(pd->nwbutton, TRUE); | |
688 } | |
689 | |
690 | |
691 | |
692 | |
693 /* Appearance */ | |
694 appearance_page = gtk_hbox_new(FALSE, 0); | |
695 label = gtk_label_new("Appearance"); | |
696 gtk_widget_show(label); | |
697 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), appearance_page, label); | |
698 appbox = gtk_vbox_new(FALSE, 5); | |
699 fontframe = gtk_frame_new("Font Properties"); | |
700 fontbox = gtk_vbox_new(FALSE, 5); | |
701 | |
702 gtk_box_pack_start(GTK_BOX(appearance_page), appbox, TRUE, TRUE, 5); | |
703 gtk_box_pack_start(GTK_BOX(appearance_page), fontframe, TRUE, TRUE, 5); | |
704 gtk_container_add(GTK_CONTAINER(fontframe), fontbox); | |
705 | |
706 gaim_button("Show time on messages", &display_options, OPT_DISP_SHOW_TIME, appbox); | |
707 gaim_button("Show numbers in groups", &display_options, OPT_DISP_SHOW_GRPNUM, appbox ); | |
708 gaim_button("Show buddy-type pixmaps", &display_options, OPT_DISP_SHOW_PIXMAPS, appbox ); | |
709 gaim_button("Show idle times", &display_options, OPT_DISP_SHOW_IDLETIME, appbox ); | |
710 gaim_button("Show button pixmaps", &display_options, OPT_DISP_SHOW_BUTTON_XPM, appbox ); | |
711 gaim_button("Ignore incoming colours", &display_options, OPT_DISP_IGNORE_COLOUR, appbox ); | |
712 #if 0 | |
713 gaim_button("Transparent text window (experimental)", &transparent, appbox ); | |
714 #endif | |
715 gaim_button("Show logon/logoffs in conversation windows", &display_options, OPT_DISP_SHOW_LOGON, appbox ); | |
84 | 716 #ifdef USE_APPLET |
82 | 717 gaim_button("Use devil icons in applet", &display_options, OPT_DISP_DEVIL_PIXMAPS, appbox ); |
718 #endif | |
1 | 719 |
720 | |
721 gaim_button("Bold Text", &font_options, OPT_FONT_BOLD, fontbox); | |
722 gaim_button("Italics Text", &font_options, OPT_FONT_ITALIC, fontbox); | |
723 gaim_button("Underlined Text", &font_options, OPT_FONT_UNDERLINE, fontbox); | |
724 gaim_button("Strike Text", &font_options, OPT_FONT_STRIKE, fontbox); | |
725 | |
726 gtk_widget_show(appearance_page); | |
727 gtk_widget_show(fontbox); | |
728 gtk_widget_show(fontframe); | |
729 gtk_widget_show(appbox); | |
730 | |
731 | |
732 /* Buddy Chats */ | |
733 chat_page = gtk_vbox_new(FALSE, 0); | |
734 label = gtk_label_new("Buddy Chats"); | |
735 | |
736 gtk_widget_show(label); | |
737 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), chat_page, label); | |
738 | |
739 do_chat_page(chat_page); | |
740 gtk_widget_show(chat_page); | |
741 | |
742 bbox = gtk_hbox_new(FALSE, 5); | |
743 close = gtk_button_new_with_label("Close"); | |
744 | |
745 /* Pack the button(s) in the button box */ | |
746 gtk_box_pack_end(GTK_BOX(bbox), close, FALSE, FALSE, 5); | |
747 gtk_box_pack_start(GTK_BOX(vbox),bbox, FALSE, FALSE, 5); | |
748 | |
749 gtk_widget_show(notebook); | |
750 gtk_widget_show(close); | |
751 | |
752 gtk_widget_show(bbox); | |
753 gtk_widget_show(vbox); | |
754 | |
755 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(handle_delete), NULL); | |
756 gtk_signal_connect(GTK_OBJECT(pd->window),"delete_event", GTK_SIGNAL_FUNC(handle_delete), NULL); | |
757 | |
758 } | |
759 | |
760 void show_prefs() | |
761 { | |
762 if (!pd || !pd->window) | |
763 build_prefs(); | |
764 gtk_widget_show(pd->window); | |
765 } | |
766 void add_chat(GtkWidget *w, struct chat_page *cp) | |
767 { | |
768 GList *sel = GTK_LIST(cp->list1)->selection; | |
769 struct chat_room *cr, *cr2; | |
770 GList *crs = chat_rooms; | |
771 GtkWidget *item; | |
772 | |
773 if (sel) { | |
774 cr = (struct chat_room *)gtk_object_get_user_data(GTK_OBJECT(sel->data)); | |
775 } else | |
776 return; | |
777 | |
778 while(crs) { | |
779 cr2 = (struct chat_room *)crs->data; | |
780 if (!strcasecmp(cr->name, cr2->name)) | |
781 return; | |
782 crs = crs->next; | |
783 } | |
784 item = gtk_list_item_new_with_label(cr->name); | |
785 cr2 = g_new0(struct chat_room, 1); | |
786 strcpy(cr2->name, cr->name); | |
787 cr2->exchange = cr->exchange; | |
788 gtk_object_set_user_data(GTK_OBJECT(item), cr2); | |
789 gtk_widget_show(item); | |
790 sel = g_list_append(NULL, item); | |
791 gtk_list_append_items(GTK_LIST(cp->list2), sel); | |
792 chat_rooms = g_list_append(chat_rooms, cr2); | |
793 | |
794 setup_buddy_chats(); | |
795 save_prefs(); | |
796 | |
797 | |
798 } | |
799 | |
800 void remove_chat(GtkWidget *w, struct chat_page *cp) | |
801 { | |
802 GList *sel = GTK_LIST(cp->list2)->selection; | |
803 struct chat_room *cr; | |
804 GList *crs; | |
805 GtkWidget *item; | |
806 | |
807 if (sel) { | |
808 item = (GtkWidget *)sel->data; | |
809 cr = (struct chat_room *)gtk_object_get_user_data(GTK_OBJECT(item)); | |
810 } else | |
811 return; | |
812 | |
813 chat_rooms = g_list_remove(chat_rooms, cr); | |
814 | |
815 | |
816 gtk_list_clear_items(GTK_LIST(cp->list2), 0, -1); | |
817 | |
818 if (g_list_length(chat_rooms) == 0) | |
819 chat_rooms = NULL; | |
820 | |
821 crs = chat_rooms; | |
822 | |
823 while(crs) { | |
824 cr = (struct chat_room *)crs->data; | |
825 item = gtk_list_item_new_with_label(cr->name); | |
826 gtk_object_set_user_data(GTK_OBJECT(item), cr); | |
827 gtk_widget_show(item); | |
828 gtk_list_append_items(GTK_LIST(cp->list2), g_list_append(NULL, item)); | |
829 | |
830 | |
831 crs = crs->next; | |
832 } | |
833 | |
834 setup_buddy_chats(); | |
835 save_prefs(); | |
836 } | |
837 | |
838 void refresh_list(GtkWidget *w, struct chat_page *cp) | |
839 { | |
840 char *text = grab_url("http://www.aol.com/community/chat/allchats.html"); | |
841 char *c; | |
842 int len = strlen(text); | |
843 GtkWidget *item; | |
844 GList *items = GTK_LIST(cp->list1)->children; | |
845 struct chat_room *cr; | |
846 c = text; | |
847 | |
848 while(items) { | |
849 g_free(gtk_object_get_user_data(GTK_OBJECT(items->data))); | |
850 items = items->next; | |
851 } | |
852 | |
853 items = NULL; | |
854 | |
855 gtk_list_clear_items(GTK_LIST(cp->list1), 0, -1); | |
856 | |
857 item = gtk_list_item_new_with_label("Gaim Chat"); | |
858 cr = g_new0(struct chat_room, 1); | |
859 strcpy(cr->name, "Gaim Chat"); | |
860 cr->exchange = 4; | |
861 gtk_object_set_user_data(GTK_OBJECT(item), cr); | |
862 gtk_widget_show(item); | |
863 | |
864 items = g_list_append(NULL, item); | |
865 | |
866 while(c) { | |
867 if (c - text > len - 30) | |
868 break; /* assume no chat rooms 30 from end, padding */ | |
869 if (!strncasecmp(AOL_SRCHSTR, c, strlen(AOL_SRCHSTR))) { | |
870 char *t; | |
871 int len=0; | |
872 int exchange; | |
873 char *name = NULL; | |
874 | |
875 c += strlen(AOL_SRCHSTR); | |
876 t = c; | |
877 while(t) { | |
878 len++; | |
879 name = g_realloc(name, len); | |
880 if (*t == '+') | |
881 name[len - 1] = ' '; | |
882 else if (*t == '&') { | |
883 name[len - 1] = 0; | |
884 sscanf(t, "&Exchange=%d", &exchange); | |
885 c = t + strlen("&Exchange=x"); | |
886 break; | |
887 } else | |
888 name[len - 1] = *t; | |
889 t++; | |
890 } | |
891 cr = g_new0(struct chat_room, 1); | |
892 strcpy(cr->name, name); | |
893 cr->exchange = exchange; | |
894 item = gtk_list_item_new_with_label(name); | |
895 gtk_widget_show(item); | |
896 items = g_list_append(items, item); | |
897 gtk_object_set_user_data(GTK_OBJECT(item), cr); | |
898 g_free(name); | |
899 } | |
900 c++; | |
901 } | |
902 gtk_list_append_items(GTK_LIST(cp->list1), items); | |
903 g_free(text); | |
904 } | |
905 | |
906 | |
907 | |
908 void do_chat_page(GtkWidget *page) | |
909 { | |
910 GtkWidget *table; | |
911 GtkWidget *rem_button, *add_button, *ref_button; | |
912 GtkWidget *list1, *list2; | |
913 GtkWidget *label; | |
914 GtkWidget *sw1, *sw2; | |
915 GtkWidget *item; | |
916 struct chat_page *cp = g_new0(struct chat_page, 1); | |
917 GList *crs = chat_rooms; | |
918 GList *items = NULL; | |
919 struct chat_room *cr; | |
920 | |
921 table = gtk_table_new(4, 2, FALSE); | |
922 gtk_widget_show(table); | |
923 | |
924 | |
925 gtk_box_pack_start(GTK_BOX(page), table, TRUE, TRUE, 0); | |
926 | |
927 | |
928 list1 = gtk_list_new(); | |
929 list2 = gtk_list_new(); | |
930 sw1 = gtk_scrolled_window_new(NULL, NULL); | |
931 sw2 = gtk_scrolled_window_new(NULL, NULL); | |
932 ref_button = gtk_button_new_with_label("Refresh"); | |
933 add_button = gtk_button_new_with_label("Add"); | |
934 rem_button = gtk_button_new_with_label("Remove"); | |
935 gtk_widget_show(list1); | |
936 gtk_widget_show(sw1); | |
937 gtk_widget_show(list2); | |
938 gtk_widget_show(sw2); | |
939 gtk_widget_show(ref_button); | |
940 gtk_widget_show(add_button); | |
941 gtk_widget_show(rem_button); | |
942 | |
943 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw1), list1); | |
944 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), list2); | |
945 | |
946 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw1), | |
947 GTK_POLICY_AUTOMATIC,GTK_POLICY_ALWAYS); | |
948 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), | |
949 GTK_POLICY_AUTOMATIC,GTK_POLICY_ALWAYS); | |
950 | |
951 cp->list1 = list1; | |
952 cp->list2 = list2; | |
953 | |
954 gtk_signal_connect(GTK_OBJECT(ref_button), "clicked", | |
955 GTK_SIGNAL_FUNC(refresh_list), cp); | |
956 gtk_signal_connect(GTK_OBJECT(rem_button), "clicked", | |
957 GTK_SIGNAL_FUNC(remove_chat), cp); | |
958 gtk_signal_connect(GTK_OBJECT(add_button), "clicked", | |
959 GTK_SIGNAL_FUNC(add_chat), cp); | |
960 | |
961 | |
962 | |
963 label = gtk_label_new("List of available chats"); | |
964 gtk_widget_show(label); | |
965 | |
966 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, | |
967 GTK_SHRINK, GTK_SHRINK, 0, 0); | |
968 gtk_table_attach(GTK_TABLE(table), ref_button, 0, 1, 1, 2, | |
969 GTK_SHRINK, GTK_SHRINK, 0, 0); | |
970 gtk_table_attach(GTK_TABLE(table), sw1, 0, 1, 2, 3, | |
971 GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, | |
972 5, 5); | |
973 gtk_table_attach(GTK_TABLE(table), add_button, 0, 1, 3, 4, | |
974 GTK_SHRINK, GTK_SHRINK, 0, 0); | |
975 | |
976 | |
977 label = gtk_label_new("List of subscribed chats"); | |
978 gtk_widget_show(label); | |
979 | |
980 gtk_table_attach(GTK_TABLE(table), label, 1, 2, 0, 1, | |
981 GTK_SHRINK, GTK_SHRINK, 0, 0); | |
982 gtk_table_attach(GTK_TABLE(table), sw2, 1, 2, 2, 3, | |
983 GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, | |
984 5, 5); | |
985 gtk_table_attach(GTK_TABLE(table), rem_button, 1, 2, 3, 4, | |
986 GTK_SHRINK, GTK_SHRINK, 0, 0); | |
987 | |
988 | |
989 item = gtk_list_item_new_with_label("Gaim Chat"); | |
990 cr = g_new0(struct chat_room, 1); | |
991 strcpy(cr->name, "Gaim Chat"); | |
992 cr->exchange = 4; | |
993 gtk_object_set_user_data(GTK_OBJECT(item), cr); | |
994 gtk_widget_show(item); | |
995 gtk_list_append_items(GTK_LIST(list1), g_list_append(NULL, item)); | |
996 | |
997 | |
998 while(crs) { | |
999 cr = (struct chat_room *)crs->data; | |
1000 item = gtk_list_item_new_with_label(cr->name); | |
1001 gtk_object_set_user_data(GTK_OBJECT(item), cr); | |
1002 gtk_widget_show(item); | |
1003 items = g_list_append(items, item); | |
1004 | |
1005 crs = crs->next; | |
1006 } | |
1007 | |
1008 gtk_list_append_items(GTK_LIST(list2), items); | |
1009 } | |
1010 | |
1011 | |
1012 | |
1013 | |
1014 | |
1015 void debug_print(char *chars) | |
1016 { | |
18 | 1017 if(general_options & OPT_GEN_DEBUG && dw) |
1 | 1018 gtk_text_insert(GTK_TEXT(dw->entry),NULL, NULL, NULL, chars, strlen(chars)); |
1019 #ifdef DEBUG | |
1020 printf("%s\n", chars); | |
1021 #endif | |
1022 } | |
1023 | |
1024 | |
1025 void build_debug() | |
1026 { | |
1027 GtkWidget *scroll; | |
1028 GtkWidget *box; | |
1029 if (!dw) | |
1030 dw = g_new0(struct debug_window, 1); | |
1031 | |
1032 box = gtk_hbox_new(FALSE,0); | |
1033 dw->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
1034 gtk_window_set_title(GTK_WINDOW(dw->window), "GAIM debug output window"); | |
1035 gtk_container_add(GTK_CONTAINER(dw->window), box); | |
1036 dw->entry = gtk_text_new(NULL,NULL); | |
1037 gtk_widget_set_usize(dw->entry, 500, 200); | |
1038 scroll = gtk_vscrollbar_new(GTK_TEXT(dw->entry)->vadj); | |
1039 gtk_box_pack_start(GTK_BOX(box), dw->entry, TRUE,TRUE,0); | |
1040 gtk_box_pack_end(GTK_BOX(box), scroll,FALSE,FALSE,0); | |
1041 gtk_widget_show(dw->entry); | |
1042 gtk_widget_show(scroll); | |
1043 gtk_widget_show(box); | |
1044 gtk_signal_connect(GTK_OBJECT(dw->window),"delete_event", GTK_SIGNAL_FUNC(debug_delete), NULL); | |
1045 gtk_widget_show(dw->window); | |
1046 } | |
1047 | |
1048 | |
1049 | |
1050 void show_debug(GtkObject * object) | |
1051 { | |
1052 if((general_options & OPT_GEN_DEBUG)) { | |
1053 if(!dw || !dw->window) | |
1054 build_debug(); | |
1055 gtk_widget_show(dw->window); | |
1056 } else { | |
1057 gtk_widget_destroy(dw->window); | |
1058 dw->window = NULL; | |
1059 } | |
1060 } | |
1061 |