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