Mercurial > pidgin
annotate src/dialogs.c @ 318:35796808896a
[gaim-migrate @ 328]
This is the way it's *SUPPOSED* to be done.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 02 Jun 2000 18:59:27 +0000 |
parents | 0a8b4edc4732 |
children | 0fa651368776 |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
22 #include <string.h> | |
23 #include <stdio.h> | |
24 #include <stdlib.h> | |
25 #include <time.h> | |
26 #include <sys/types.h> | |
27 #include <sys/stat.h> | |
28 #include <fcntl.h> | |
29 #include <sys/socket.h> | |
30 #include <netdb.h> | |
31 #include <netinet/in.h> | |
32 #include <unistd.h> | |
33 #include <netinet/in.h> | |
34 #include <arpa/inet.h> | |
35 | |
36 #include <gtk/gtk.h> | |
37 #include "gaim.h" | |
38 #include "gtkhtml.h" | |
39 | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
40 #define DEFAULT_FONT_NAME "-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1" |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
41 |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
42 char *fontface; |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
43 char *fontname; |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
44 |
1 | 45 static GtkWidget *imdialog = NULL; /*I only want ONE of these :) */ |
46 static GList *dialogwindows = NULL; | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
47 static GtkWidget *linkdialog, *exportdialog, *importdialog, *logdialog; |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
48 |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
49 static void accept_callback(GtkWidget *widget, struct file_transfer *t); |
1 | 50 |
51 struct create_away { | |
52 GtkWidget *window; | |
53 GtkWidget *entry; | |
54 GtkWidget *text; | |
55 GtkWidget *checkbx; | |
56 }; | |
57 | |
58 | |
59 struct warning { | |
60 GtkWidget *window; | |
61 GtkWidget *anon; | |
62 char *who; | |
63 }; | |
64 | |
65 struct addbuddy { | |
66 GtkWidget *window; | |
67 GtkWidget *combo; | |
68 GtkWidget *entry; | |
69 }; | |
70 | |
71 struct addperm { | |
72 GtkWidget *window; | |
73 GSList *buttons; | |
74 GtkWidget *entry; | |
75 }; | |
76 | |
77 struct addbp { | |
78 GtkWidget *window; | |
79 GtkWidget *nameentry; | |
80 GtkWidget *messentry; | |
81 GtkWidget *sendim; | |
82 GtkWidget *openwindow; | |
83 }; | |
84 | |
85 struct findbyemail { | |
86 GtkWidget *window; | |
87 GtkWidget *emailentry; | |
88 }; | |
89 | |
90 struct findbyinfo { | |
91 GtkWidget *window; | |
92 GtkWidget *firstentry; | |
93 GtkWidget *middleentry; | |
94 GtkWidget *lastentry; | |
95 GtkWidget *maidenentry; | |
96 GtkWidget *cityentry; | |
97 GtkWidget *stateentry; | |
98 GtkWidget *countryentry; | |
99 }; | |
100 | |
101 struct registerdlg { | |
102 GtkWidget *window; | |
103 GtkWidget *name; | |
104 GtkWidget *email; | |
105 GtkWidget *uname; | |
106 GtkWidget *sname; | |
107 GtkWidget *country; | |
108 }; | |
109 | |
110 struct info_dlg { | |
111 GtkWidget *window; | |
112 GtkWidget *text; | |
113 GtkWidget *close; | |
114 }; | |
115 | |
116 | |
117 struct set_info_dlg { | |
118 GtkWidget *window; | |
119 GtkWidget *text; | |
120 GtkWidget *save; | |
121 GtkWidget *cancel; | |
122 }; | |
123 | |
124 struct set_dir_dlg { | |
125 GtkWidget *window; | |
126 GtkWidget *first; | |
127 GtkWidget *middle; | |
128 GtkWidget *last; | |
129 GtkWidget *maiden; | |
130 GtkWidget *city; | |
131 GtkWidget *state; | |
132 GtkWidget *country; | |
133 GtkWidget *web; | |
134 GtkWidget *cancel; | |
135 GtkWidget *save; | |
136 }; | |
137 | |
138 struct linkdlg { | |
139 GtkWidget *ok; | |
140 GtkWidget *cancel; | |
141 GtkWidget *window; | |
142 GtkWidget *url; | |
143 GtkWidget *text; | |
144 GtkWidget *toggle; | |
145 GtkWidget *entry; | |
146 }; | |
147 | |
146 | 148 struct passwddlg { |
149 GtkWidget *window; | |
150 GtkWidget *ok; | |
151 GtkWidget *cancel; | |
152 GtkWidget *original; | |
153 GtkWidget *new1; | |
154 GtkWidget *new2; | |
155 }; | |
1 | 156 |
157 /*------------------------------------------------------------------------*/ | |
158 /* Function to Send an Email */ | |
159 /*------------------------------------------------------------------------*/ | |
160 | |
161 static int g_sendemail(char *name, char *email, int uname, int sname, char *country) | |
162 { | |
163 static char email_data[2000]; | |
164 int sock; | |
253
5b28ef2b550e
[gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
247
diff
changeset
|
165 struct in_addr *host; |
1 | 166 /* char data[3]; */ |
167 FILE *sockfile; | |
168 char uname_output; | |
169 FILE *tmpfile; | |
170 char filename[128]; | |
171 char buf[256]; | |
172 int i=0, tmpfd=-1; | |
173 | |
174 while (i<10000 && tmpfd < 0) { | |
175 g_snprintf(filename, 128, "/tmp/gaim_%s%d.tmp", current_user->username, i++); | |
176 | |
177 tmpfd = open(filename, O_RDWR|O_CREAT|O_EXCL, 0600); | |
178 } | |
179 | |
180 if(tmpfd < 0) { | |
181 return -1; | |
182 } | |
183 | |
184 | |
185 if (uname) | |
186 { | |
187 g_snprintf(buf, sizeof(buf), "uname -a > %s", filename); | |
188 system(buf); | |
189 } | |
190 | |
253
5b28ef2b550e
[gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
247
diff
changeset
|
191 host = (struct in_addr *)get_address(REG_SRVR); |
1 | 192 if (!host) |
193 { | |
194 printf("Error Resolving Mail Server.\n"); | |
195 return -1; | |
196 } | |
197 | |
253
5b28ef2b550e
[gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
247
diff
changeset
|
198 if ((sock = connect_address(host->s_addr, REG_PORT)) < 0) |
1 | 199 { |
200 printf("Error Connecting to Socket.\n"); | |
201 return -1; | |
202 } | |
203 | |
204 sockfile = fdopen(sock, "r+"); | |
205 | |
206 g_snprintf(email_data, sizeof(email_data), "mail from: %s\n", REG_EMAIL_ADDR); | |
207 fputs(email_data, sockfile); | |
208 | |
209 g_snprintf(email_data, sizeof(email_data), "rcpt to: %s\n", REG_EMAIL_ADDR); | |
210 fputs(email_data, sockfile); | |
211 | |
212 g_snprintf(email_data, sizeof(email_data), "data\n"); | |
213 fputs(email_data, sockfile); | |
214 g_snprintf(email_data, sizeof(email_data), "Subject: Registration Information\n\nBelow is the submitted Registration Information\n----------------------------------\nName: %s\nEmail: %s\nCountry: %s\nSName: %s\nGAIM: v%s\nUname: ", name, email, country, sname ? current_user->username : "N/A", VERSION); | |
215 fputs(email_data, sockfile); | |
216 | |
217 if (uname) | |
218 { | |
219 tmpfile = fopen(filename, "r"); | |
220 while (!feof(tmpfile)) | |
221 { | |
222 uname_output = fgetc(tmpfile); | |
223 if (!feof(tmpfile)) | |
224 fputc(uname_output, sockfile); | |
225 } | |
226 fclose(tmpfile); | |
227 } | |
228 | |
229 unlink(filename); | |
230 | |
231 g_snprintf(email_data, sizeof(email_data), "\n.\nquit\n\n"); | |
232 fputs(email_data, sockfile); | |
233 | |
234 /* while (fgets(data, 2, sockfile)) { | |
235 } | |
236 */ | |
237 /* I don't think the above is necessary... */ | |
238 | |
239 close(sock); | |
240 | |
241 return 1; | |
242 } | |
243 | |
244 /*------------------------------------------------------------------------*/ | |
245 /* Destroys */ | |
246 /*------------------------------------------------------------------------*/ | |
247 | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
248 static gint delete_event_dialog(GtkWidget *w, GdkEventAny *e, struct conversation *c) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
249 { |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
250 dialogwindows = g_list_remove(dialogwindows, w); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
251 gtk_widget_destroy(w); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
252 |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
253 if (GTK_IS_COLOR_SELECTION_DIALOG(w)) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
254 c->color_dialog = NULL; |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
255 if (GTK_IS_FONT_SELECTION_DIALOG(w)) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
256 c->font_dialog = NULL; |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
257 |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
258 return FALSE; |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
259 } |
1 | 260 |
261 static void destroy_dialog(GtkWidget *w, GtkWidget *w2) | |
262 { | |
263 GtkWidget *dest; | |
264 | |
265 if (!GTK_IS_WIDGET(w2)) | |
266 dest = w; | |
267 else | |
268 dest = w2; | |
269 | |
270 if (dest == imdialog) | |
271 imdialog = NULL; | |
272 | |
273 if (dest == exportdialog) | |
274 exportdialog = NULL; | |
275 | |
276 if (dest == importdialog) | |
277 importdialog = NULL; | |
278 | |
279 if (dest == logdialog) | |
280 logdialog = NULL; | |
281 | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
282 /* if (GTK_COLOR_SELECTION_DIALOG(dest)) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
283 color_dialog = NULL;*/ |
1 | 284 |
285 if (dest == linkdialog) | |
286 linkdialog = NULL; | |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
287 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
288 /* if (dest == fontdialog) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
289 fontdialog = NULL;*/ |
1 | 290 |
291 dialogwindows = g_list_remove(dialogwindows, dest); | |
292 gtk_widget_destroy(dest); | |
293 | |
294 } | |
295 | |
296 | |
297 void destroy_all_dialogs() | |
298 { | |
299 GList *d = dialogwindows; | |
300 | |
301 while(d) { | |
302 destroy_dialog(NULL, d->data); | |
303 d = d->next; | |
304 } | |
305 | |
306 g_list_free(dialogwindows); | |
307 dialogwindows = NULL; | |
308 | |
84 | 309 do_im_back(NULL, NULL); |
310 | |
1 | 311 if (imdialog) { |
312 destroy_dialog(NULL, imdialog); | |
313 imdialog = NULL; | |
314 } | |
315 | |
316 if (linkdialog) { | |
317 destroy_dialog(NULL, linkdialog); | |
318 linkdialog = NULL; | |
319 } | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
320 /* is this needed? */ |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
321 /* if (colordialog) { |
1 | 322 destroy_dialog(NULL, colordialog); |
323 colordialog = NULL; | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
324 }*/ |
1 | 325 |
326 if (exportdialog) { | |
327 destroy_dialog(NULL, exportdialog); | |
328 exportdialog = NULL; | |
329 } | |
330 | |
331 if (importdialog) { | |
332 destroy_dialog(NULL, exportdialog); | |
333 importdialog = NULL; | |
334 } | |
335 | |
336 if (logdialog) { | |
337 destroy_dialog(NULL, logdialog); | |
338 logdialog = NULL; | |
339 } | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
340 /* is this needed? */ |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
341 /* if (fontdialog) { |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
342 destroy_dialog(NULL, fontdialog); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
343 fontdialog = NULL; |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
344 }*/ |
1 | 345 } |
346 | |
347 static void do_warn(GtkWidget *widget, struct warning *w) | |
348 { | |
349 serv_warn(w->who, (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w->anon))) ? | |
350 1 : 0); | |
351 | |
352 destroy_dialog(NULL, w->window); | |
353 } | |
354 | |
355 | |
356 void show_warn_dialog(char *who) | |
357 { | |
358 GtkWidget *cancel; | |
359 GtkWidget *warn; | |
360 GtkWidget *label; | |
361 GtkWidget *vbox; | |
362 GtkWidget *bbox; | |
363 struct warning *w = g_new0(struct warning, 1); | |
364 | |
365 char *buf = g_malloc(128); | |
366 w->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
367 dialogwindows = g_list_prepend(dialogwindows, w->window); | |
368 cancel = gtk_button_new_with_label("Cancel"); | |
369 warn = gtk_button_new_with_label("Warn"); | |
370 bbox = gtk_hbox_new(TRUE, 10); | |
371 vbox = gtk_vbox_new(FALSE, 5); | |
372 | |
373 /* Put the buttons in the box */ | |
374 gtk_box_pack_start(GTK_BOX(bbox), warn, TRUE, TRUE, 10); | |
375 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 10); | |
376 | |
377 g_snprintf(buf, 127, "Do you really want to warn %s?", who); | |
378 label = gtk_label_new(buf); | |
379 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); | |
380 gtk_widget_show(label); | |
381 w->anon = gtk_check_button_new_with_label("Warn anonymously?"); | |
382 gtk_box_pack_start(GTK_BOX(vbox), w->anon, TRUE, TRUE, 0); | |
383 | |
384 label = gtk_label_new("Anonymous warnings are less harsh."); | |
385 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); | |
386 gtk_widget_show(label); | |
387 | |
388 w->who = who; | |
389 | |
390 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); | |
391 | |
392 /* Handle closes right */ | |
393 gtk_signal_connect(GTK_OBJECT(w->window), "delete_event", | |
394 GTK_SIGNAL_FUNC(destroy_dialog), w->window); | |
395 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
396 GTK_SIGNAL_FUNC(destroy_dialog), w->window); | |
397 gtk_signal_connect(GTK_OBJECT(warn), "clicked", | |
398 GTK_SIGNAL_FUNC(do_warn), w); | |
399 /* Finish up */ | |
400 gtk_widget_show(warn); | |
401 gtk_widget_show(cancel); | |
402 gtk_widget_show(w->anon); | |
403 gtk_widget_show(bbox); | |
404 gtk_widget_show(vbox); | |
405 gtk_window_set_title(GTK_WINDOW(w->window), "Gaim - Warn user?"); | |
406 gtk_container_add(GTK_CONTAINER(w->window), vbox); | |
407 gtk_widget_realize(w->window); | |
408 aol_icon(w->window->window); | |
409 | |
410 gtk_widget_show(w->window); | |
25 | 411 g_free(buf); |
1 | 412 } |
413 | |
414 | |
415 /*------------------------------------------------------------------------*/ | |
416 /* The dialog for getting an error */ | |
417 /*------------------------------------------------------------------------*/ | |
418 | |
419 void | |
420 do_error_dialog(char *message, char *title) | |
421 { | |
422 GtkWidget *d; | |
423 GtkWidget *label; | |
424 GtkWidget *close; | |
425 | |
426 | |
427 d = gtk_dialog_new(); | |
428 | |
429 label = gtk_label_new(message); | |
430 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
431 gtk_widget_show(label); | |
432 close = gtk_button_new_with_label("Close"); | |
433 gtk_widget_show(close); | |
434 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox), | |
435 label, FALSE, FALSE, 5); | |
436 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), | |
437 close, FALSE, FALSE, 5); | |
438 | |
439 | |
440 gtk_window_set_title(GTK_WINDOW(d), title); | |
441 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(destroy_dialog), d); | |
442 gtk_widget_realize(d); | |
443 aol_icon(d->window); | |
444 | |
445 gtk_widget_show(d); | |
446 } | |
447 | |
448 | |
449 | |
450 void show_error_dialog(char *c) | |
451 { | |
452 | |
453 int no = atoi(c); | |
454 char *w = strtok(NULL, ":"); | |
455 char buf[256]; | |
456 char buf2[32]; | |
457 | |
458 | |
459 switch(no) { | |
460 case 69: | |
461 g_snprintf(buf, sizeof(buf), "Unable to write file %s.", w); | |
462 break; | |
463 case 169: | |
464 g_snprintf(buf, sizeof(buf), "Unable to read file %s.", w); | |
465 break; | |
466 case 269: | |
467 g_snprintf(buf, sizeof(buf), "Message too long, last %s bytes truncated.", w); | |
468 break; | |
469 case 901: | |
470 g_snprintf(buf, sizeof(buf), "%s not currently logged in.", w); | |
471 break; | |
472 case 902: | |
473 g_snprintf(buf, sizeof(buf), "Warning of %s not allowed.", w); | |
474 break; | |
475 case 903: | |
476 g_snprintf(buf, sizeof(buf), "A message has been dropped, you are exceeding the server speed limit."); | |
477 break; | |
478 case 950: | |
479 g_snprintf(buf, sizeof(buf), "Chat in %s is not available.", w); | |
480 break; | |
481 case 960: | |
482 g_snprintf(buf, sizeof(buf), "You are sending messages too fast to %s.", w); | |
483 break; | |
484 case 961: | |
485 g_snprintf(buf, sizeof(buf), "You missed an IM from %s because it was too big.", w); | |
486 break; | |
487 case 962: | |
488 g_snprintf(buf, sizeof(buf), "You missed an IM from %s because it was sent too fast.", w); | |
489 break; | |
490 case 970: | |
491 g_snprintf(buf, sizeof(buf), "Failure."); | |
492 break; | |
493 case 971: | |
494 g_snprintf(buf, sizeof(buf), "Too many matches."); | |
495 break; | |
496 case 972: | |
497 g_snprintf(buf, sizeof(buf), "Need more qualifiers."); | |
498 break; | |
499 case 973: | |
500 g_snprintf(buf, sizeof(buf), "Dir service temporarily unavailable."); | |
501 break; | |
502 case 974: | |
503 g_snprintf(buf, sizeof(buf), "Email lookup restricted."); | |
504 break; | |
505 case 975: | |
506 g_snprintf(buf, sizeof(buf), "Keyword ignored."); | |
507 break; | |
508 case 976: | |
509 g_snprintf(buf, sizeof(buf), "No keywords."); | |
510 break; | |
511 case 977: | |
512 g_snprintf(buf, sizeof(buf), "User has no directory information."); | |
513 /* g_snprintf(buf, sizeof(buf), "Language not supported."); */ | |
514 break; | |
515 case 978: | |
516 g_snprintf(buf, sizeof(buf), "Country not supported."); | |
517 break; | |
518 case 979: | |
519 g_snprintf(buf, sizeof(buf), "Failure unknown: %s.", w); | |
520 break; | |
521 case 980: | |
522 g_snprintf(buf, sizeof(buf), "Incorrect nickname or password."); | |
523 break; | |
524 case 981: | |
525 g_snprintf(buf, sizeof(buf), "The service is temporarily unavailable."); | |
526 break; | |
527 case 982: | |
528 g_snprintf(buf, sizeof(buf), "Your warning level is currently too high to log in."); | |
529 break; | |
530 case 983: | |
531 g_snprintf(buf, sizeof(buf), "You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."); | |
532 break; | |
533 case 989: | |
534 g_snprintf(buf, sizeof(buf), "An unknown signon error has occurred: %s.", w); | |
535 break; | |
536 default: | |
537 g_snprintf(buf, sizeof(buf), "An unknown error, %d, has occured. Info: %s", no, w); | |
538 } | |
539 | |
540 g_snprintf(buf2, sizeof(buf2), "Gaim - Error %d", no); | |
541 | |
542 | |
543 do_error_dialog(buf, buf2); | |
544 return; | |
545 } | |
546 | |
547 static void do_im(GtkWidget *widget, GtkWidget *imentry) | |
548 { | |
549 char *who; | |
550 struct conversation *c; | |
551 | |
552 who = g_strdup(normalize(gtk_entry_get_text(GTK_ENTRY(imentry)))); | |
553 | |
554 destroy_dialog(NULL, imdialog); | |
555 imdialog = NULL; | |
556 | |
557 if (!strcasecmp(who, "")) { | |
558 g_free(who); | |
559 return; | |
560 } | |
561 | |
562 c = find_conversation(who); | |
563 | |
564 if (c == NULL) { | |
565 c = new_conversation(who); | |
566 } else { | |
567 gdk_window_raise(c->window->window); | |
568 } | |
569 g_free(who); | |
570 } | |
571 | |
572 void show_ee_dialog(int ee) | |
573 { | |
574 GtkWidget *ok; | |
575 GtkWidget *label; | |
576 GtkWidget *box; | |
577 GtkWidget *eedialog; | |
578 | |
579 eedialog = gtk_window_new(GTK_WINDOW_DIALOG); | |
580 ok = gtk_button_new_with_label("OK"); | |
581 box = gtk_vbox_new(FALSE, 10); | |
582 | |
583 if (ee == 0) | |
584 label = gtk_label_new("Amazing! Simply Amazing!"); | |
585 else if (ee == 1) | |
586 label = gtk_label_new("Pimpin\' Penguin Style! *Waddle Waddle*"); | |
587 else | |
588 label = gtk_label_new("You should be me. I'm so cute!"); | |
589 | |
590 gtk_widget_show(label); | |
591 gtk_widget_show(ok); | |
592 | |
593 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 10); | |
594 gtk_box_pack_start(GTK_BOX(box), ok, FALSE, FALSE, 10); | |
595 | |
596 gtk_widget_show(box); | |
597 | |
598 gtk_container_add(GTK_CONTAINER(eedialog), box); | |
599 gtk_window_set_title(GTK_WINDOW(eedialog), "Gaim - SUPRISE!"); | |
600 | |
601 gtk_signal_connect(GTK_OBJECT(ok), "clicked", | |
602 GTK_SIGNAL_FUNC(destroy_dialog), eedialog); | |
603 gtk_widget_realize(eedialog); | |
604 aol_icon(eedialog->window); | |
605 | |
606 gtk_widget_show(eedialog); | |
607 } | |
608 | |
609 void show_im_dialog(GtkWidget *w, GtkWidget *w2) | |
610 { | |
611 GtkWidget *cancel; | |
612 GtkWidget *ok; | |
613 GtkWidget *imentry; | |
614 GtkWidget *vbox; | |
615 GtkWidget *ebox; | |
616 GtkWidget *bbox; | |
617 GtkWidget *label; | |
618 | |
619 if (!imdialog) { | |
620 | |
621 imdialog = gtk_window_new(GTK_WINDOW_DIALOG); | |
622 cancel = gtk_button_new_with_label("Cancel"); | |
623 ok = gtk_button_new_with_label("OK"); | |
624 bbox = gtk_hbox_new(TRUE, 10); | |
625 vbox = gtk_vbox_new(FALSE, 5); | |
626 ebox = gtk_hbox_new(FALSE, 2); | |
627 | |
628 /* Put the buttons in the box */ | |
629 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 10); | |
630 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 10); | |
631 | |
632 label = gtk_label_new("IM who: "); | |
633 gtk_box_pack_start(GTK_BOX(ebox), label, TRUE, TRUE, 10); | |
634 gtk_widget_show(label); | |
635 | |
636 imentry = gtk_entry_new(); | |
637 gtk_box_pack_start(GTK_BOX(ebox), imentry, TRUE, TRUE, 10); | |
638 | |
639 gtk_box_pack_start(GTK_BOX(vbox), ebox, FALSE, FALSE, 5); | |
640 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); | |
641 | |
642 /* Handle closes right */ | |
643 gtk_signal_connect(GTK_OBJECT(imentry), "activate", | |
644 GTK_SIGNAL_FUNC(do_im), imentry); | |
645 gtk_signal_connect(GTK_OBJECT(imdialog), "destroy", | |
646 GTK_SIGNAL_FUNC(destroy_dialog), imdialog); | |
647 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
648 GTK_SIGNAL_FUNC(destroy_dialog), imdialog); | |
649 gtk_signal_connect(GTK_OBJECT(ok), "clicked", | |
650 GTK_SIGNAL_FUNC(do_im), imentry); | |
651 /* Finish up */ | |
652 gtk_widget_show(ok); | |
653 gtk_widget_show(cancel); | |
654 gtk_widget_show(ebox); | |
655 gtk_widget_show(imentry); | |
656 gtk_widget_show(bbox); | |
657 gtk_widget_show(vbox); | |
658 gtk_window_set_title(GTK_WINDOW(imdialog), "Gaim - IM user"); | |
659 gtk_container_add(GTK_CONTAINER(imdialog), vbox); | |
660 gtk_widget_grab_focus(imentry); | |
661 gtk_widget_realize(imdialog); | |
662 aol_icon(imdialog->window); | |
663 | |
664 } | |
665 gtk_widget_show(imdialog); | |
666 } | |
667 | |
668 | |
669 /*------------------------------------------------------------------------*/ | |
670 /* The dialog for adding buddies */ | |
671 /*------------------------------------------------------------------------*/ | |
672 | |
673 void do_add_buddy(GtkWidget *w, struct addbuddy *a) | |
674 { | |
675 char *grp, *who; | |
676 struct conversation *c; | |
677 | |
678 who = gtk_entry_get_text(GTK_ENTRY(a->entry)); | |
679 grp = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(a->combo)->entry)); | |
680 | |
681 c = find_conversation(who); | |
682 | |
683 add_buddy(grp, who); | |
684 | |
685 if (c != NULL) | |
686 gtk_label_set_text(GTK_LABEL(GTK_BIN(c->add_button)->child), "Remove"); | |
687 | |
688 build_edit_tree(); | |
689 | |
690 serv_save_config(); | |
691 | |
692 serv_add_buddy(who); | |
693 | |
228 | 694 do_export( (GtkWidget *) NULL, 0 ); |
695 | |
1 | 696 update_num_groups(); |
697 | |
698 destroy_dialog(NULL, a->window); | |
699 } | |
700 | |
701 | |
702 static GList *groups_tree() | |
703 { | |
704 GList *tmp=NULL; | |
705 char *tmp2; | |
706 struct group *g; | |
707 GList *grp = groups; | |
708 | |
709 if (!grp) { | |
710 tmp2 = g_strdup("Buddies"); | |
711 tmp = g_list_append(tmp, tmp2); | |
712 } else { | |
713 while(grp) { | |
714 g = (struct group *)grp->data; | |
715 tmp2 = g->name; | |
716 tmp=g_list_append(tmp, tmp2); | |
717 grp = grp->next; | |
718 } | |
719 } | |
720 return tmp; | |
721 } | |
722 | |
723 | |
724 void show_add_buddy(char *buddy, char *group) | |
725 { | |
726 GtkWidget *cancel; | |
727 GtkWidget *add; | |
728 GtkWidget *label; | |
729 GtkWidget *bbox; | |
730 GtkWidget *vbox; | |
731 GtkWidget *topbox; | |
236 | 732 GtkWidget *frame; |
733 | |
1 | 734 struct addbuddy *a = g_new0(struct addbuddy, 1); |
735 | |
736 a->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
737 dialogwindows = g_list_prepend(dialogwindows, a->window); | |
738 cancel = gtk_button_new_with_label("Cancel"); | |
739 add = gtk_button_new_with_label("Add"); | |
740 bbox = gtk_hbox_new(TRUE, 10); | |
741 topbox = gtk_hbox_new(FALSE, 5); | |
742 vbox = gtk_vbox_new(FALSE, 5); | |
244 | 743 |
1 | 744 a->entry = gtk_entry_new(); |
745 a->combo = gtk_combo_new(); | |
746 /* Fix the combo box */ | |
747 gtk_combo_set_popdown_strings(GTK_COMBO(a->combo), groups_tree()); | |
748 /* Put the buttons in the box */ | |
236 | 749 |
1 | 750 gtk_box_pack_start(GTK_BOX(bbox), add, TRUE, TRUE, 10); |
751 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 10); | |
752 | |
236 | 753 frame = gtk_frame_new(NULL); |
754 gtk_frame_set_label(GTK_FRAME(frame), "Add Buddy"); | |
755 | |
238 | 756 label = gtk_label_new("Buddy"); |
1 | 757 gtk_widget_show(label); |
758 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); | |
759 gtk_box_pack_start(GTK_BOX(topbox), a->entry, FALSE, FALSE, 5); | |
760 if (buddy != NULL) | |
761 gtk_entry_set_text(GTK_ENTRY(a->entry), buddy); | |
762 | |
238 | 763 label = gtk_label_new("Group"); |
1 | 764 gtk_widget_show(label); |
765 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); | |
766 gtk_box_pack_start(GTK_BOX(topbox), a->combo, FALSE, FALSE, 5); | |
767 | |
768 if (group != NULL) | |
769 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(a->combo)->entry), group); | |
770 | |
771 /* And the boxes in the box */ | |
772 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); | |
773 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); | |
774 | |
775 /* Handle closes right */ | |
776 gtk_signal_connect(GTK_OBJECT(a->window), "destroy", | |
777 GTK_SIGNAL_FUNC(destroy_dialog), a->window); | |
778 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
779 GTK_SIGNAL_FUNC(destroy_dialog), a->window); | |
780 gtk_signal_connect(GTK_OBJECT(add), "clicked", | |
781 GTK_SIGNAL_FUNC(do_add_buddy), a); | |
782 gtk_signal_connect(GTK_OBJECT(a->entry), "activate", | |
783 GTK_SIGNAL_FUNC(do_add_buddy), a); | |
784 /* Finish up */ | |
785 gtk_widget_show(add); | |
786 gtk_widget_show(cancel); | |
787 gtk_widget_show(a->combo); | |
788 gtk_widget_show(a->entry); | |
789 gtk_widget_show(topbox); | |
790 gtk_widget_show(bbox); | |
791 gtk_widget_show(vbox); | |
236 | 792 gtk_widget_show(frame); |
1 | 793 gtk_window_set_title(GTK_WINDOW(a->window), "Gaim - Add Buddy"); |
794 gtk_window_set_focus(GTK_WINDOW(a->window), a->entry); | |
245 | 795 gtk_container_add(GTK_CONTAINER(frame), vbox); |
236 | 796 gtk_container_add(GTK_CONTAINER(a->window), frame); |
797 gtk_container_set_border_width(GTK_CONTAINER(a->window), 5); | |
1 | 798 gtk_widget_realize(a->window); |
799 aol_icon(a->window->window); | |
800 | |
801 gtk_widget_show(a->window); | |
802 } | |
803 | |
804 | |
805 /*------------------------------------------------------------------------*/ | |
806 /* The dialog for new buddy pounces */ | |
807 /*------------------------------------------------------------------------*/ | |
808 | |
809 | |
810 void do_new_bp(GtkWidget *w, struct addbp *b) | |
811 { | |
812 struct buddy_pounce *bp = g_new0(struct buddy_pounce, 1); | |
813 | |
26 | 814 g_snprintf(bp->name, 80, "%s", gtk_entry_get_text(GTK_ENTRY(b->nameentry))); |
815 g_snprintf(bp->message, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->messentry))); | |
816 | |
1 | 817 if (GTK_TOGGLE_BUTTON(b->openwindow)->active) |
818 bp->popup = 1; | |
819 else | |
820 bp->popup = 0; | |
821 | |
822 if (GTK_TOGGLE_BUTTON(b->sendim)->active) | |
823 bp->sendim = 1; | |
824 else | |
825 bp->sendim = 0; | |
26 | 826 |
1 | 827 buddy_pounces = g_list_append(buddy_pounces, bp); |
828 | |
829 do_bp_menu(); | |
830 | |
831 destroy_dialog(NULL, b->window); | |
832 g_free(b); | |
833 } | |
834 | |
835 | |
836 void show_new_bp(char *name) | |
837 { | |
838 GtkWidget *cancel; | |
839 GtkWidget *ok; | |
840 GtkWidget *label; | |
841 GtkWidget *bbox; | |
842 GtkWidget *vbox; | |
843 | |
844 struct addbp *b = g_new0(struct addbp, 1); | |
845 | |
846 b->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
847 dialogwindows = g_list_prepend(dialogwindows, b->window); | |
848 cancel = gtk_button_new_with_label("Cancel"); | |
849 ok = gtk_button_new_with_label("OK"); | |
850 bbox = gtk_hbox_new(TRUE, 10); | |
851 vbox = gtk_vbox_new(FALSE, 5); | |
852 b->nameentry = gtk_entry_new(); | |
853 b->messentry = gtk_entry_new(); | |
854 | |
855 /* Put the buttons in the box */ | |
856 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 10); | |
857 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 10); | |
858 | |
859 label = gtk_label_new("Buddy To Pounce:"); | |
860 gtk_widget_show(label); | |
861 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
862 gtk_box_pack_start(GTK_BOX(vbox), b->nameentry, FALSE, FALSE, 0); | |
863 | |
864 b->openwindow = gtk_check_button_new_with_label("Open IM Window on Buddy Logon"); | |
865 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->openwindow), FALSE); | |
866 | |
867 b->sendim = gtk_check_button_new_with_label("Send IM on Buddy Logon"); | |
868 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sendim), TRUE); | |
869 | |
870 gtk_widget_show(b->openwindow); | |
871 gtk_widget_show(b->sendim); | |
872 gtk_box_pack_start(GTK_BOX(vbox), b->openwindow, FALSE, FALSE, 0); | |
873 gtk_box_pack_start(GTK_BOX(vbox), b->sendim, FALSE, FALSE, 0); | |
874 | |
875 label = gtk_label_new("Message to send:"); | |
876 gtk_widget_show(label); | |
877 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
878 gtk_box_pack_start(GTK_BOX(vbox), b->messentry, FALSE, FALSE, 0); | |
879 | |
880 | |
881 /* And the boxes in the box */ | |
882 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
883 | |
884 /* Handle closes right */ | |
885 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", | |
886 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
887 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
888 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
889 gtk_signal_connect(GTK_OBJECT(ok), "clicked", | |
890 GTK_SIGNAL_FUNC(do_new_bp), b); | |
891 gtk_signal_connect(GTK_OBJECT(b->messentry), "activate", | |
892 GTK_SIGNAL_FUNC(do_new_bp), b); | |
893 | |
894 | |
895 /* Finish up */ | |
896 gtk_widget_show(ok); | |
897 gtk_widget_show(cancel); | |
898 gtk_widget_show(b->nameentry); | |
899 gtk_widget_show(b->messentry); | |
900 gtk_widget_show(bbox); | |
901 gtk_widget_show(vbox); | |
902 gtk_window_set_title(GTK_WINDOW(b->window), "Gaim - New Buddy Pounce"); | |
903 if (name != NULL) { | |
904 gtk_entry_set_text(GTK_ENTRY(b->nameentry), name); | |
905 gtk_window_set_focus(GTK_WINDOW(b->window), b->messentry); | |
906 } else | |
907 gtk_window_set_focus(GTK_WINDOW(b->window), b->nameentry); | |
908 gtk_container_add(GTK_CONTAINER(b->window), vbox); | |
909 gtk_container_border_width(GTK_CONTAINER(b->window), 10); | |
910 gtk_widget_realize(b->window); | |
911 aol_icon(b->window->window); | |
912 | |
913 gtk_widget_show(b->window); | |
914 } | |
915 | |
916 | |
917 | |
918 /*------------------------------------------------------------------------*/ | |
919 /* The dialog for SET INFO / SET DIR INFO */ | |
920 /*------------------------------------------------------------------------*/ | |
921 | |
922 void do_save_info(GtkWidget *widget, struct set_info_dlg *b) | |
923 { | |
924 gchar *junk; | |
925 char *buf; | |
926 | |
927 junk = gtk_editable_get_chars(GTK_EDITABLE(b->text), 0, -1); | |
928 | |
929 g_snprintf(current_user->user_info, sizeof(current_user->user_info), "%s", junk); | |
25 | 930 |
1 | 931 save_prefs(); |
932 | |
79 | 933 buf = g_malloc(strlen(current_user->user_info) * 4); |
122
521db4bf5f28
[gaim-migrate @ 132]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
84
diff
changeset
|
934 if (!buf) { |
521db4bf5f28
[gaim-migrate @ 132]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
84
diff
changeset
|
935 buf = g_malloc(1); |
521db4bf5f28
[gaim-migrate @ 132]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
84
diff
changeset
|
936 buf[0] = 0; |
521db4bf5f28
[gaim-migrate @ 132]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
84
diff
changeset
|
937 } |
1 | 938 g_snprintf(buf, strlen(current_user->user_info) * 2, "%s", current_user->user_info); |
939 escape_text(buf); | |
940 serv_set_info(buf); | |
941 g_free(buf); | |
25 | 942 g_free(junk); |
1 | 943 destroy_dialog(NULL, b->window); |
944 g_free(b); | |
945 } | |
946 | |
947 void do_set_dir(GtkWidget *widget, struct set_dir_dlg *b) | |
948 { | |
949 char *first = gtk_entry_get_text(GTK_ENTRY(b->first)); | |
950 int web = GTK_TOGGLE_BUTTON(b->web)->active; | |
951 char *middle = gtk_entry_get_text(GTK_ENTRY(b->middle)); | |
952 char *last = gtk_entry_get_text(GTK_ENTRY(b->last)); | |
953 char *maiden = gtk_entry_get_text(GTK_ENTRY(b->maiden)); | |
954 char *city = gtk_entry_get_text(GTK_ENTRY(b->city)); | |
955 char *state = gtk_entry_get_text(GTK_ENTRY(b->state)); | |
956 char *country = gtk_entry_get_text(GTK_ENTRY(b->country)); | |
957 | |
958 | |
959 serv_set_dir(first, middle, last, maiden, city, state, country, web); | |
960 | |
961 destroy_dialog(NULL, b->window); | |
962 g_free(b); | |
963 } | |
964 | |
965 void show_set_dir() | |
966 { | |
967 GtkWidget *label; | |
968 GtkWidget *bot; | |
969 GtkWidget *top; | |
970 GtkWidget *table; | |
971 | |
972 struct set_dir_dlg *b = g_new0(struct set_dir_dlg, 1); | |
973 | |
974 b->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
975 dialogwindows = g_list_prepend(dialogwindows, b->window); | |
976 | |
977 b->cancel = gtk_button_new_with_label("Cancel"); | |
978 b->save = gtk_button_new_with_label("Save"); | |
979 | |
980 bot = gtk_hbox_new(TRUE, 10); | |
981 top = gtk_vbox_new(FALSE, 10); | |
982 | |
983 gtk_widget_show(b->save); | |
984 gtk_widget_show(b->cancel); | |
985 | |
986 gtk_box_pack_start(GTK_BOX(bot), b->save, FALSE, FALSE, 5); | |
987 gtk_box_pack_start(GTK_BOX(bot), b->cancel, FALSE, FALSE, 5); | |
988 | |
989 gtk_widget_show(bot); | |
990 | |
991 table = gtk_table_new(10, 2, FALSE); | |
992 | |
993 b->first = gtk_entry_new(); | |
994 b->middle = gtk_entry_new(); | |
995 b->last = gtk_entry_new(); | |
996 b->maiden = gtk_entry_new(); | |
997 b->city = gtk_entry_new(); | |
998 b->state = gtk_entry_new(); | |
999 b->country = gtk_entry_new(); | |
1000 b->web = gtk_check_button_new_with_label("Allow Web Searches To Find Your Info"); | |
1001 | |
1002 label = gtk_label_new("First Name"); | |
1003 gtk_widget_show(label); | |
1004 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
1005 gtk_table_attach_defaults(GTK_TABLE(table), b->first, 1, 2, 0, 1); | |
1006 | |
1007 label = gtk_label_new("Middle Name"); | |
1008 gtk_widget_show(label); | |
1009 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
1010 gtk_table_attach_defaults(GTK_TABLE(table), b->middle, 1, 2, 1, 2); | |
1011 | |
1012 label = gtk_label_new("Last Name"); | |
1013 gtk_widget_show(label); | |
1014 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3); | |
1015 gtk_table_attach_defaults(GTK_TABLE(table), b->last, 1, 2, 2, 3); | |
1016 | |
1017 label = gtk_label_new("Maiden Name"); | |
1018 gtk_widget_show(label); | |
1019 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4); | |
1020 gtk_table_attach_defaults(GTK_TABLE(table), b->maiden, 1, 2, 3, 4); | |
1021 | |
1022 label = gtk_label_new("City"); | |
1023 gtk_widget_show(label); | |
1024 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 4, 5); | |
1025 gtk_table_attach_defaults(GTK_TABLE(table), b->city, 1, 2, 4, 5); | |
1026 | |
1027 label = gtk_label_new("State"); | |
1028 gtk_widget_show(label); | |
1029 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 5, 6); | |
1030 gtk_table_attach_defaults(GTK_TABLE(table), b->state, 1, 2, 5, 6); | |
1031 | |
1032 label = gtk_label_new("Country"); | |
1033 gtk_widget_show(label); | |
1034 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 6, 7); | |
1035 gtk_table_attach_defaults(GTK_TABLE(table), b->country, 1, 2, 6, 7); | |
1036 | |
1037 gtk_table_attach_defaults(GTK_TABLE(table), b->web, 0, 2, 8, 9); | |
1038 | |
1039 gtk_widget_show(table); | |
1040 gtk_box_pack_start(GTK_BOX(top), table, FALSE, FALSE, 5); | |
1041 gtk_box_pack_start(GTK_BOX(top), bot, FALSE, FALSE, 5); | |
1042 | |
1043 gtk_widget_show(b->first); | |
1044 gtk_widget_show(b->middle); | |
1045 gtk_widget_show(b->last); | |
1046 gtk_widget_show(b->maiden); | |
1047 gtk_widget_show(b->city); | |
1048 gtk_widget_show(b->state); | |
1049 gtk_widget_show(b->country); | |
1050 gtk_widget_show(b->web); | |
1051 | |
1052 gtk_widget_show(top); | |
1053 | |
1054 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", | |
1055 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1056 gtk_signal_connect(GTK_OBJECT(b->cancel), "clicked", | |
1057 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1058 gtk_signal_connect(GTK_OBJECT(b->save), "clicked", GTK_SIGNAL_FUNC(do_set_dir), b); | |
1059 | |
1060 gtk_container_add(GTK_CONTAINER(b->window), top); | |
1061 gtk_container_border_width(GTK_CONTAINER(b->window), 10); | |
1062 gtk_widget_set_usize(b->window, 530, 280); | |
1063 gtk_window_set_title(GTK_WINDOW(b->window), "Gaim - Set Dir Info"); | |
1064 gtk_window_set_focus(GTK_WINDOW(b->window), b->first); | |
1065 gtk_widget_realize(b->window); | |
1066 aol_icon(b->window->window); | |
1067 | |
1068 gtk_widget_show(b->window); | |
1069 } | |
1070 | |
149 | 1071 void do_change_password(GtkWidget *widget, struct passwddlg *b) |
1072 { | |
1073 gchar *orig, *new1, *new2; | |
1074 gchar *buf; | |
1075 | |
1076 orig = gtk_entry_get_text(GTK_ENTRY(b->original)); | |
1077 new1 = gtk_entry_get_text(GTK_ENTRY(b->new1)); | |
1078 new2 = gtk_entry_get_text(GTK_ENTRY(b->new2)); | |
1079 | |
1080 if (strcasecmp(new1, new2)) { | |
1081 do_error_dialog("New Passwords Do Not Match", "Gaim - Change Password Error"); | |
1082 return ; | |
1083 } | |
1084 | |
1085 if ((strlen(orig) < 1) || (strlen(new1) < 1) || (strlen(new2) < 1)) { | |
1086 do_error_dialog("Fill out all fields completely", "Gaim - Change Password Error"); | |
1087 return; | |
1088 } | |
1089 | |
237
6ced2f1c8b24
[gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
236
diff
changeset
|
1090 serv_change_passwd(orig, new1); |
149 | 1091 |
1092 destroy_dialog(NULL, b->window); | |
1093 g_free(b); | |
1094 } | |
1095 | |
146 | 1096 void show_change_passwd() |
1097 { | |
1098 GtkWidget *hbox; | |
1099 GtkWidget *label; | |
1100 GtkWidget *vbox; | |
149 | 1101 GtkWidget *table; |
146 | 1102 struct passwddlg *b = g_new0(struct passwddlg, 1); |
1103 | |
1104 b->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
1105 dialogwindows = g_list_prepend(dialogwindows, b->window); | |
149 | 1106 |
146 | 1107 b->ok = gtk_button_new_with_label("Ok"); |
149 | 1108 b->cancel = gtk_button_new_with_label("Cancel"); |
1109 | |
1110 gtk_widget_show(b->ok); | |
1111 gtk_widget_show(b->cancel); | |
1112 | |
1113 table = gtk_table_new(3, 2, TRUE); | |
1114 | |
1115 | |
1116 | |
146 | 1117 label = gtk_label_new("Original Password"); |
1118 gtk_widget_show(label); | |
149 | 1119 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); |
146 | 1120 b->original = gtk_entry_new(); |
160
aaa8f0a2140e
[gaim-migrate @ 170]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
149
diff
changeset
|
1121 gtk_entry_set_visibility(GTK_ENTRY(b->original), FALSE); |
149 | 1122 gtk_widget_show(b->original); |
1123 gtk_table_attach_defaults(GTK_TABLE(table), b->original, 1, 2, 0, 1); | |
1124 | |
1125 label = gtk_label_new("New Password"); | |
1126 gtk_widget_show(label); | |
1127 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
1128 b->new1 = gtk_entry_new(); | |
160
aaa8f0a2140e
[gaim-migrate @ 170]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
149
diff
changeset
|
1129 gtk_entry_set_visibility(GTK_ENTRY(b->new1), FALSE); |
149 | 1130 gtk_widget_show(b->new1); |
1131 gtk_table_attach_defaults(GTK_TABLE(table), b->new1, 1, 2, 1, 2); | |
1132 | |
1133 label = gtk_label_new("New Password (again)"); | |
1134 gtk_widget_show(label); | |
1135 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3); | |
1136 b->new2 = gtk_entry_new(); | |
160
aaa8f0a2140e
[gaim-migrate @ 170]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
149
diff
changeset
|
1137 gtk_entry_set_visibility(GTK_ENTRY(b->new2), FALSE); |
149 | 1138 gtk_widget_show(b->new2); |
1139 gtk_table_attach_defaults(GTK_TABLE(table), b->new2, 1, 2, 2, 3); | |
1140 | |
1141 gtk_widget_show(table); | |
1142 | |
1143 vbox = gtk_vbox_new(TRUE, TRUE); | |
1144 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 5); | |
1145 | |
1146 hbox = gtk_hbox_new(TRUE, TRUE); | |
1147 gtk_box_pack_start(GTK_BOX(hbox), b->ok, FALSE, FALSE, 5); | |
1148 gtk_box_pack_start(GTK_BOX(hbox), b->cancel, FALSE, FALSE, 5); | |
1149 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
146 | 1150 gtk_widget_show(hbox); |
1151 | |
1152 gtk_container_add(GTK_CONTAINER(b->window), vbox); | |
1153 gtk_widget_show(vbox); | |
149 | 1154 |
1155 gtk_container_border_width(GTK_CONTAINER(b->window), 10); | |
1156 gtk_window_set_title(GTK_WINDOW(b->window), "Gaim - Password Change"); | |
146 | 1157 gtk_widget_show(b->window); |
149 | 1158 |
1159 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", | |
1160 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1161 gtk_signal_connect(GTK_OBJECT(b->cancel), "clicked", | |
1162 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1163 gtk_signal_connect(GTK_OBJECT(b->ok), "clicked", | |
1164 GTK_SIGNAL_FUNC(do_change_password), b); | |
1165 | |
1166 | |
146 | 1167 } |
1168 | |
1 | 1169 void show_set_info() |
1170 { | |
1171 GtkWidget *bot; | |
1172 GtkWidget *top; | |
1173 | |
1174 struct set_info_dlg *b = g_new0(struct set_info_dlg, 1); | |
1175 | |
1176 b->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
1177 dialogwindows = g_list_prepend(dialogwindows, b->window); | |
1178 | |
1179 b->cancel = gtk_button_new_with_label("Cancel"); | |
1180 b->save = gtk_button_new_with_label("Save"); | |
1181 | |
1182 bot = gtk_hbox_new(TRUE, 10); | |
1183 top = gtk_vbox_new(FALSE, 10); | |
1184 | |
1185 gtk_widget_show(b->save); | |
1186 gtk_widget_show(b->cancel); | |
1187 | |
1188 gtk_box_pack_start(GTK_BOX(bot), b->save, FALSE, FALSE, 10); | |
1189 gtk_box_pack_start(GTK_BOX(bot), b->cancel, FALSE, FALSE, 10); | |
1190 | |
1191 | |
1192 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", | |
1193 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1194 gtk_signal_connect(GTK_OBJECT(b->cancel), "clicked", | |
1195 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1196 gtk_signal_connect(GTK_OBJECT(b->save), "clicked", | |
1197 GTK_SIGNAL_FUNC(do_save_info), b); | |
1198 | |
1199 gtk_widget_show(bot); | |
1200 | |
1201 | |
1202 b->text = gtk_text_new(NULL, NULL); | |
1203 gtk_text_set_word_wrap(GTK_TEXT(b->text), TRUE); | |
1204 gtk_text_set_editable(GTK_TEXT(b->text), TRUE); | |
1205 gtk_widget_set_usize(b->text, 350, 100); | |
1206 gtk_text_insert(GTK_TEXT(b->text), NULL, NULL, NULL, current_user->user_info, -1); | |
1207 | |
1208 gtk_widget_show(b->text); | |
1209 | |
1210 gtk_box_pack_start(GTK_BOX(top), b->text, TRUE, TRUE, 10); | |
1211 gtk_widget_show(top); | |
1212 | |
1213 gtk_box_pack_start(GTK_BOX(top), bot, FALSE, FALSE, 10); | |
1214 gtk_container_add(GTK_CONTAINER(b->window), top); | |
1215 gtk_container_border_width(GTK_CONTAINER(b->window), 10); | |
1216 gtk_widget_realize(b->window); | |
1217 aol_icon(b->window->window); | |
1218 | |
1219 gtk_window_set_title(GTK_WINDOW(b->window), "Gaim - Set User Info"); | |
1220 gtk_widget_show(b->window); | |
1221 | |
1222 } | |
1223 | |
1224 /*------------------------------------------------------------------------*/ | |
1225 /* The dialog for registration information */ | |
1226 /*------------------------------------------------------------------------*/ | |
1227 | |
1228 void do_register_dialog(GtkWidget *widget, struct registerdlg *b) | |
1229 { | |
1230 char *email = gtk_entry_get_text(GTK_ENTRY(b->email)); | |
1231 char *name = gtk_entry_get_text(GTK_ENTRY(b->name)); | |
1232 int uname = GTK_TOGGLE_BUTTON(b->uname)->active; | |
1233 int sname = GTK_TOGGLE_BUTTON(b->sname)->active; | |
1234 char *country = gtk_entry_get_text(GTK_ENTRY(b->country)); | |
1235 | |
1236 general_options |= OPT_GEN_REGISTERED; | |
1237 save_prefs(); | |
1238 | |
1239 destroy_dialog(NULL, b->window); | |
1240 | |
1241 g_free(b); | |
1242 | |
1243 g_sendemail(name, email, uname, sname, country); | |
1244 } | |
1245 | |
1246 void set_reg_flag(GtkWidget *widget, struct registerdlg *b) | |
1247 { | |
1248 general_options |= OPT_GEN_REGISTERED; | |
1249 save_prefs(); | |
1250 destroy_dialog(NULL, b->window); | |
1251 g_free(b); | |
1252 } | |
1253 | |
1254 void show_register_dialog() | |
1255 { | |
1256 GtkWidget *ok; | |
1257 GtkWidget *cancel; | |
1258 GtkWidget *label; | |
1259 GtkWidget *table; | |
1260 GtkWidget *vbox; | |
1261 GtkWidget *bbox; | |
1262 | |
1263 struct registerdlg *b = g_new0(struct registerdlg, 1); | |
1264 b->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
1265 dialogwindows = g_list_prepend(dialogwindows, b->window); | |
1266 | |
1267 cancel = gtk_button_new_with_label("Cancel"); | |
1268 ok = gtk_button_new_with_label("Send"); | |
1269 | |
1270 bbox = gtk_hbox_new(TRUE, 10); | |
1271 table = gtk_table_new(6, 2, TRUE); | |
1272 vbox = gtk_vbox_new(FALSE, 5); | |
1273 | |
1274 b->name = gtk_entry_new(); | |
1275 b->email = gtk_entry_new(); | |
1276 b->uname = gtk_check_button_new_with_label("Send the output of uname -a with registration"); | |
1277 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->uname), TRUE); | |
1278 b->sname = gtk_check_button_new_with_label("Send my screenname with registration"); | |
1279 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sname), TRUE); | |
1280 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 10); | |
1281 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 10); | |
1282 | |
1283 label = gtk_label_new("This list will not, in any way, be distributed and\nwill be used for internal census purposes only.\nAll fields are completely optional."); | |
1284 gtk_widget_show(label); | |
1285 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 2, 0, 1); | |
1286 | |
1287 label = gtk_label_new("Name"); | |
1288 gtk_widget_show(label); | |
1289 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
1290 gtk_table_attach_defaults(GTK_TABLE(table), b->name, 1, 2, 1, 2); | |
1291 | |
1292 label = gtk_label_new("Email"); | |
1293 gtk_widget_show(label); | |
1294 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3); | |
1295 gtk_table_attach_defaults(GTK_TABLE(table), b->email, 1, 2, 2, 3); | |
1296 | |
1297 label = gtk_label_new("Country"); | |
1298 b->country = gtk_entry_new(); | |
1299 gtk_widget_show(label); | |
1300 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4); | |
1301 gtk_table_attach_defaults(GTK_TABLE(table), b->country, 1, 2, 3, 4); | |
1302 | |
1303 gtk_table_attach_defaults(GTK_TABLE(table), b->sname, 0, 2, 4, 5); | |
1304 gtk_table_attach_defaults(GTK_TABLE(table), b->uname, 0, 2, 5, 6); | |
1305 | |
1306 gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 5); | |
1307 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); | |
1308 | |
1309 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", | |
1310 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1311 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
1312 GTK_SIGNAL_FUNC(set_reg_flag), b); | |
1313 gtk_signal_connect(GTK_OBJECT(ok), "clicked", | |
1314 GTK_SIGNAL_FUNC(do_register_dialog), b); | |
1315 | |
1316 gtk_widget_show(ok); | |
1317 gtk_widget_show(cancel); | |
1318 gtk_widget_show(b->name); | |
1319 gtk_widget_show(b->email); | |
1320 gtk_widget_show(b->uname); | |
1321 gtk_widget_show(b->sname); | |
1322 gtk_widget_show(b->country); | |
1323 gtk_widget_show(table); | |
1324 gtk_widget_show(bbox); | |
1325 gtk_widget_show(vbox); | |
1326 gtk_window_set_title(GTK_WINDOW(b->window), "Gaim - Registration"); | |
1327 gtk_window_set_focus(GTK_WINDOW(b->window), b->name); | |
1328 gtk_container_add(GTK_CONTAINER(b->window), vbox); | |
1329 gtk_container_border_width(GTK_CONTAINER(b->window), 10); | |
1330 gtk_widget_realize(b->window); | |
1331 aol_icon(b->window->window); | |
1332 | |
1333 gtk_widget_show(b->window); | |
1334 } | |
1335 | |
1336 | |
1337 /*------------------------------------------------------------------------*/ | |
1338 /* The dialog for the info requests */ | |
1339 /*------------------------------------------------------------------------*/ | |
1340 | |
247
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
1341 void g_show_info_text(char *info) |
1 | 1342 { |
1343 GtkWidget *ok; | |
1344 GtkWidget *label; | |
1345 GtkWidget *text; | |
1346 GtkWidget *bbox; | |
1347 GtkWidget *sw; | |
1348 | |
1349 struct info_dlg *b = g_new0(struct info_dlg, 1); | |
1350 | |
1351 b->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
1352 dialogwindows = g_list_prepend(dialogwindows, b->window); | |
1353 gtk_container_border_width(GTK_CONTAINER(b->window), 5); | |
1354 bbox = gtk_vbox_new(FALSE, 5); | |
1355 gtk_container_add(GTK_CONTAINER(b->window), bbox); | |
1356 | |
1357 ok = gtk_button_new_with_label("OK"); | |
1358 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", | |
1359 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1360 gtk_signal_connect(GTK_OBJECT(ok), "clicked", | |
1361 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1362 | |
1363 label = gtk_label_new("Below are the results of your search: "); | |
1364 | |
1365 sw = gtk_scrolled_window_new (NULL, NULL); | |
1366 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), | |
1367 GTK_POLICY_NEVER, | |
1368 GTK_POLICY_ALWAYS); | |
1369 text = gtk_html_new(NULL, NULL); | |
1370 b->text = text; | |
1371 gtk_container_add(GTK_CONTAINER(sw), text); | |
1372 | |
1373 GTK_HTML (text)->hadj->step_increment = 10.0; | |
1374 GTK_HTML (text)->vadj->step_increment = 10.0; | |
1375 gtk_widget_set_usize(sw, 300, 250); | |
1376 | |
1377 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); | |
1378 gtk_box_pack_start(GTK_BOX(bbox), sw, TRUE, TRUE, 0); | |
1379 gtk_box_pack_start(GTK_BOX(bbox), ok, FALSE, FALSE, 0); | |
1380 | |
1381 gtk_widget_realize(b->window); | |
1382 aol_icon(b->window->window); | |
1383 gtk_widget_show_all(b->window); | |
1384 | |
247
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
1385 gtk_html_append_text(GTK_HTML(b->text), info, 0); |
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
1386 } |
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
1387 |
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
1388 void g_show_info(char *url) { |
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
1389 char *url_text = grab_url(url); |
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
1390 g_show_info_text(url_text); |
1 | 1391 g_free(url_text); |
1392 } | |
1393 | |
1394 /*------------------------------------------------------------------------*/ | |
1395 /* The dialog for adding to permit/deny */ | |
1396 /*------------------------------------------------------------------------*/ | |
1397 | |
1398 | |
1399 static void do_add_perm(GtkWidget *w, struct addperm *p) | |
1400 { | |
1401 | |
1402 char *who; | |
1403 char *name; | |
1404 int d = 0; | |
1405 GSList *buttons = p->buttons; | |
1406 | |
1407 | |
1408 who = gtk_entry_get_text(GTK_ENTRY(p->entry)); | |
1409 | |
1410 name = g_malloc(strlen(who) + 2); | |
1411 g_snprintf(name, strlen(who) + 2, "%s", who); | |
1412 | |
1413 while(buttons) { | |
1414 if((int)gtk_object_get_user_data(GTK_OBJECT(buttons->data)) == 1) { | |
1415 if (GTK_TOGGLE_BUTTON(buttons->data)->active) | |
1416 d = 1; | |
1417 } | |
1418 buttons = buttons->next; | |
1419 } | |
1420 | |
1421 if (d) { | |
1422 deny = g_list_append(deny, name); | |
1423 serv_add_deny(name); | |
1424 } else { | |
1425 permit = g_list_append(permit, name); | |
1426 serv_add_permit(name); | |
1427 } | |
1428 | |
1429 | |
1430 | |
1431 build_permit_tree(); | |
1432 | |
1433 serv_save_config(); | |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
1434 do_export(0, 0); |
1 | 1435 |
1436 destroy_dialog(NULL, p->window); | |
1437 } | |
1438 | |
1439 | |
1440 | |
1441 void show_add_perm(char *who) | |
1442 { | |
1443 GtkWidget *cancel; | |
1444 GtkWidget *add; | |
1445 GtkWidget *label; | |
1446 GtkWidget *bbox; | |
1447 GtkWidget *vbox; | |
1448 GtkWidget *rbox; | |
1449 GtkWidget *topbox; | |
1450 GtkWidget *which; | |
1451 struct addperm *p = g_new0(struct addperm, 1); | |
1452 | |
1453 p->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
1454 dialogwindows = g_list_prepend(dialogwindows, p->window); | |
1455 cancel = gtk_button_new_with_label("Cancel"); | |
1456 add = gtk_button_new_with_label("Add"); | |
1457 bbox = gtk_hbox_new(TRUE, 10); | |
1458 topbox = gtk_hbox_new(FALSE, 5); | |
1459 vbox = gtk_vbox_new(FALSE, 5); | |
1460 rbox = gtk_vbox_new(FALSE, 5); | |
1461 p->entry = gtk_entry_new(); | |
1462 | |
1463 if (who != NULL) | |
1464 gtk_entry_set_text(GTK_ENTRY(p->entry), who); | |
1465 | |
1466 which = gtk_radio_button_new_with_label(NULL, "Deny"); | |
1467 gtk_box_pack_start(GTK_BOX(rbox), which, FALSE, FALSE, 0); | |
1468 gtk_object_set_user_data(GTK_OBJECT(which), (int *)1); | |
1469 gtk_widget_show(which); | |
1470 | |
1471 which = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(which)), "Permit"); | |
1472 gtk_box_pack_start(GTK_BOX(rbox), which, FALSE, FALSE, 0); | |
1473 gtk_object_set_user_data(GTK_OBJECT(which), (int *)2); | |
1474 gtk_widget_show(which); | |
1475 | |
1476 /* Put the buttons in the box */ | |
1477 gtk_box_pack_start(GTK_BOX(bbox), add, TRUE, TRUE, 10); | |
1478 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 10); | |
1479 | |
1480 label = gtk_label_new("Add"); | |
1481 gtk_widget_show(label); | |
1482 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); | |
1483 gtk_box_pack_start(GTK_BOX(topbox), p->entry, FALSE, FALSE, 5); | |
1484 gtk_box_pack_start(GTK_BOX(topbox), rbox, FALSE, FALSE, 5); | |
1485 /* And the boxes in the box */ | |
1486 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); | |
1487 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); | |
1488 | |
1489 | |
1490 p->buttons = gtk_radio_button_group(GTK_RADIO_BUTTON(which)); | |
1491 /* Handle closes right */ | |
1492 gtk_signal_connect(GTK_OBJECT(p->window), "destroy", | |
1493 GTK_SIGNAL_FUNC(destroy_dialog), p->window); | |
1494 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
1495 GTK_SIGNAL_FUNC(destroy_dialog), p->window); | |
1496 gtk_signal_connect(GTK_OBJECT(add), "clicked", | |
1497 GTK_SIGNAL_FUNC(do_add_perm), p); | |
1498 gtk_signal_connect(GTK_OBJECT(p->entry), "activate", | |
1499 GTK_SIGNAL_FUNC(do_add_perm), p); | |
1500 | |
1501 /* Finish up */ | |
1502 gtk_widget_show(add); | |
1503 gtk_widget_show(cancel); | |
1504 gtk_widget_show(p->entry); | |
1505 gtk_widget_show(topbox); | |
1506 gtk_widget_show(bbox); | |
1507 gtk_widget_show(vbox); | |
1508 gtk_widget_show(rbox); | |
1509 gtk_window_set_title(GTK_WINDOW(p->window), "Gaim - Add Permit/Deny"); | |
1510 gtk_window_set_focus(GTK_WINDOW(p->window), p->entry); | |
1511 gtk_container_add(GTK_CONTAINER(p->window), vbox); | |
1512 gtk_widget_realize(p->window); | |
1513 aol_icon(p->window->window); | |
1514 | |
1515 gtk_widget_show(p->window); | |
1516 } | |
1517 | |
1518 | |
1519 /*------------------------------------------------------------------------*/ | |
1520 /* Function Called To Add A Log */ | |
1521 /*------------------------------------------------------------------------*/ | |
1522 | |
1523 void do_log(GtkWidget *w, char *name) | |
1524 { | |
1525 struct log_conversation *l; | |
1526 struct conversation *c; | |
1527 char buf[128]; | |
1528 | |
1529 c = find_conversation(name); | |
1530 if (!find_log_info(name)) { | |
1531 l = (struct log_conversation *)g_new0(struct log_conversation, 1); | |
1532 strcpy(l->name, name); | |
1533 strcpy(l->filename, gtk_file_selection_get_filename(GTK_FILE_SELECTION(logdialog))); | |
1534 log_conversations = g_list_append(log_conversations, l); | |
1535 | |
1536 if (c != NULL) | |
1537 { | |
1538 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, c->name); | |
1539 gtk_window_set_title(GTK_WINDOW(c->window), buf); | |
1540 } | |
1541 } | |
1542 | |
1543 save_prefs(); | |
1544 | |
1545 destroy_dialog(NULL, logdialog); | |
1546 logdialog = NULL; | |
1547 } | |
1548 | |
1549 static void cancel_log(GtkWidget *w, char *name) | |
1550 { | |
1551 | |
1552 struct conversation *c = gtk_object_get_user_data(GTK_OBJECT(logdialog)); | |
1553 | |
1554 if (c != NULL) | |
1555 { | |
1556 set_state_lock(1); | |
1557 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(c->log_button), FALSE); | |
1558 set_state_lock(0); | |
1559 } | |
1560 destroy_dialog(NULL, logdialog); | |
1561 } | |
1562 | |
1563 void show_log_dialog(char *bname) | |
1564 { | |
1565 char *buf = g_malloc(BUF_LEN); | |
1566 struct conversation *c = find_conversation(bname); | |
1567 | |
1568 | |
1569 if (!logdialog) { | |
1570 logdialog = gtk_file_selection_new("Gaim - Log Conversation"); | |
1571 | |
1572 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(logdialog)); | |
1573 | |
1574 gtk_object_set_user_data(GTK_OBJECT(logdialog), c); | |
1575 | |
1576 g_snprintf(buf, BUF_LEN - 1, "%s/%s.log", getenv("HOME"), bname); | |
1577 | |
1578 gtk_file_selection_set_filename(GTK_FILE_SELECTION(logdialog), buf); | |
1579 gtk_signal_connect(GTK_OBJECT(logdialog), "delete_event", GTK_SIGNAL_FUNC(cancel_log), c); | |
1580 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(logdialog)->ok_button), "clicked", GTK_SIGNAL_FUNC(do_log), bname); | |
1581 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(logdialog)->cancel_button), "clicked", GTK_SIGNAL_FUNC(cancel_log), bname); | |
1582 } | |
1583 | |
25 | 1584 g_free(buf); |
1585 | |
1 | 1586 gtk_widget_show(logdialog); |
1587 gdk_window_raise(logdialog->window); | |
1588 } | |
1589 | |
1590 /*------------------------------------------------------*/ | |
1591 /* Find Buddy By Email */ | |
1592 /*------------------------------------------------------*/ | |
1593 | |
1594 void do_find_info(GtkWidget *w, struct findbyinfo *b) | |
1595 { | |
1596 char *first; | |
1597 char *middle; | |
1598 char *last; | |
1599 char *maiden; | |
1600 char *city; | |
1601 char *state; | |
1602 char *country; | |
1603 | |
1604 first = gtk_entry_get_text(GTK_ENTRY(b->firstentry)); | |
1605 middle = gtk_entry_get_text(GTK_ENTRY(b->middleentry)); | |
1606 last = gtk_entry_get_text(GTK_ENTRY(b->lastentry)); | |
1607 maiden = gtk_entry_get_text(GTK_ENTRY(b->maidenentry)); | |
1608 city = gtk_entry_get_text(GTK_ENTRY(b->cityentry)); | |
1609 state = gtk_entry_get_text(GTK_ENTRY(b->stateentry)); | |
1610 country = gtk_entry_get_text(GTK_ENTRY(b->countryentry)); | |
1611 | |
1612 serv_dir_search(first, middle, last, maiden, city, state, country, ""); | |
1613 destroy_dialog(NULL, b->window); | |
1614 } | |
1615 | |
1616 void do_find_email(GtkWidget *w, struct findbyemail *b) | |
1617 { | |
1618 char *email; | |
1619 | |
1620 email = gtk_entry_get_text(GTK_ENTRY(b->emailentry)); | |
1621 | |
1622 serv_dir_search("","","","","","","", email); | |
1623 | |
1624 destroy_dialog(NULL, b->window); | |
1625 } | |
1626 | |
1627 void show_find_info() | |
1628 { | |
1629 GtkWidget *cancel; | |
1630 GtkWidget *ok; | |
1631 GtkWidget *label; | |
1632 GtkWidget *bbox; | |
1633 GtkWidget *vbox; | |
1634 GtkWidget *topbox; | |
1635 | |
1636 struct findbyinfo *b = g_new0(struct findbyinfo, 1); | |
1637 b->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
1638 dialogwindows = g_list_prepend(dialogwindows, b->window); | |
1639 | |
1640 cancel = gtk_button_new_with_label("Cancel"); | |
1641 ok = gtk_button_new_with_label("OK"); | |
1642 | |
1643 bbox = gtk_hbox_new(TRUE, 10); | |
1644 topbox = gtk_table_new(7, 2, TRUE); | |
1645 vbox = gtk_vbox_new(FALSE, 5); | |
1646 | |
1647 b->firstentry = gtk_entry_new(); | |
1648 b->middleentry = gtk_entry_new(); | |
1649 b->lastentry = gtk_entry_new(); | |
1650 b->maidenentry = gtk_entry_new(); | |
1651 b->cityentry = gtk_entry_new(); | |
1652 b->stateentry = gtk_entry_new(); | |
1653 b->countryentry = gtk_entry_new(); | |
1654 | |
1655 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 10); | |
1656 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 10); | |
1657 | |
1658 label = gtk_label_new("First Name"); | |
1659 gtk_widget_show(label); | |
1660 gtk_table_attach_defaults(GTK_TABLE(topbox), label, 0, 1, 0, 1); | |
1661 gtk_table_attach_defaults(GTK_TABLE(topbox), b->firstentry, 1, 2, 0, 1); | |
1662 | |
1663 label = gtk_label_new("Middle Name"); | |
1664 gtk_widget_show(label); | |
1665 gtk_table_attach_defaults(GTK_TABLE(topbox), label, 0, 1, 1, 2); | |
1666 gtk_table_attach_defaults(GTK_TABLE(topbox), b->middleentry, 1, 2, 1, 2); | |
1667 | |
1668 label = gtk_label_new("Last Name"); | |
1669 gtk_widget_show(label); | |
1670 gtk_table_attach_defaults(GTK_TABLE(topbox), label, 0, 1, 2, 3); | |
1671 gtk_table_attach_defaults(GTK_TABLE(topbox), b->lastentry, 1, 2, 2, 3); | |
1672 | |
1673 label = gtk_label_new("Maiden Name"); | |
1674 gtk_widget_show(label); | |
1675 gtk_table_attach_defaults(GTK_TABLE(topbox), label, 0, 1, 3, 4); | |
1676 gtk_table_attach_defaults(GTK_TABLE(topbox), b->maidenentry, 1, 2, 3, 4); | |
1677 | |
1678 label = gtk_label_new("City"); | |
1679 gtk_widget_show(label); | |
1680 gtk_table_attach_defaults(GTK_TABLE(topbox), label, 0, 1, 4, 5); | |
1681 gtk_table_attach_defaults(GTK_TABLE(topbox), b->cityentry, 1, 2, 4, 5); | |
1682 | |
1683 label = gtk_label_new("State"); | |
1684 gtk_widget_show(label); | |
1685 gtk_table_attach_defaults(GTK_TABLE(topbox), label, 0, 1, 5, 6); | |
1686 gtk_table_attach_defaults(GTK_TABLE(topbox), b->stateentry, 1, 2, 5, 6); | |
1687 | |
1688 label = gtk_label_new("Country"); | |
1689 gtk_widget_show(label); | |
1690 gtk_table_attach_defaults(GTK_TABLE(topbox), label, 0, 1, 6, 7); | |
1691 gtk_table_attach_defaults(GTK_TABLE(topbox), b->countryentry, 1, 2, 6, 7); | |
1692 | |
1693 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); | |
1694 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); | |
1695 | |
1696 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", | |
1697 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1698 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
1699 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1700 gtk_signal_connect(GTK_OBJECT(ok), "clicked", | |
1701 GTK_SIGNAL_FUNC(do_find_info), b); | |
1702 | |
1703 gtk_widget_show(ok); | |
1704 gtk_widget_show(cancel); | |
1705 gtk_widget_show(b->firstentry); | |
1706 gtk_widget_show(b->middleentry); | |
1707 gtk_widget_show(b->lastentry); | |
1708 gtk_widget_show(b->maidenentry); | |
1709 gtk_widget_show(b->cityentry); | |
1710 gtk_widget_show(b->stateentry); | |
1711 gtk_widget_show(b->countryentry); | |
1712 gtk_widget_show(topbox); | |
1713 gtk_widget_show(bbox); | |
1714 gtk_widget_show(vbox); | |
1715 gtk_window_set_title(GTK_WINDOW(b->window), "Gaim - Find Buddy By Info"); | |
1716 gtk_window_set_focus(GTK_WINDOW(b->window), b->firstentry); | |
1717 gtk_container_add(GTK_CONTAINER(b->window), vbox); | |
1718 gtk_container_border_width(GTK_CONTAINER(b->window), 10); | |
1719 gtk_widget_realize(b->window); | |
1720 aol_icon(b->window->window); | |
1721 | |
1722 gtk_widget_show(b->window); | |
1723 } | |
1724 | |
1725 void show_find_email() | |
1726 { | |
1727 GtkWidget *cancel; | |
1728 GtkWidget *ok; | |
1729 GtkWidget *label; | |
1730 GtkWidget *bbox; | |
1731 GtkWidget *vbox; | |
1732 GtkWidget *topbox; | |
1733 | |
1734 struct findbyemail *b = g_new0(struct findbyemail, 1); | |
1735 b->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
1736 dialogwindows = g_list_prepend(dialogwindows, b->window); | |
1737 | |
1738 cancel = gtk_button_new_with_label("Cancel"); | |
1739 ok = gtk_button_new_with_label("OK"); | |
1740 | |
1741 bbox = gtk_hbox_new(TRUE, 10); | |
1742 topbox = gtk_hbox_new(FALSE, 5); | |
1743 vbox = gtk_vbox_new(FALSE, 5); | |
1744 | |
1745 b->emailentry = gtk_entry_new(); | |
1746 | |
1747 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 10); | |
1748 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 10); | |
1749 | |
1750 label = gtk_label_new("Email"); | |
1751 gtk_widget_show(label); | |
1752 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); | |
1753 gtk_box_pack_start(GTK_BOX(topbox), b->emailentry, FALSE, FALSE, 5); | |
1754 | |
1755 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); | |
1756 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); | |
1757 | |
1758 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", | |
1759 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1760 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
1761 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1762 gtk_signal_connect(GTK_OBJECT(ok), "clicked", | |
1763 GTK_SIGNAL_FUNC(do_find_email), b); | |
1764 gtk_signal_connect(GTK_OBJECT(b->emailentry), "activate", | |
1765 GTK_SIGNAL_FUNC(do_find_email), b); | |
1766 | |
1767 gtk_widget_show(ok); | |
1768 gtk_widget_show(cancel); | |
1769 gtk_widget_show(b->emailentry); | |
1770 gtk_widget_show(topbox); | |
1771 gtk_widget_show(bbox); | |
1772 gtk_widget_show(vbox); | |
1773 gtk_window_set_title(GTK_WINDOW(b->window), "Gaim - Find Buddy By Email"); | |
1774 gtk_window_set_focus(GTK_WINDOW(b->window), b->emailentry); | |
1775 gtk_container_add(GTK_CONTAINER(b->window), vbox); | |
1776 gtk_container_border_width(GTK_CONTAINER(b->window), 10); | |
1777 gtk_widget_realize(b->window); | |
1778 aol_icon(b->window->window); | |
1779 | |
1780 gtk_widget_show(b->window); | |
1781 } | |
1782 | |
1783 /*------------------------------------------------------*/ | |
1784 /* Link Dialog */ | |
1785 /*------------------------------------------------------*/ | |
1786 | |
1787 void cancel_link(GtkWidget *widget, struct linkdlg *b) | |
1788 { | |
62 | 1789 if (b->toggle) { |
1790 set_state_lock(1); | |
1 | 1791 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->toggle), FALSE); |
62 | 1792 set_state_lock(0); |
1793 } | |
1 | 1794 destroy_dialog(NULL, b->window); |
1795 } | |
1796 | |
1797 void do_add_link(GtkWidget *widget, struct linkdlg *b) | |
1798 { | |
1799 char *open_tag; | |
1800 char *urltext, *showtext; | |
1801 open_tag = g_malloc(2048); | |
1802 | |
1803 | |
1804 urltext = gtk_entry_get_text(GTK_ENTRY(b->url)); | |
1805 showtext = gtk_entry_get_text(GTK_ENTRY(b->text)); | |
1806 | |
1807 g_snprintf(open_tag, 2048, "<A HREF=\"%s\">%s", urltext, showtext); | |
1808 surround(b->entry, open_tag, "</A>"); | |
1809 | |
1810 g_free(open_tag); | |
1811 destroy_dialog(NULL, b->window); | |
1812 } | |
1813 | |
1814 | |
1815 void show_add_link(GtkWidget *entry, GtkWidget *link) | |
1816 { | |
1817 GtkWidget *vbox; | |
1818 GtkWidget *bbox; | |
1819 GtkWidget *table; | |
1820 GtkWidget *label; | |
1821 | |
1822 if (!linkdialog) { | |
1823 struct linkdlg *b = g_new0(struct linkdlg, 1); | |
1824 linkdialog = gtk_window_new(GTK_WINDOW_DIALOG); | |
1825 dialogwindows = g_list_prepend(dialogwindows, linkdialog); | |
1826 | |
1827 b->cancel = gtk_button_new_with_label("Cancel"); | |
1828 b->ok = gtk_button_new_with_label("Ok"); | |
1829 | |
1830 vbox = gtk_vbox_new(FALSE, 10); | |
1831 bbox = gtk_hbox_new(TRUE, 10); | |
1832 | |
1833 gtk_widget_show(b->ok); | |
1834 gtk_widget_show(b->cancel); | |
1835 | |
1836 gtk_box_pack_start(GTK_BOX(bbox), b->ok, FALSE, FALSE, 10); | |
1837 gtk_box_pack_start(GTK_BOX(bbox), b->cancel, FALSE, FALSE, 10); | |
1838 gtk_widget_show(bbox); | |
1839 | |
1840 table = gtk_table_new(2, 2, FALSE); | |
1841 b->url = gtk_entry_new(); | |
1842 b->text = gtk_entry_new(); | |
1843 | |
1844 label = gtk_label_new("URL"); | |
1845 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
1846 gtk_table_attach_defaults(GTK_TABLE(table), b->url, 1, 2, 0, 1); | |
1847 gtk_widget_show(label); | |
1848 | |
1849 label = gtk_label_new("Description"); | |
1850 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
1851 gtk_table_attach_defaults(GTK_TABLE(table), b->text, 1, 2, 1, 2); | |
1852 gtk_widget_show(label); | |
1853 | |
1854 gtk_widget_show(b->url); | |
1855 gtk_widget_show(b->text); | |
1856 gtk_widget_show(table); | |
1857 | |
1858 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 10); | |
1859 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 10); | |
1860 gtk_widget_show(vbox); | |
1861 | |
1862 gtk_signal_connect(GTK_OBJECT(linkdialog), "destroy", | |
1863 GTK_SIGNAL_FUNC(cancel_link), b); | |
1864 gtk_signal_connect(GTK_OBJECT(b->cancel), "clicked", | |
1865 GTK_SIGNAL_FUNC(cancel_link), b); | |
1866 gtk_signal_connect(GTK_OBJECT(b->ok), "clicked", | |
1867 GTK_SIGNAL_FUNC(do_add_link), b); | |
1868 | |
1869 gtk_container_add(GTK_CONTAINER(linkdialog ), vbox); | |
1870 gtk_container_border_width(GTK_CONTAINER(linkdialog ), 10); | |
1871 gtk_window_set_title(GTK_WINDOW(linkdialog ), "GAIM - Add URL"); | |
1872 gtk_window_set_focus(GTK_WINDOW(linkdialog ), b->url); | |
1873 b->window = linkdialog; | |
1874 b->toggle = link; | |
1875 b->entry = entry; | |
1876 gtk_widget_realize(linkdialog); | |
1877 aol_icon(linkdialog->window); | |
1878 | |
1879 } | |
1880 | |
1881 gtk_widget_show(linkdialog); | |
1882 gdk_window_raise(linkdialog->window); | |
1883 } | |
1884 | |
1885 | |
1886 /*------------------------------------------------------*/ | |
1887 /* Color Selection Dialog */ | |
1888 /*------------------------------------------------------*/ | |
1889 | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1890 void cancel_color(GtkWidget *widget, struct conversation *c) |
1 | 1891 { |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1892 if (c->palette && widget) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1893 { |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1894 set_state_lock(1); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1895 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(c->palette), FALSE); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1896 set_state_lock(0); |
61 | 1897 } |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1898 dialogwindows = g_list_remove(dialogwindows, c->color_dialog); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1899 gtk_widget_destroy(c->color_dialog); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1900 c->color_dialog = NULL; |
1 | 1901 } |
1902 | |
1903 void do_color(GtkWidget *widget, GtkColorSelection *colorsel) | |
1904 { | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1905 gdouble color[3]; |
1 | 1906 GdkColor text_color; |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1907 struct conversation *c; |
1 | 1908 char *open_tag; |
1909 | |
1910 open_tag = g_malloc(30); | |
1911 | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1912 gtk_color_selection_get_color (colorsel, color); |
1 | 1913 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1914 c = gtk_object_get_user_data(GTK_OBJECT(colorsel)); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1915 GTK_IS_EDITABLE(c->entry); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1916 |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1917 text_color.red = ((guint16)(color[0]*65535))>>8; |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1918 text_color.green = ((guint16)(color[1]*65535))>>8; |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1919 text_color.blue = ((guint16)(color[2]*65535))>>8; |
1 | 1920 |
1921 g_snprintf(open_tag, 23, "<FONT COLOR=\"#%02X%02X%02X\">", text_color.red, text_color.green, text_color.blue); | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1922 surround(c->entry, open_tag, "</FONT>"); |
1 | 1923 sprintf(debug_buff,"#%02X%02X%02X\n", text_color.red, text_color.green, text_color.blue); |
1924 debug_print(debug_buff); | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1925 g_free(open_tag); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1926 cancel_color(NULL, c); |
1 | 1927 } |
1928 | |
1929 | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1930 void show_color_dialog(struct conversation *c, GtkWidget *color) |
1 | 1931 { |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1932 GtkWidget *colorsel; |
1 | 1933 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1934 if (!c->color_dialog) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1935 { |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1936 c->color_dialog = gtk_color_selection_dialog_new("Select Text Color"); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1937 colorsel = GTK_COLOR_SELECTION_DIALOG(c->color_dialog)->colorsel; |
1 | 1938 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1939 gtk_object_set_user_data(GTK_OBJECT(colorsel), c); |
1 | 1940 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1941 gtk_signal_connect(GTK_OBJECT(c->color_dialog), "delete_event", GTK_SIGNAL_FUNC(delete_event_dialog), c); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1942 gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(c->color_dialog)->ok_button), "clicked", GTK_SIGNAL_FUNC(do_color), colorsel); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1943 gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(c->color_dialog)->cancel_button), "clicked", GTK_SIGNAL_FUNC(cancel_color), c); |
1 | 1944 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1945 gtk_widget_realize(c->color_dialog); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1946 aol_icon(c->color_dialog->window); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1947 } |
1 | 1948 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1949 gtk_widget_show(c->color_dialog); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1950 gdk_window_raise(c->color_dialog->window); |
1 | 1951 } |
1952 | |
1953 /*------------------------------------------------------------------------*/ | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
1954 /* Font Selection Dialog */ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
1955 /*------------------------------------------------------------------------*/ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
1956 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1957 void cancel_font(GtkWidget *widget, struct conversation *c) |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1958 { |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1959 if (c->font && widget) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1960 { |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1961 set_state_lock(1); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1962 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(c->font), FALSE); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1963 set_state_lock(0); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1964 } |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1965 dialogwindows = g_list_remove(dialogwindows, c->font_dialog); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1966 gtk_widget_destroy(c->font_dialog); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1967 c->font_dialog = NULL; |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
1968 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
1969 |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
1970 void apply_font(GtkWidget *widget, GtkFontSelection *fontsel) |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
1971 { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
1972 /* this could be expanded to include font size, weight, etc. |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
1973 but for now only works with font face */ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
1974 int i, j = 0, k = 0; |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1975 struct conversation *c = gtk_object_get_user_data(GTK_OBJECT(fontsel)); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
1976 |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1977 if (c) |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
1978 { |
308
e5fa88351dc8
[gaim-migrate @ 318]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
300
diff
changeset
|
1979 char *tmp = gtk_font_selection_get_font_name(fontsel); |
e5fa88351dc8
[gaim-migrate @ 318]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
300
diff
changeset
|
1980 strncpy(c->current_fontname, tmp, sizeof(c->current_fontname)); |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1981 |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1982 for (i = 0; i < strlen(c->current_fontname); i++) |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
1983 { |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1984 if (c->current_fontname[i] == '-') |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1985 { |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1986 if (++j > 2) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1987 break; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1988 } |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1989 else if (j == 2) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1990 c->current_fontface[k++] = c->current_fontname[i]; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1991 } |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1992 c->current_fontface[k] = '\0'; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1993 |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1994 set_font_face(NULL, c); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
1995 } |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1996 else |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1997 { |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1998 if (fontface) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
1999 g_free(fontface); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2000 |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2001 fontface = g_malloc(64); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2002 fontname = gtk_font_selection_get_font_name(fontsel); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2003 |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2004 for (i = 0; i < strlen(fontname); i++) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2005 { |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2006 if (fontname[i] == '-') |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2007 { |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2008 if (++j > 2) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2009 break; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2010 } |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2011 else if (j == 2) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2012 fontface[k++] = fontname[i]; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2013 } |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2014 fontface[k] = '\0'; |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2015 |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2016 save_prefs(); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2017 } |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2018 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2019 cancel_font(NULL, c); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2020 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2021 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2022 void show_font_dialog(struct conversation *c, GtkWidget *font) |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2023 { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2024 GtkWidget *fontsel; |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2025 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2026 if (!c->font_dialog) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2027 { |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2028 c->font_dialog = gtk_font_selection_dialog_new("Select Font"); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2029 fontsel = GTK_FONT_SELECTION_DIALOG(c->font_dialog)->fontsel; |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2030 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2031 if (font) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2032 gtk_object_set_user_data(GTK_OBJECT(fontsel), c); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2033 else |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2034 gtk_object_set_user_data(GTK_OBJECT(fontsel), NULL); |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2035 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2036 gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog *)c->font_dialog, DEFAULT_FONT_NAME); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2037 |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2038 gtk_signal_connect(GTK_OBJECT(c->font_dialog), "delete_event", GTK_SIGNAL_FUNC(delete_event_dialog), c); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2039 gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(c->font_dialog)->ok_button), "clicked", GTK_SIGNAL_FUNC(apply_font), fontsel); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2040 gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(c->font_dialog)->cancel_button), "clicked", GTK_SIGNAL_FUNC(cancel_font), c); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2041 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2042 if (fontname) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2043 gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog *)c->font_dialog, fontname); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2044 else |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2045 gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog *)c->font_dialog, DEFAULT_FONT_NAME); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2046 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2047 gtk_widget_realize(c->font_dialog); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2048 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2049 aol_icon(c->font_dialog->window); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2050 } |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2051 gtk_widget_show(c->font_dialog); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2052 gdk_window_raise(c->font_dialog->window); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2053 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2054 |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2055 /*------------------------------------------------------------------------*/ |
1 | 2056 /* The dialog for import/export */ |
2057 /*------------------------------------------------------------------------*/ | |
2058 | |
228 | 2059 #define PATHSIZE 1024 |
2060 | |
229 | 2061 /* see if a buddy list cache file for this user exists */ |
2062 | |
2063 gboolean | |
2064 bud_list_cache_exists( void ) | |
2065 { | |
2066 gboolean ret = FALSE; | |
2067 char path[PATHSIZE]; | |
2068 char *file; | |
2069 struct stat sbuf; | |
2070 extern char g_screenname[]; | |
2071 | |
2072 file = getenv( "HOME" ); | |
2073 if ( file != (char *) NULL ) { | |
262
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2074 sprintf( path, "%s/.gaim/%s.blist", file, g_screenname ); |
229 | 2075 if ( !stat(path, &sbuf) ) |
2076 ret = TRUE; | |
2077 } | |
2078 return ret; | |
2079 } | |
2080 | |
262
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2081 /* if dummy is 0, save to ~/.gaim/screenname.blist. Else, let user choose */ |
228 | 2082 |
1 | 2083 void do_export(GtkWidget *w, void *dummy) |
2084 { | |
2085 FILE *f; | |
228 | 2086 gint show_dialog = (int) dummy; |
1 | 2087 char *buf = g_malloc(BUF_LONG); |
228 | 2088 char *file; |
2089 char path[PATHSIZE]; | |
2090 extern char g_screenname[]; | |
1 | 2091 |
228 | 2092 if ( show_dialog == 1 ) { |
2093 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(exportdialog)); | |
2094 strncpy( path, file, PATHSIZE - 1 ); | |
2095 } | |
2096 else { | |
2097 file = getenv( "HOME" ); | |
262
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2098 if ( file != (char *) NULL ) { |
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2099 FILE *dir; |
266
3b5b469d07f7
[gaim-migrate @ 276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
262
diff
changeset
|
2100 sprintf(buf, "%s/.gaim/", file); |
262
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2101 dir = fopen(buf, "r"); |
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2102 if (!dir) |
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2103 mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR); |
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2104 else |
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2105 fclose(dir); |
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2106 sprintf( path, "%s/.gaim/%s.blist", file, g_screenname ); |
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2107 } else |
228 | 2108 return; |
2109 } | |
2110 if ((f = fopen(path,"w"))) { | |
237
6ced2f1c8b24
[gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
236
diff
changeset
|
2111 serv_build_config(buf, 8192 - 1); |
1 | 2112 fprintf(f, "%s\n", buf); |
2113 fclose(f); | |
2114 chmod(buf, S_IRUSR | S_IWUSR); | |
228 | 2115 } else if ( show_dialog == 1 ) { |
1 | 2116 g_snprintf(buf, BUF_LONG / 2, "Error writing file %s", file); |
2117 do_error_dialog(buf, "Error"); | |
2118 } | |
228 | 2119 if ( show_dialog == 1 ) { |
2120 destroy_dialog(NULL, exportdialog); | |
2121 exportdialog = NULL; | |
2122 } | |
1 | 2123 |
2124 g_free(buf); | |
2125 | |
2126 } | |
2127 | |
2128 | |
2129 void show_export_dialog() | |
2130 { | |
2131 char *buf = g_malloc(BUF_LEN); | |
2132 if (!exportdialog) { | |
2133 exportdialog = gtk_file_selection_new("Gaim - Export Buddy List"); | |
2134 | |
2135 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(exportdialog)); | |
2136 | |
2137 g_snprintf(buf, BUF_LEN - 1, "%s/gaim.buddy", getenv("HOME")); | |
2138 | |
2139 gtk_file_selection_set_filename(GTK_FILE_SELECTION(exportdialog), buf); | |
2140 gtk_signal_connect(GTK_OBJECT(exportdialog), "destroy", | |
2141 GTK_SIGNAL_FUNC(destroy_dialog), exportdialog); | |
2142 | |
2143 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(exportdialog)->ok_button), | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2144 "clicked", GTK_SIGNAL_FUNC(do_export), (void*)1); |
1 | 2145 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(exportdialog)->cancel_button), |
2146 "clicked", GTK_SIGNAL_FUNC(destroy_dialog), exportdialog); | |
2147 | |
2148 | |
2149 } | |
2150 | |
2151 g_free(buf); | |
2152 | |
2153 gtk_widget_show(exportdialog); | |
2154 gdk_window_raise(exportdialog->window); | |
2155 | |
2156 } | |
2157 | |
262
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2158 /* if dummy is 0, then import from ~/.gaim/screenname.blist, else let user |
229 | 2159 choose */ |
228 | 2160 |
1 | 2161 void do_import(GtkWidget *w, void *dummy) |
2162 { | |
228 | 2163 gint show_dialog = (int) dummy; |
1 | 2164 GList *grp, *grp2; |
2165 char *buf = g_malloc(BUF_LONG); | |
2166 char *buf2; | |
2167 char *first = g_malloc(64); | |
228 | 2168 char *file; |
2169 char path[PATHSIZE]; | |
1 | 2170 FILE *f; |
228 | 2171 extern char g_screenname[]; |
2172 | |
2173 if ( show_dialog == 1 ) { | |
2174 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(importdialog)); | |
2175 strncpy( path, file, PATHSIZE - 1 ); | |
2176 } | |
2177 else { | |
2178 file = getenv( "HOME" ); | |
2179 if ( file != (char *) NULL ) | |
262
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2180 sprintf( path, "%s/.gaim/%s.blist", file, g_screenname ); |
228 | 2181 else |
2182 return; | |
2183 } | |
2184 | |
2185 if (!(f = fopen(path,"r"))) { | |
2186 if ( show_dialog == 1 ) { | |
2187 g_snprintf(buf, BUF_LONG / 2, "Error reading file %s", file); | |
2188 do_error_dialog(buf, "Error"); | |
2189 destroy_dialog(NULL, importdialog); | |
2190 importdialog = NULL; | |
2191 } | |
1 | 2192 g_free(buf); |
37 | 2193 g_free(first); |
1 | 2194 return; |
2195 } | |
2196 | |
2197 fgets(first, 64, f); | |
2198 | |
2199 if (!strcasecmp(first, "Config {\n")) { | |
228 | 2200 if ( show_dialog == 1 ) { |
2201 destroy_dialog(NULL, importdialog); | |
2202 importdialog = NULL; | |
2203 } | |
25 | 2204 g_free(buf); |
37 | 2205 g_free(first); |
228 | 2206 fclose( f ); |
1 | 2207 return; |
2208 } else if (buf[0] == 'm') { | |
2209 buf2 = buf; | |
231 | 2210 buf = g_malloc(8193); |
2211 g_snprintf(buf, 8192, "toc_set_config {%s}\n", buf2); | |
1 | 2212 g_free(buf2); |
2213 } | |
2214 | |
2215 | |
2216 fseek(f, 0, SEEK_SET); | |
2217 | |
2218 fread(buf, BUF_LONG, 1, f); | |
2219 | |
2220 grp = groups; | |
2221 | |
2222 while(grp) { | |
2223 grp2 = grp->next; | |
2224 remove_group((struct group *)grp->data); | |
2225 grp = grp2; | |
2226 } | |
2227 | |
296
a88b889b692b
[gaim-migrate @ 306]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
266
diff
changeset
|
2228 parse_toc_buddy_list(buf, 1); |
1 | 2229 |
2230 serv_save_config(); | |
2231 | |
2232 build_edit_tree(); | |
2233 build_permit_tree(); | |
2234 | |
228 | 2235 fclose( f ); |
2236 | |
2237 if ( show_dialog == 1 ) { | |
2238 /* save what we just did to cache */ | |
2239 | |
2240 do_export( (GtkWidget *) NULL, 0 ); | |
2241 destroy_dialog(NULL, importdialog); | |
2242 importdialog = NULL; | |
2243 } | |
1 | 2244 |
2245 g_free(buf); | |
37 | 2246 g_free(first); |
1 | 2247 } |
2248 | |
2249 void show_import_dialog() | |
2250 { | |
2251 char *buf = g_malloc(BUF_LEN); | |
2252 if (!importdialog) { | |
2253 importdialog = gtk_file_selection_new("Gaim - Import Buddy List"); | |
2254 | |
2255 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(importdialog)); | |
2256 | |
2257 g_snprintf(buf, BUF_LEN - 1, "%s/", getenv("HOME")); | |
2258 | |
2259 gtk_file_selection_set_filename(GTK_FILE_SELECTION(importdialog), buf); | |
2260 gtk_signal_connect(GTK_OBJECT(importdialog), "destroy", | |
2261 GTK_SIGNAL_FUNC(destroy_dialog), importdialog); | |
2262 | |
2263 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(importdialog)->ok_button), | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2264 "clicked", GTK_SIGNAL_FUNC(do_import), (void*)1); |
1 | 2265 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(importdialog)->cancel_button), |
2266 "clicked", GTK_SIGNAL_FUNC(destroy_dialog), importdialog); | |
2267 | |
2268 | |
2269 } | |
2270 | |
24 | 2271 g_free(buf); |
1 | 2272 gtk_widget_show(importdialog); |
2273 gdk_window_raise(importdialog->window); | |
2274 } | |
2275 | |
2276 | |
2277 /*------------------------------------------------------------------------*/ | |
2278 /* The dialog for new away messages */ | |
2279 /*------------------------------------------------------------------------*/ | |
2280 | |
2281 void create_mess(GtkWidget *widget, struct create_away *ca) | |
2282 { | |
2283 struct away_message *b; | |
2284 gchar *away_message; | |
2285 guint text_len; | |
2286 int is_checked; | |
2287 | |
2288 /* Grab the appropriate data */ | |
2289 b = g_new0(struct away_message, 1); | |
2290 g_snprintf(b->name, sizeof(b->name), "%s", gtk_entry_get_text(GTK_ENTRY(ca->entry))); | |
2291 | |
2292 /* Get proper Length */ | |
2293 text_len = gtk_text_get_length(GTK_TEXT(ca->text)); | |
2294 away_message = gtk_editable_get_chars(GTK_EDITABLE(ca->text), 0, text_len); | |
2295 | |
2296 g_snprintf(b->message, sizeof(b->message), "%s", away_message); | |
38 | 2297 g_free(away_message); |
1 | 2298 is_checked = GTK_TOGGLE_BUTTON(ca->checkbx)->active; |
2299 | |
2300 if (is_checked) do_away_message(NULL, b); | |
2301 | |
2302 /* stick it on the away list */ | |
2303 if (strlen(b->name)) { | |
2304 away_messages = g_list_append(away_messages, b); | |
2305 save_prefs(); | |
2306 do_away_menu(); | |
2307 if (pd != NULL) | |
2308 gtk_list_select_item(GTK_LIST(pd->away_list), g_list_index(away_messages, b)); | |
2309 } | |
2310 | |
2311 destroy_dialog(NULL, ca->window); | |
2312 } | |
2313 | |
2314 void create_away_mess(GtkWidget *widget, void *dummy) | |
2315 { | |
2316 GtkWidget *bbox; | |
2317 GtkWidget *titlebox; | |
2318 GtkWidget *tbox; | |
2319 GtkWidget *create; | |
2320 GtkWidget *sw; | |
2321 GtkWidget *label; | |
2322 | |
2323 struct create_away *ca = g_new0(struct create_away, 1); | |
2324 | |
2325 /* Set up window */ | |
2326 ca->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
2327 gtk_container_border_width(GTK_CONTAINER(ca->window), 10); | |
2328 gtk_window_set_title(GTK_WINDOW(ca->window), "Gaim - New away message"); | |
2329 gtk_signal_connect(GTK_OBJECT(ca->window),"delete_event", | |
2330 GTK_SIGNAL_FUNC(destroy_dialog), ca->window); | |
2331 | |
2332 /* set up container boxes */ | |
2333 bbox = gtk_vbox_new(FALSE, 0); | |
2334 titlebox = gtk_hbox_new(FALSE, 0); | |
2335 tbox = gtk_vbox_new(FALSE, 0); | |
2336 | |
2337 /* Make a label for away entry */ | |
2338 label = gtk_label_new("Away title: "); | |
2339 gtk_box_pack_start(GTK_BOX(titlebox), label, TRUE, TRUE, 0); | |
2340 | |
2341 /* make away title entry */ | |
2342 ca->entry = gtk_entry_new(); | |
2343 gtk_box_pack_start(GTK_BOX(titlebox), ca->entry, TRUE, TRUE, 0); | |
2344 | |
2345 sw = gtk_scrolled_window_new(NULL, NULL); | |
2346 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
2347 GTK_POLICY_AUTOMATIC, | |
2348 GTK_POLICY_AUTOMATIC); | |
2349 gtk_widget_show(sw); | |
2350 | |
2351 /* create and format text box */ | |
2352 ca->text = gtk_text_new(NULL, NULL); | |
2353 gtk_text_set_word_wrap(GTK_TEXT(ca->text), TRUE); | |
2354 gtk_text_set_editable(GTK_TEXT(ca->text), TRUE ); | |
2355 gtk_container_add(GTK_CONTAINER(sw), ca->text); | |
2356 gtk_widget_show(ca->text); | |
2357 gtk_box_pack_start(GTK_BOX(bbox), sw, TRUE, TRUE, 10); | |
2358 | |
2359 /* make create button */ | |
2360 create = gtk_button_new_with_label ("Create new message"); | |
255
be4ac6d5c1b4
[gaim-migrate @ 265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
253
diff
changeset
|
2361 gtk_box_pack_start(GTK_BOX(bbox), create, FALSE, FALSE, 0); |
1 | 2362 gtk_signal_connect(GTK_OBJECT(create), "clicked", GTK_SIGNAL_FUNC(create_mess), ca); |
2363 | |
2364 /* Checkbox for showing away msg */ | |
2365 ca->checkbx = gtk_check_button_new_with_label("Make away now"); | |
2366 | |
2367 /* pack boxes where they belong */ | |
255
be4ac6d5c1b4
[gaim-migrate @ 265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
253
diff
changeset
|
2368 gtk_box_pack_start(GTK_BOX(tbox), titlebox, FALSE, FALSE, 0); |
be4ac6d5c1b4
[gaim-migrate @ 265]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
253
diff
changeset
|
2369 gtk_box_pack_start(GTK_BOX(tbox), bbox, TRUE, TRUE, 0); |
1 | 2370 gtk_box_pack_start(GTK_BOX(tbox), ca->checkbx, FALSE, FALSE, 0); |
2371 gtk_container_add(GTK_CONTAINER(ca->window), tbox); | |
2372 | |
2373 /* let the world see what we have done. */ | |
2374 gtk_widget_show(label); | |
2375 gtk_widget_show(create); | |
2376 gtk_widget_show(ca->checkbx); | |
2377 gtk_widget_show(ca->entry); | |
2378 gtk_widget_show(titlebox); | |
2379 gtk_widget_show(tbox); | |
2380 gtk_widget_show(bbox); | |
2381 | |
2382 | |
2383 gtk_widget_realize(ca->window); | |
2384 aol_icon(ca->window->window); | |
2385 | |
2386 gtk_widget_show(ca->window); | |
2387 | |
2388 | |
2389 } |