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