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