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