Mercurial > pidgin
annotate src/dialogs.c @ 527:47eb48fa2e85
[gaim-migrate @ 537]
*whistles innocently*
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 25 Jul 2000 22:17:35 +0000 |
parents | 0fcb7e7a263c |
children | f03f041c1aa9 |
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 |
483 | 439 gtk_widget_set_usize(warn, 75, 30); |
440 gtk_widget_set_usize(cancel, 75, 30); | |
441 | |
485 | 442 gtk_box_pack_start(GTK_BOX(bbox), warn, FALSE, FALSE, 5); |
443 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 5); | |
1 | 444 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
445 g_snprintf(buf, 127, _("Do you really want to warn %s?"), who); |
1 | 446 label = gtk_label_new(buf); |
467 | 447 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 5); |
1 | 448 gtk_widget_show(label); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
449 w->anon = gtk_check_button_new_with_label(_("Warn anonymously?")); |
467 | 450 gtk_box_pack_start(GTK_BOX(vbox), w->anon, TRUE, TRUE, 5); |
1 | 451 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
452 label = gtk_label_new(_("Anonymous warnings are less harsh.")); |
467 | 453 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 5); |
1 | 454 gtk_widget_show(label); |
455 | |
456 w->who = who; | |
467 | 457 |
458 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
459 | |
460 gtk_box_pack_start(GTK_BOX(fbox), frame, FALSE, FALSE, 5); | |
461 gtk_box_pack_start(GTK_BOX(fbox), bbox, FALSE, FALSE, 5); | |
1 | 462 |
463 /* Handle closes right */ | |
464 gtk_signal_connect(GTK_OBJECT(w->window), "delete_event", | |
465 GTK_SIGNAL_FUNC(destroy_dialog), w->window); | |
466 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
467 GTK_SIGNAL_FUNC(destroy_dialog), w->window); | |
468 gtk_signal_connect(GTK_OBJECT(warn), "clicked", | |
469 GTK_SIGNAL_FUNC(do_warn), w); | |
470 /* Finish up */ | |
471 gtk_widget_show(warn); | |
472 gtk_widget_show(cancel); | |
473 gtk_widget_show(w->anon); | |
474 gtk_widget_show(bbox); | |
475 gtk_widget_show(vbox); | |
467 | 476 gtk_widget_show(frame); |
477 gtk_widget_show(fbox); | |
478 | |
479 gtk_window_set_title(GTK_WINDOW(w->window), _("Gaim - Warn user?")); | |
480 gtk_container_add(GTK_CONTAINER(w->window), fbox); | |
481 gtk_container_set_border_width(GTK_CONTAINER(w->window), 5); | |
482 gtk_widget_realize(w->window); | |
1 | 483 aol_icon(w->window->window); |
484 | |
485 gtk_widget_show(w->window); | |
25 | 486 g_free(buf); |
1 | 487 } |
488 | |
489 | |
490 /*------------------------------------------------------------------------*/ | |
491 /* The dialog for getting an error */ | |
492 /*------------------------------------------------------------------------*/ | |
493 | |
494 void | |
495 do_error_dialog(char *message, char *title) | |
496 { | |
497 GtkWidget *d; | |
498 GtkWidget *label; | |
463 | 499 GtkWidget *icon_i; |
500 GdkBitmap *mask; | |
501 GdkPixmap *icon; | |
502 GtkWidget *button_box; | |
1 | 503 GtkWidget *close; |
504 | |
505 | |
506 d = gtk_dialog_new(); | |
463 | 507 gtk_window_set_policy(GTK_WINDOW(d), FALSE, FALSE, TRUE); |
471
4d0b703a094c
[gaim-migrate @ 481]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
470
diff
changeset
|
508 gtk_widget_realize(d); |
1 | 509 label = gtk_label_new(message); |
510 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
511 gtk_widget_show(label); | |
512 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox), | |
513 label, FALSE, FALSE, 5); | |
463 | 514 |
515 /* Build Close Button */ | |
516 | |
517 close = gtk_button_new(); | |
518 | |
519 button_box = gtk_hbox_new(FALSE, 5); | |
520 icon = gdk_pixmap_create_from_xpm_d ( d->window, &mask, NULL, cancel_xpm); | |
521 icon_i = gtk_pixmap_new(icon, mask); | |
522 | |
523 label = gtk_label_new(_("Close")); | |
524 | |
525 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
526 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
527 | |
528 gtk_widget_show(label); | |
529 gtk_widget_show(icon_i); | |
530 | |
531 gtk_widget_show(button_box); | |
532 | |
533 gtk_container_add(GTK_CONTAINER(close), button_box); | |
483 | 534 gtk_widget_set_usize(close, 75, 30); |
463 | 535 gtk_widget_show(close); |
536 | |
537 /* End of Close Button */ | |
538 | |
1 | 539 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), |
540 close, FALSE, FALSE, 5); | |
463 | 541 |
542 gtk_container_set_border_width(GTK_CONTAINER(d), 5); | |
1 | 543 gtk_window_set_title(GTK_WINDOW(d), title); |
544 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(destroy_dialog), d); | |
545 aol_icon(d->window); | |
546 | |
547 gtk_widget_show(d); | |
548 } | |
549 | |
550 | |
551 | |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
552 void show_error_dialog(char *d) |
1 | 553 { |
554 | |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
555 int no = atoi(d); |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
556 char *w; |
1 | 557 char buf[256]; |
558 char buf2[32]; | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
559 |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
560 #ifdef GAIM_PLUGINS |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
561 GList *c = callbacks; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
562 struct gaim_callback *g; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
563 void (*function)(int, void *); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
564 while (c) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
565 g = (struct gaim_callback *)c->data; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
566 if (g->event == event_error && g->function != NULL) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
567 function = g->function; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
568 (*function)(no, g->data); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
569 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
570 c = c->next; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
571 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
572 #endif |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
573 |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
574 if (USE_OSCAR) |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
575 w = d + 4; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
576 else |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
577 w = strtok(NULL, ":"); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
578 |
1 | 579 |
580 switch(no) { | |
581 case 69: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
582 g_snprintf(buf, sizeof(buf), _("Unable to write file %s."), w); |
1 | 583 break; |
584 case 169: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
585 g_snprintf(buf, sizeof(buf), _("Unable to read file %s."), w); |
1 | 586 break; |
587 case 269: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
588 g_snprintf(buf, sizeof(buf), _("Message too long, last %s bytes truncated."), w); |
1 | 589 break; |
590 case 901: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
591 g_snprintf(buf, sizeof(buf), _("%s not currently logged in."), w); |
1 | 592 break; |
593 case 902: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
594 g_snprintf(buf, sizeof(buf), _("Warning of %s not allowed."), w); |
1 | 595 break; |
596 case 903: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
597 g_snprintf(buf, sizeof(buf), _("A message has been dropped, you are exceeding the server speed limit.")); |
1 | 598 break; |
599 case 950: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
600 g_snprintf(buf, sizeof(buf), _("Chat in %s is not available."), w); |
1 | 601 break; |
602 case 960: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
603 g_snprintf(buf, sizeof(buf), _("You are sending messages too fast to %s."), w); |
1 | 604 break; |
605 case 961: | |
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 too big."), w); |
1 | 607 break; |
608 case 962: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
609 g_snprintf(buf, sizeof(buf), _("You missed an IM from %s because it was sent too fast."), w); |
1 | 610 break; |
611 case 970: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
612 g_snprintf(buf, sizeof(buf), _("Failure.")); |
1 | 613 break; |
614 case 971: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
615 g_snprintf(buf, sizeof(buf), _("Too many matches.")); |
1 | 616 break; |
617 case 972: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
618 g_snprintf(buf, sizeof(buf), _("Need more qualifiers.")); |
1 | 619 break; |
620 case 973: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
621 g_snprintf(buf, sizeof(buf), _("Dir service temporarily unavailable.")); |
1 | 622 break; |
623 case 974: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
624 g_snprintf(buf, sizeof(buf), _("Email lookup restricted.")); |
1 | 625 break; |
626 case 975: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
627 g_snprintf(buf, sizeof(buf), _("Keyword ignored.")); |
1 | 628 break; |
629 case 976: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
630 g_snprintf(buf, sizeof(buf), _("No keywords.")); |
1 | 631 break; |
632 case 977: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
633 g_snprintf(buf, sizeof(buf), _("User has no directory information.")); |
1 | 634 /* g_snprintf(buf, sizeof(buf), "Language not supported."); */ |
635 break; | |
636 case 978: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
637 g_snprintf(buf, sizeof(buf), _("Country not supported.")); |
1 | 638 break; |
639 case 979: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
640 g_snprintf(buf, sizeof(buf), _("Failure unknown: %s."), w); |
1 | 641 break; |
642 case 980: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
643 g_snprintf(buf, sizeof(buf), _("Incorrect nickname or password.")); |
1 | 644 break; |
645 case 981: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
646 g_snprintf(buf, sizeof(buf), _("The service is temporarily unavailable.")); |
1 | 647 break; |
648 case 982: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
649 g_snprintf(buf, sizeof(buf), _("Your warning level is currently too high to log in.")); |
1 | 650 break; |
651 case 983: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
652 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 | 653 break; |
654 case 989: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
655 g_snprintf(buf, sizeof(buf), _("An unknown signon error has occurred: %s."), w); |
1 | 656 break; |
657 default: | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
658 g_snprintf(buf, sizeof(buf), _("An unknown error, %d, has occured. Info: %s"), no, w); |
1 | 659 } |
660 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
661 g_snprintf(buf2, sizeof(buf2), _("Gaim - Error %d"), no); |
1 | 662 |
663 | |
664 do_error_dialog(buf, buf2); | |
665 return; | |
666 } | |
667 | |
668 static void do_im(GtkWidget *widget, GtkWidget *imentry) | |
669 { | |
670 char *who; | |
671 struct conversation *c; | |
467 | 672 char *test; |
673 | |
1 | 674 who = g_strdup(normalize(gtk_entry_get_text(GTK_ENTRY(imentry)))); |
675 destroy_dialog(NULL, imdialog); | |
676 imdialog = NULL; | |
677 | |
678 if (!strcasecmp(who, "")) { | |
679 g_free(who); | |
680 return; | |
681 } | |
682 | |
683 c = find_conversation(who); | |
684 | |
685 if (c == NULL) { | |
686 c = new_conversation(who); | |
687 } else { | |
688 gdk_window_raise(c->window->window); | |
689 } | |
690 g_free(who); | |
691 } | |
692 | |
693 void show_ee_dialog(int ee) | |
694 { | |
695 GtkWidget *ok; | |
696 GtkWidget *label; | |
697 GtkWidget *box; | |
698 GtkWidget *eedialog; | |
699 | |
700 eedialog = gtk_window_new(GTK_WINDOW_DIALOG); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
701 ok = gtk_button_new_with_label(_("OK")); |
1 | 702 box = gtk_vbox_new(FALSE, 10); |
703 | |
704 if (ee == 0) | |
705 label = gtk_label_new("Amazing! Simply Amazing!"); | |
706 else if (ee == 1) | |
707 label = gtk_label_new("Pimpin\' Penguin Style! *Waddle Waddle*"); | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
708 else if (ee == 2) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
709 label = gtk_label_new("You should be me. I'm so cute!"); |
1 | 710 else |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
711 label = gtk_label_new("Now that's what I like!"); |
1 | 712 |
713 gtk_widget_show(label); | |
714 gtk_widget_show(ok); | |
715 | |
716 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 10); | |
717 gtk_box_pack_start(GTK_BOX(box), ok, FALSE, FALSE, 10); | |
718 | |
719 gtk_widget_show(box); | |
720 | |
721 gtk_container_add(GTK_CONTAINER(eedialog), box); | |
722 gtk_window_set_title(GTK_WINDOW(eedialog), "Gaim - SUPRISE!"); | |
723 | |
724 gtk_signal_connect(GTK_OBJECT(ok), "clicked", | |
725 GTK_SIGNAL_FUNC(destroy_dialog), eedialog); | |
726 gtk_widget_realize(eedialog); | |
727 aol_icon(eedialog->window); | |
728 | |
729 gtk_widget_show(eedialog); | |
730 } | |
731 | |
732 void show_im_dialog(GtkWidget *w, GtkWidget *w2) | |
733 { | |
455 | 734 GtkWidget *button; |
735 GtkWidget *button_box; | |
736 GtkWidget *icon_i; | |
737 GdkBitmap *mask; | |
738 GdkPixmap *icon; | |
1 | 739 GtkWidget *imentry; |
740 GtkWidget *vbox; | |
741 GtkWidget *ebox; | |
742 GtkWidget *bbox; | |
743 GtkWidget *label; | |
455 | 744 GtkWidget *frame; |
745 GtkWidget *fbox; | |
1 | 746 |
747 if (!imdialog) { | |
748 | |
749 imdialog = gtk_window_new(GTK_WINDOW_DIALOG); | |
455 | 750 gtk_widget_set_usize(imdialog, 255, 105); |
751 gtk_container_border_width(GTK_CONTAINER(imdialog), 5); | |
458 | 752 gtk_window_set_policy(GTK_WINDOW(imdialog), FALSE, FALSE, TRUE); |
455 | 753 gtk_widget_show(imdialog); |
754 | |
755 bbox = gtk_hbox_new(TRUE, 10); | |
1 | 756 vbox = gtk_vbox_new(FALSE, 5); |
757 ebox = gtk_hbox_new(FALSE, 2); | |
455 | 758 fbox = gtk_vbox_new(TRUE, 10); |
759 | |
760 frame = gtk_frame_new(_("Send Instant Message")); | |
467 | 761 |
762 imentry = gtk_entry_new(); | |
455 | 763 |
764 /* Build OK Button */ | |
765 | |
766 button = gtk_button_new(); | |
767 | |
768 button_box = gtk_hbox_new(FALSE, 5); | |
769 icon = gdk_pixmap_create_from_xpm_d ( imdialog->window, &mask, NULL, ok_xpm); | |
770 icon_i = gtk_pixmap_new(icon, mask); | |
771 | |
772 label = gtk_label_new(_("OK")); | |
773 | |
774 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
775 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
776 | |
777 gtk_widget_show(label); | |
778 gtk_widget_show(icon_i); | |
779 | |
780 gtk_widget_show(button_box); | |
781 | |
782 gtk_container_add(GTK_CONTAINER(button), button_box); | |
783 | |
784 gtk_signal_connect(GTK_OBJECT(button), "clicked", | |
785 GTK_SIGNAL_FUNC(do_im), imentry); | |
786 | |
787 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 5); | |
788 | |
483 | 789 gtk_widget_set_usize(button, 75, 30); |
455 | 790 gtk_widget_show(button); |
791 | |
792 /* End of OK Button */ | |
793 | |
794 /* Build Cancel Button */ | |
795 | |
796 button = gtk_button_new(); | |
797 | |
798 button_box = gtk_hbox_new(FALSE, 5); | |
799 icon = gdk_pixmap_create_from_xpm_d ( imdialog->window, &mask, NULL, cancel_xpm); | |
800 | |
801 icon_i = gtk_pixmap_new(icon, mask); | |
802 | |
803 label = gtk_label_new(_("Cancel")); | |
804 | |
805 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
806 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
807 | |
808 gtk_widget_show(label); | |
809 gtk_widget_show(icon_i); | |
810 | |
811 gtk_widget_show(button_box); | |
812 | |
813 gtk_container_add(GTK_CONTAINER(button), button_box); | |
814 | |
815 gtk_signal_connect(GTK_OBJECT(button), "clicked", | |
816 GTK_SIGNAL_FUNC(destroy_dialog), imdialog); | |
817 | |
818 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 5); | |
819 | |
483 | 820 gtk_widget_set_usize(button, 75, 30); |
455 | 821 gtk_widget_show(button); |
822 | |
823 /* End of Cancel Button */ | |
824 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
825 label = gtk_label_new(_("IM who: ")); |
1 | 826 gtk_box_pack_start(GTK_BOX(ebox), label, TRUE, TRUE, 10); |
827 gtk_widget_show(label); | |
828 | |
829 gtk_box_pack_start(GTK_BOX(ebox), imentry, TRUE, TRUE, 10); | |
830 | |
831 gtk_box_pack_start(GTK_BOX(vbox), ebox, FALSE, FALSE, 5); | |
832 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); | |
833 | |
834 /* Handle closes right */ | |
835 gtk_signal_connect(GTK_OBJECT(imentry), "activate", | |
836 GTK_SIGNAL_FUNC(do_im), imentry); | |
837 gtk_signal_connect(GTK_OBJECT(imdialog), "destroy", | |
838 GTK_SIGNAL_FUNC(destroy_dialog), imdialog); | |
455 | 839 |
840 /* Finish up */ | |
1 | 841 gtk_widget_show(ebox); |
842 gtk_widget_show(imentry); | |
843 gtk_widget_show(bbox); | |
844 gtk_widget_show(vbox); | |
455 | 845 gtk_widget_show(fbox); |
846 gtk_widget_show(frame); | |
847 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
848 gtk_box_pack_start(GTK_BOX(fbox), frame, FALSE, FALSE, 5); | |
849 gtk_window_set_title(GTK_WINDOW(imdialog), _("Gaim - IM user")); | |
850 gtk_container_add(GTK_CONTAINER(imdialog), fbox); | |
1 | 851 gtk_widget_grab_focus(imentry); |
852 gtk_widget_realize(imdialog); | |
455 | 853 |
854 aol_icon(imdialog->window); | |
1 | 855 |
856 } | |
857 gtk_widget_show(imdialog); | |
858 } | |
859 | |
860 | |
861 /*------------------------------------------------------------------------*/ | |
862 /* The dialog for adding buddies */ | |
863 /*------------------------------------------------------------------------*/ | |
864 | |
865 void do_add_buddy(GtkWidget *w, struct addbuddy *a) | |
866 { | |
867 char *grp, *who; | |
868 struct conversation *c; | |
869 | |
870 who = gtk_entry_get_text(GTK_ENTRY(a->entry)); | |
871 grp = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(a->combo)->entry)); | |
872 | |
873 c = find_conversation(who); | |
874 | |
875 add_buddy(grp, who); | |
876 | |
877 if (c != NULL) | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
878 gtk_label_set_text(GTK_LABEL(GTK_BIN(c->add_button)->child), _("Remove")); |
1 | 879 |
880 build_edit_tree(); | |
881 | |
882 serv_save_config(); | |
883 | |
884 serv_add_buddy(who); | |
885 | |
228 | 886 do_export( (GtkWidget *) NULL, 0 ); |
887 | |
1 | 888 update_num_groups(); |
889 | |
890 destroy_dialog(NULL, a->window); | |
891 } | |
892 | |
893 | |
894 static GList *groups_tree() | |
895 { | |
896 GList *tmp=NULL; | |
897 char *tmp2; | |
898 struct group *g; | |
899 GList *grp = groups; | |
900 | |
901 if (!grp) { | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
902 tmp2 = g_strdup(_("Buddies")); |
1 | 903 tmp = g_list_append(tmp, tmp2); |
904 } else { | |
905 while(grp) { | |
906 g = (struct group *)grp->data; | |
907 tmp2 = g->name; | |
908 tmp=g_list_append(tmp, tmp2); | |
909 grp = grp->next; | |
910 } | |
911 } | |
912 return tmp; | |
913 } | |
914 | |
915 | |
916 void show_add_buddy(char *buddy, char *group) | |
917 { | |
918 GtkWidget *cancel; | |
919 GtkWidget *add; | |
920 GtkWidget *label; | |
921 GtkWidget *bbox; | |
922 GtkWidget *vbox; | |
923 GtkWidget *topbox; | |
236 | 924 GtkWidget *frame; |
459 | 925 GtkWidget *icon_i; |
926 GdkBitmap *mask; | |
927 GdkPixmap *icon; | |
928 GtkWidget *button_box; | |
236 | 929 |
1 | 930 struct addbuddy *a = g_new0(struct addbuddy, 1); |
931 | |
932 a->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
459 | 933 gtk_widget_set_usize(a->window, 480, 105); |
934 gtk_window_set_policy(GTK_WINDOW(a->window), FALSE, FALSE, TRUE); | |
935 gtk_widget_show(a->window); | |
936 dialogwindows = g_list_prepend(dialogwindows, a->window); | |
937 | |
938 bbox = gtk_hbox_new(TRUE, 10); | |
1 | 939 topbox = gtk_hbox_new(FALSE, 5); |
940 vbox = gtk_vbox_new(FALSE, 5); | |
244 | 941 |
1 | 942 a->entry = gtk_entry_new(); |
943 a->combo = gtk_combo_new(); | |
944 /* Fix the combo box */ | |
945 gtk_combo_set_popdown_strings(GTK_COMBO(a->combo), groups_tree()); | |
946 /* Put the buttons in the box */ | |
236 | 947 |
459 | 948 /* Build Add Button */ |
949 | |
950 add = gtk_button_new(); | |
951 | |
952 button_box = gtk_hbox_new(FALSE, 5); | |
953 icon = gdk_pixmap_create_from_xpm_d ( a->window->window, &mask, NULL, add_xpm); | |
954 icon_i = gtk_pixmap_new(icon, mask); | |
955 | |
956 label = gtk_label_new(_("Add")); | |
957 | |
958 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
959 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
960 | |
961 gtk_widget_show(label); | |
962 gtk_widget_show(icon_i); | |
963 | |
964 gtk_widget_show(button_box); | |
965 | |
966 gtk_container_add(GTK_CONTAINER(add), button_box); | |
967 | |
968 /* End of OK Button */ | |
969 | |
970 /* Build Cancel Button */ | |
971 | |
972 cancel = gtk_button_new(); | |
973 | |
974 button_box = gtk_hbox_new(FALSE, 5); | |
975 icon = gdk_pixmap_create_from_xpm_d ( a->window->window, &mask, NULL, cancel_xpm); | |
976 icon_i = gtk_pixmap_new(icon, mask); | |
977 | |
978 label = gtk_label_new(_("Cancel")); | |
979 | |
980 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
981 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
982 | |
983 gtk_widget_show(label); | |
984 gtk_widget_show(icon_i); | |
985 | |
986 gtk_widget_show(button_box); | |
987 | |
988 gtk_container_add(GTK_CONTAINER(cancel), button_box); | |
989 | |
990 /* End of Cancel Button */ | |
483 | 991 |
992 gtk_widget_set_usize(add, 75, 30); | |
993 gtk_widget_set_usize(cancel, 75, 30); | |
459 | 994 |
995 gtk_box_pack_start(GTK_BOX(bbox), add, FALSE, FALSE, 5); | |
996 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 5); | |
1 | 997 |
236 | 998 frame = gtk_frame_new(NULL); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
999 gtk_frame_set_label(GTK_FRAME(frame), _("Add Buddy")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1000 |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1001 label = gtk_label_new(_("Buddy")); |
1 | 1002 gtk_widget_show(label); |
1003 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); | |
1004 gtk_box_pack_start(GTK_BOX(topbox), a->entry, FALSE, FALSE, 5); | |
1005 if (buddy != NULL) | |
1006 gtk_entry_set_text(GTK_ENTRY(a->entry), buddy); | |
1007 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1008 label = gtk_label_new(_("Group")); |
1 | 1009 gtk_widget_show(label); |
1010 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); | |
1011 gtk_box_pack_start(GTK_BOX(topbox), a->combo, FALSE, FALSE, 5); | |
1012 | |
1013 if (group != NULL) | |
1014 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(a->combo)->entry), group); | |
1015 | |
1016 /* And the boxes in the box */ | |
1017 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); | |
459 | 1018 gtk_box_pack_start(GTK_BOX(vbox), bbox, TRUE, TRUE, 5); |
1 | 1019 |
1020 /* Handle closes right */ | |
1021 gtk_signal_connect(GTK_OBJECT(a->window), "destroy", | |
1022 GTK_SIGNAL_FUNC(destroy_dialog), a->window); | |
1023 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
1024 GTK_SIGNAL_FUNC(destroy_dialog), a->window); | |
1025 gtk_signal_connect(GTK_OBJECT(add), "clicked", | |
1026 GTK_SIGNAL_FUNC(do_add_buddy), a); | |
1027 gtk_signal_connect(GTK_OBJECT(a->entry), "activate", | |
1028 GTK_SIGNAL_FUNC(do_add_buddy), a); | |
1029 /* Finish up */ | |
1030 gtk_widget_show(add); | |
1031 gtk_widget_show(cancel); | |
1032 gtk_widget_show(a->combo); | |
1033 gtk_widget_show(a->entry); | |
1034 gtk_widget_show(topbox); | |
1035 gtk_widget_show(bbox); | |
1036 gtk_widget_show(vbox); | |
236 | 1037 gtk_widget_show(frame); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1038 gtk_window_set_title(GTK_WINDOW(a->window), _("Gaim - Add Buddy")); |
1 | 1039 gtk_window_set_focus(GTK_WINDOW(a->window), a->entry); |
245 | 1040 gtk_container_add(GTK_CONTAINER(frame), vbox); |
236 | 1041 gtk_container_add(GTK_CONTAINER(a->window), frame); |
1042 gtk_container_set_border_width(GTK_CONTAINER(a->window), 5); | |
1 | 1043 gtk_widget_realize(a->window); |
1044 aol_icon(a->window->window); | |
1045 | |
1046 gtk_widget_show(a->window); | |
1047 } | |
1048 | |
1049 | |
1050 /*------------------------------------------------------------------------*/ | |
1051 /* The dialog for new buddy pounces */ | |
1052 /*------------------------------------------------------------------------*/ | |
1053 | |
1054 | |
1055 void do_new_bp(GtkWidget *w, struct addbp *b) | |
1056 { | |
1057 struct buddy_pounce *bp = g_new0(struct buddy_pounce, 1); | |
1058 | |
26 | 1059 g_snprintf(bp->name, 80, "%s", gtk_entry_get_text(GTK_ENTRY(b->nameentry))); |
1060 g_snprintf(bp->message, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->messentry))); | |
1061 | |
1 | 1062 if (GTK_TOGGLE_BUTTON(b->openwindow)->active) |
1063 bp->popup = 1; | |
1064 else | |
1065 bp->popup = 0; | |
1066 | |
1067 if (GTK_TOGGLE_BUTTON(b->sendim)->active) | |
1068 bp->sendim = 1; | |
1069 else | |
1070 bp->sendim = 0; | |
26 | 1071 |
1 | 1072 buddy_pounces = g_list_append(buddy_pounces, bp); |
1073 | |
1074 do_bp_menu(); | |
1075 | |
1076 destroy_dialog(NULL, b->window); | |
1077 g_free(b); | |
1078 } | |
1079 | |
1080 | |
1081 void show_new_bp(char *name) | |
1082 { | |
1083 GtkWidget *label; | |
1084 GtkWidget *bbox; | |
1085 GtkWidget *vbox; | |
443 | 1086 GtkWidget *icon_i; |
1087 GdkPixmap *icon; | |
1088 GdkBitmap *mask; | |
1089 GtkWidget *button; | |
1090 GtkWidget *button_box; | |
1 | 1091 |
1092 struct addbp *b = g_new0(struct addbp, 1); | |
1093 | |
1094 b->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
458 | 1095 gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, FALSE, TRUE); |
443 | 1096 gtk_widget_show(b->window); |
1 | 1097 dialogwindows = g_list_prepend(dialogwindows, b->window); |
1098 bbox = gtk_hbox_new(TRUE, 10); | |
1099 vbox = gtk_vbox_new(FALSE, 5); | |
1100 b->nameentry = gtk_entry_new(); | |
1101 b->messentry = gtk_entry_new(); | |
443 | 1102 |
1103 /* Build OK Button */ | |
1104 | |
1105 button = gtk_button_new(); | |
1106 | |
1107 button_box = gtk_hbox_new(FALSE, 5); | |
1108 icon = gdk_pixmap_create_from_xpm_d ( b->window->window, &mask, NULL, ok_xpm); | |
1109 icon_i = gtk_pixmap_new(icon, mask); | |
1110 | |
1111 label = gtk_label_new(_("OK")); | |
1112 | |
1113 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
1114 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
1115 | |
1116 gtk_widget_show(label); | |
1117 gtk_widget_show(icon_i); | |
1118 | |
1119 gtk_widget_show(button_box); | |
1120 | |
1121 gtk_container_add(GTK_CONTAINER(button), button_box); | |
1122 | |
1123 gtk_signal_connect(GTK_OBJECT(button), "clicked", | |
1124 GTK_SIGNAL_FUNC(do_new_bp), b); | |
1125 | |
1126 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 5); | |
1127 | |
483 | 1128 gtk_widget_set_usize(button, 75, 30); |
443 | 1129 gtk_widget_show(button); |
1130 | |
1131 /* End of OK Button */ | |
1132 | |
1133 /* Build Cancel Button */ | |
1134 | |
1135 button = gtk_button_new(); | |
1136 | |
1137 button_box = gtk_hbox_new(FALSE, 5); | |
1138 icon = gdk_pixmap_create_from_xpm_d ( b->window->window, &mask, NULL, cancel_xpm); | |
1139 icon_i = gtk_pixmap_new(icon, mask); | |
1140 | |
1141 label = gtk_label_new(_("Cancel")); | |
1142 | |
1143 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
1144 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
1145 | |
1146 gtk_widget_show(label); | |
1147 gtk_widget_show(icon_i); | |
1148 | |
1149 gtk_widget_show(button_box); | |
1150 | |
1151 gtk_container_add(GTK_CONTAINER(button), button_box); | |
1152 | |
1153 gtk_signal_connect(GTK_OBJECT(button), "clicked", | |
1154 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1155 | |
1156 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 5); | |
1157 | |
483 | 1158 gtk_widget_set_usize(button, 75, 30); |
443 | 1159 gtk_widget_show(button); |
1160 | |
1161 /* End of Cancel Button */ | |
1 | 1162 |
1163 /* Put the buttons in the box */ | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1164 label = gtk_label_new(_("Buddy To Pounce:")); |
1 | 1165 gtk_widget_show(label); |
1166 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
1167 gtk_box_pack_start(GTK_BOX(vbox), b->nameentry, FALSE, FALSE, 0); | |
1168 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1169 b->openwindow = gtk_check_button_new_with_label(_("Open IM Window on Buddy Logon")); |
1 | 1170 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->openwindow), FALSE); |
1171 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1172 b->sendim = gtk_check_button_new_with_label(_("Send IM on Buddy Logon")); |
1 | 1173 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sendim), TRUE); |
1174 | |
1175 gtk_widget_show(b->openwindow); | |
1176 gtk_widget_show(b->sendim); | |
1177 gtk_box_pack_start(GTK_BOX(vbox), b->openwindow, FALSE, FALSE, 0); | |
1178 gtk_box_pack_start(GTK_BOX(vbox), b->sendim, FALSE, FALSE, 0); | |
1179 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1180 label = gtk_label_new(_("Message to send:")); |
1 | 1181 gtk_widget_show(label); |
1182 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
1183 gtk_box_pack_start(GTK_BOX(vbox), b->messentry, FALSE, FALSE, 0); | |
1184 | |
1185 | |
1186 /* And the boxes in the box */ | |
1187 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
1188 | |
1189 /* Handle closes right */ | |
1190 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", | |
1191 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1192 gtk_signal_connect(GTK_OBJECT(b->messentry), "activate", | |
1193 GTK_SIGNAL_FUNC(do_new_bp), b); | |
1194 | |
1195 | |
1196 /* Finish up */ | |
1197 gtk_widget_show(b->nameentry); | |
1198 gtk_widget_show(b->messentry); | |
1199 gtk_widget_show(bbox); | |
1200 gtk_widget_show(vbox); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1201 gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - New Buddy Pounce")); |
1 | 1202 if (name != NULL) { |
1203 gtk_entry_set_text(GTK_ENTRY(b->nameentry), name); | |
1204 gtk_window_set_focus(GTK_WINDOW(b->window), b->messentry); | |
1205 } else | |
1206 gtk_window_set_focus(GTK_WINDOW(b->window), b->nameentry); | |
1207 gtk_container_add(GTK_CONTAINER(b->window), vbox); | |
1208 gtk_container_border_width(GTK_CONTAINER(b->window), 10); | |
1209 gtk_widget_realize(b->window); | |
1210 aol_icon(b->window->window); | |
1211 } | |
1212 | |
1213 | |
1214 | |
1215 /*------------------------------------------------------------------------*/ | |
1216 /* The dialog for SET INFO / SET DIR INFO */ | |
1217 /*------------------------------------------------------------------------*/ | |
1218 | |
1219 void do_save_info(GtkWidget *widget, struct set_info_dlg *b) | |
1220 { | |
1221 gchar *junk; | |
1222 char *buf; | |
1223 | |
1224 junk = gtk_editable_get_chars(GTK_EDITABLE(b->text), 0, -1); | |
1225 | |
1226 g_snprintf(current_user->user_info, sizeof(current_user->user_info), "%s", junk); | |
25 | 1227 |
1 | 1228 save_prefs(); |
1229 | |
79 | 1230 buf = g_malloc(strlen(current_user->user_info) * 4); |
122
521db4bf5f28
[gaim-migrate @ 132]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
84
diff
changeset
|
1231 if (!buf) { |
521db4bf5f28
[gaim-migrate @ 132]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
84
diff
changeset
|
1232 buf = g_malloc(1); |
521db4bf5f28
[gaim-migrate @ 132]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
84
diff
changeset
|
1233 buf[0] = 0; |
521db4bf5f28
[gaim-migrate @ 132]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
84
diff
changeset
|
1234 } |
1 | 1235 g_snprintf(buf, strlen(current_user->user_info) * 2, "%s", current_user->user_info); |
1236 escape_text(buf); | |
1237 serv_set_info(buf); | |
1238 g_free(buf); | |
25 | 1239 g_free(junk); |
1 | 1240 destroy_dialog(NULL, b->window); |
1241 g_free(b); | |
1242 } | |
1243 | |
1244 void do_set_dir(GtkWidget *widget, struct set_dir_dlg *b) | |
1245 { | |
1246 char *first = gtk_entry_get_text(GTK_ENTRY(b->first)); | |
1247 int web = GTK_TOGGLE_BUTTON(b->web)->active; | |
1248 char *middle = gtk_entry_get_text(GTK_ENTRY(b->middle)); | |
1249 char *last = gtk_entry_get_text(GTK_ENTRY(b->last)); | |
1250 char *maiden = gtk_entry_get_text(GTK_ENTRY(b->maiden)); | |
1251 char *city = gtk_entry_get_text(GTK_ENTRY(b->city)); | |
1252 char *state = gtk_entry_get_text(GTK_ENTRY(b->state)); | |
1253 char *country = gtk_entry_get_text(GTK_ENTRY(b->country)); | |
1254 | |
1255 | |
1256 serv_set_dir(first, middle, last, maiden, city, state, country, web); | |
1257 | |
1258 destroy_dialog(NULL, b->window); | |
1259 g_free(b); | |
1260 } | |
1261 | |
1262 void show_set_dir() | |
1263 { | |
1264 GtkWidget *label; | |
1265 GtkWidget *bot; | |
484 | 1266 GtkWidget *vbox; |
1267 GtkWidget *hbox; | |
1268 GtkWidget *icon_i; | |
1269 GdkBitmap *mask; | |
1270 GdkPixmap *icon; | |
1271 GtkWidget *button_box; | |
1272 GtkWidget *frame; | |
1273 GtkWidget *fbox; | |
1 | 1274 |
1275 struct set_dir_dlg *b = g_new0(struct set_dir_dlg, 1); | |
1276 | |
1277 b->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
484 | 1278 gtk_widget_set_usize(b->window, 300, 320); |
1279 gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, FALSE, TRUE); | |
1280 gtk_widget_show(b->window); | |
1281 | |
1 | 1282 dialogwindows = g_list_prepend(dialogwindows, b->window); |
484 | 1283 |
1284 vbox = gtk_vbox_new(FALSE, 5); | |
1285 fbox = gtk_vbox_new(FALSE, 5); | |
1286 | |
1287 frame = gtk_frame_new(_("Directory Info")); | |
1288 | |
1289 /* Build Save Button */ | |
1290 | |
1291 b->save = gtk_button_new(); | |
1292 | |
1293 button_box = gtk_hbox_new(FALSE, 5); | |
1294 icon = gdk_pixmap_create_from_xpm_d ( b->window->window, &mask, NULL, save_xpm); | |
1295 icon_i = gtk_pixmap_new(icon, mask); | |
1 | 1296 |
484 | 1297 label = gtk_label_new(_("Save")); |
1298 | |
1299 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
1300 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
1301 | |
1302 gtk_widget_show(label); | |
1303 gtk_widget_show(icon_i); | |
1304 | |
1305 gtk_widget_show(button_box); | |
1306 | |
1307 gtk_container_add(GTK_CONTAINER(b->save), button_box); | |
1308 | |
1309 /* End of OK Button */ | |
1310 | |
1311 /* Build Cancel Button */ | |
1312 | |
1313 b->cancel = gtk_button_new(); | |
1314 | |
1315 button_box = gtk_hbox_new(FALSE, 5); | |
1316 icon = gdk_pixmap_create_from_xpm_d ( b->window->window, &mask, NULL, cancel_xpm); | |
1317 icon_i = gtk_pixmap_new(icon, mask); | |
1318 | |
1319 label = gtk_label_new(_("Cancel")); | |
1320 | |
1321 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
1322 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
1323 | |
1324 gtk_widget_show(label); | |
1325 gtk_widget_show(icon_i); | |
1326 | |
1327 gtk_widget_show(button_box); | |
1328 | |
1329 gtk_container_add(GTK_CONTAINER(b->cancel), button_box); | |
1330 | |
1331 /* End of Cancel Button */ | |
1 | 1332 bot = gtk_hbox_new(TRUE, 10); |
484 | 1333 |
1334 gtk_widget_set_usize(b->save, 75, 30); | |
1335 gtk_widget_set_usize(b->cancel, 75, 30); | |
1 | 1336 |
1337 gtk_widget_show(b->save); | |
1338 gtk_widget_show(b->cancel); | |
1339 | |
1340 gtk_box_pack_start(GTK_BOX(bot), b->save, FALSE, FALSE, 5); | |
1341 gtk_box_pack_start(GTK_BOX(bot), b->cancel, FALSE, FALSE, 5); | |
1342 | |
1343 gtk_widget_show(bot); | |
1344 | |
1345 b->first = gtk_entry_new(); | |
1346 b->middle = gtk_entry_new(); | |
1347 b->last = gtk_entry_new(); | |
1348 b->maiden = gtk_entry_new(); | |
1349 b->city = gtk_entry_new(); | |
1350 b->state = gtk_entry_new(); | |
1351 b->country = gtk_entry_new(); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1352 b->web = gtk_check_button_new_with_label(_("Allow Web Searches To Find Your Info")); |
484 | 1353 |
1354 /* Line 1 */ | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1355 label = gtk_label_new(_("First Name")); |
1 | 1356 gtk_widget_show(label); |
1357 | |
484 | 1358 hbox = gtk_hbox_new(FALSE, 5); |
1359 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); | |
1360 gtk_box_pack_end(GTK_BOX(hbox), b->first, FALSE, FALSE, 2); | |
1361 | |
1362 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); | |
1363 gtk_widget_show(hbox); | |
1364 | |
1365 /* Line 2 */ | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1366 label = gtk_label_new(_("Middle Name")); |
1 | 1367 gtk_widget_show(label); |
484 | 1368 |
1369 hbox = gtk_hbox_new(FALSE, 5); | |
1370 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); | |
1371 gtk_box_pack_end(GTK_BOX(hbox), b->middle, FALSE, FALSE, 2); | |
1372 | |
1373 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); | |
1374 gtk_widget_show(hbox); | |
1375 | |
1376 | |
1377 /* Line 3 */ | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1378 label = gtk_label_new(_("Last Name")); |
1 | 1379 gtk_widget_show(label); |
484 | 1380 |
1381 hbox = gtk_hbox_new(FALSE, 5); | |
1382 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); | |
1383 gtk_box_pack_end(GTK_BOX(hbox), b->last, FALSE, FALSE, 2); | |
1384 | |
1385 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); | |
1386 gtk_widget_show(hbox); | |
1387 | |
1388 /* Line 4 */ | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1389 label = gtk_label_new(_("Maiden Name")); |
1 | 1390 gtk_widget_show(label); |
484 | 1391 |
1392 hbox = gtk_hbox_new(FALSE, 5); | |
1393 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); | |
1394 gtk_box_pack_end(GTK_BOX(hbox), b->maiden, FALSE, FALSE, 2); | |
1395 | |
1396 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); | |
1397 gtk_widget_show(hbox); | |
1398 | |
1399 /* Line 5 */ | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1400 label = gtk_label_new(_("City")); |
1 | 1401 gtk_widget_show(label); |
484 | 1402 |
1403 hbox = gtk_hbox_new(FALSE, 5); | |
1404 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); | |
1405 gtk_box_pack_end(GTK_BOX(hbox), b->city, FALSE, FALSE, 2); | |
1406 | |
1407 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); | |
1408 gtk_widget_show(hbox); | |
1409 | |
1410 /* Line 6 */ | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1411 label = gtk_label_new(_("State")); |
1 | 1412 gtk_widget_show(label); |
484 | 1413 |
1414 hbox = gtk_hbox_new(FALSE, 5); | |
1415 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); | |
1416 gtk_box_pack_end(GTK_BOX(hbox), b->state, FALSE, FALSE, 2); | |
1417 | |
1418 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); | |
1419 gtk_widget_show(hbox); | |
1420 | |
1421 /* Line 7 */ | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1422 label = gtk_label_new(_("Country")); |
1 | 1423 gtk_widget_show(label); |
484 | 1424 |
1425 hbox = gtk_hbox_new(FALSE, 5); | |
1426 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); | |
1427 gtk_box_pack_end(GTK_BOX(hbox), b->country, FALSE, FALSE, 2); | |
1428 | |
1429 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); | |
1430 gtk_widget_show(hbox); | |
1431 | |
1432 /* Line 8 */ | |
1433 | |
1434 hbox = gtk_hbox_new(FALSE, 5); | |
1435 gtk_box_pack_start(GTK_BOX(hbox), b->web, TRUE, TRUE, 2); | |
1436 gtk_widget_show(hbox); | |
1437 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); | |
1438 | |
1439 /* And add the buttons */ | |
1440 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
1441 gtk_box_pack_start(GTK_BOX(fbox), frame, FALSE, FALSE, 2); | |
1442 gtk_box_pack_start(GTK_BOX(fbox), bot, FALSE, FALSE, 2); | |
1443 | |
1444 | |
1445 gtk_widget_show(vbox); | |
1446 gtk_widget_show(fbox); | |
1447 | |
1448 gtk_widget_show(frame); | |
1 | 1449 gtk_widget_show(b->first); |
1450 gtk_widget_show(b->middle); | |
1451 gtk_widget_show(b->last); | |
1452 gtk_widget_show(b->maiden); | |
1453 gtk_widget_show(b->city); | |
1454 gtk_widget_show(b->state); | |
1455 gtk_widget_show(b->country); | |
1456 gtk_widget_show(b->web); | |
1457 | |
1458 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", | |
1459 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1460 gtk_signal_connect(GTK_OBJECT(b->cancel), "clicked", | |
1461 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1462 gtk_signal_connect(GTK_OBJECT(b->save), "clicked", GTK_SIGNAL_FUNC(do_set_dir), b); | |
1463 | |
484 | 1464 gtk_container_add(GTK_CONTAINER(b->window), fbox); |
1465 gtk_container_border_width(GTK_CONTAINER(b->window), 5); | |
1466 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1467 gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Set Dir Info")); |
1 | 1468 gtk_window_set_focus(GTK_WINDOW(b->window), b->first); |
1469 gtk_widget_realize(b->window); | |
1470 aol_icon(b->window->window); | |
1471 | |
1472 gtk_widget_show(b->window); | |
1473 } | |
1474 | |
149 | 1475 void do_change_password(GtkWidget *widget, struct passwddlg *b) |
1476 { | |
1477 gchar *orig, *new1, *new2; | |
1478 | |
1479 orig = gtk_entry_get_text(GTK_ENTRY(b->original)); | |
1480 new1 = gtk_entry_get_text(GTK_ENTRY(b->new1)); | |
1481 new2 = gtk_entry_get_text(GTK_ENTRY(b->new2)); | |
1482 | |
1483 if (strcasecmp(new1, new2)) { | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1484 do_error_dialog(_("New Passwords Do Not Match"), _("Gaim - Change Password Error")); |
149 | 1485 return ; |
1486 } | |
1487 | |
1488 if ((strlen(orig) < 1) || (strlen(new1) < 1) || (strlen(new2) < 1)) { | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1489 do_error_dialog(_("Fill out all fields completely"), _("Gaim - Change Password Error")); |
149 | 1490 return; |
1491 } | |
1492 | |
237
6ced2f1c8b24
[gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
236
diff
changeset
|
1493 serv_change_passwd(orig, new1); |
149 | 1494 |
1495 destroy_dialog(NULL, b->window); | |
1496 g_free(b); | |
1497 } | |
1498 | |
146 | 1499 void show_change_passwd() |
1500 { | |
1501 GtkWidget *hbox; | |
1502 GtkWidget *label; | |
1503 GtkWidget *vbox; | |
475 | 1504 |
1505 GtkWidget *button_box; | |
1506 GtkWidget *icon_i; | |
1507 GdkBitmap *mask; | |
1508 GdkPixmap *icon; | |
1509 | |
1510 GtkWidget *fbox; | |
1511 GtkWidget *frame; | |
454 | 1512 |
146 | 1513 struct passwddlg *b = g_new0(struct passwddlg, 1); |
1514 | |
1515 b->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
476 | 1516 gtk_widget_set_usize(b->window, 325, 195); |
475 | 1517 gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, FALSE, TRUE); |
1518 gtk_widget_show(b->window); | |
1519 | |
146 | 1520 dialogwindows = g_list_prepend(dialogwindows, b->window); |
149 | 1521 |
475 | 1522 frame = gtk_frame_new(_("Change Password")); |
1523 fbox = gtk_vbox_new(FALSE, 5); | |
1524 | |
1525 /* Build OK Button */ | |
1526 | |
1527 b->ok = gtk_button_new(); | |
1528 | |
1529 button_box = gtk_hbox_new(FALSE, 5); | |
1530 icon = gdk_pixmap_create_from_xpm_d ( b->window->window, &mask, NULL, ok_xpm); | |
1531 icon_i = gtk_pixmap_new(icon, mask); | |
1532 | |
1533 label = gtk_label_new(_("OK")); | |
1534 | |
1535 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
1536 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
1537 | |
1538 gtk_widget_show(label); | |
1539 gtk_widget_show(icon_i); | |
1540 | |
1541 gtk_widget_show(button_box); | |
1542 | |
1543 gtk_container_add(GTK_CONTAINER(b->ok), button_box); | |
1544 | |
1545 /* End of OK Button */ | |
1546 | |
1547 /* Build Cancel Button */ | |
1548 | |
1549 b->cancel = gtk_button_new(); | |
1550 | |
1551 button_box = gtk_hbox_new(FALSE, 5); | |
1552 icon = gdk_pixmap_create_from_xpm_d ( b->window->window, &mask, NULL, cancel_xpm); | |
1553 icon_i = gtk_pixmap_new(icon, mask); | |
1554 | |
1555 label = gtk_label_new(_("Cancel")); | |
1556 | |
1557 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
1558 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
1559 | |
1560 gtk_widget_show(label); | |
1561 gtk_widget_show(icon_i); | |
1562 | |
1563 gtk_widget_show(button_box); | |
1564 | |
1565 gtk_container_add(GTK_CONTAINER(b->cancel), button_box); | |
1566 | |
1567 /* End of Cancel Button */ | |
149 | 1568 |
483 | 1569 gtk_widget_set_usize(b->ok, 75, 30); |
1570 gtk_widget_set_usize(b->cancel, 75, 30); | |
1571 | |
149 | 1572 gtk_widget_show(b->ok); |
1573 gtk_widget_show(b->cancel); | |
1574 | |
475 | 1575 /* Create our vbox */ |
1576 vbox = gtk_vbox_new(FALSE, 5); | |
1577 | |
149 | 1578 |
475 | 1579 /* First Line */ |
1580 hbox = gtk_hbox_new(FALSE, 5); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1581 label = gtk_label_new(_("Original Password")); |
146 | 1582 gtk_widget_show(label); |
475 | 1583 |
146 | 1584 b->original = gtk_entry_new(); |
160
aaa8f0a2140e
[gaim-migrate @ 170]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
149
diff
changeset
|
1585 gtk_entry_set_visibility(GTK_ENTRY(b->original), FALSE); |
149 | 1586 gtk_widget_show(b->original); |
475 | 1587 |
1588 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
1589 gtk_box_pack_end(GTK_BOX(hbox), b->original, FALSE, FALSE, 5); | |
1590 | |
1591 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
1592 | |
1593 gtk_widget_show(hbox); | |
1594 | |
1595 /* Next Line */ | |
1596 hbox = gtk_hbox_new(FALSE, 5); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1597 label = gtk_label_new(_("New Password")); |
149 | 1598 gtk_widget_show(label); |
1599 b->new1 = gtk_entry_new(); | |
160
aaa8f0a2140e
[gaim-migrate @ 170]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
149
diff
changeset
|
1600 gtk_entry_set_visibility(GTK_ENTRY(b->new1), FALSE); |
149 | 1601 gtk_widget_show(b->new1); |
475 | 1602 |
1603 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
1604 gtk_box_pack_end(GTK_BOX(hbox), b->new1, FALSE, FALSE, 5); | |
1605 | |
1606 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
1607 gtk_widget_show(hbox); | |
1608 | |
1609 /* Next Line */ | |
1610 hbox = gtk_hbox_new(FALSE, 5); | |
1611 label = gtk_label_new(_("New Password (again)")); | |
149 | 1612 gtk_widget_show(label); |
1613 b->new2 = gtk_entry_new(); | |
160
aaa8f0a2140e
[gaim-migrate @ 170]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
149
diff
changeset
|
1614 gtk_entry_set_visibility(GTK_ENTRY(b->new2), FALSE); |
149 | 1615 gtk_widget_show(b->new2); |
475 | 1616 |
1617 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
1618 gtk_box_pack_end(GTK_BOX(hbox), b->new2, FALSE, FALSE, 5); | |
1619 | |
1620 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
1621 | |
1622 gtk_widget_show(hbox); | |
149 | 1623 |
475 | 1624 /* Now do our row of buttons */ |
149 | 1625 hbox = gtk_hbox_new(TRUE, TRUE); |
1626 gtk_box_pack_start(GTK_BOX(hbox), b->ok, FALSE, FALSE, 5); | |
1627 gtk_box_pack_start(GTK_BOX(hbox), b->cancel, FALSE, FALSE, 5); | |
475 | 1628 |
146 | 1629 gtk_widget_show(hbox); |
475 | 1630 |
1631 /* Pack our entries into a frame */ | |
1632 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
1633 | |
1634 /* Add our frame to our frame box */ | |
1635 gtk_box_pack_start(GTK_BOX(fbox), frame, FALSE, FALSE, 5); | |
1636 | |
1637 /* And add our row of buttons */ | |
1638 gtk_box_pack_start(GTK_BOX(fbox), hbox, FALSE, FALSE, 5); | |
1639 | |
1640 | |
146 | 1641 gtk_widget_show(vbox); |
475 | 1642 gtk_widget_show(frame); |
1643 gtk_widget_show(fbox); | |
1644 | |
1645 gtk_container_add(GTK_CONTAINER(b->window), fbox); | |
1646 | |
1647 gtk_container_border_width(GTK_CONTAINER(b->window), 5); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1648 gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Password Change")); |
149 | 1649 |
1650 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", | |
1651 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1652 gtk_signal_connect(GTK_OBJECT(b->cancel), "clicked", | |
1653 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1654 gtk_signal_connect(GTK_OBJECT(b->ok), "clicked", | |
1655 GTK_SIGNAL_FUNC(do_change_password), b); | |
1656 | |
1657 | |
146 | 1658 } |
1659 | |
1 | 1660 void show_set_info() |
1661 { | |
1662 GtkWidget *bot; | |
1663 GtkWidget *top; | |
454 | 1664 GtkWidget *icon_i; |
1665 GdkBitmap *mask; | |
1666 GdkPixmap *icon; | |
1667 GtkWidget *button_box; | |
1668 GtkWidget *label; | |
1669 | |
1 | 1670 struct set_info_dlg *b = g_new0(struct set_info_dlg, 1); |
1671 | |
1672 b->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
1673 dialogwindows = g_list_prepend(dialogwindows, b->window); | |
454 | 1674 gtk_widget_show(b->window); |
1 | 1675 |
1676 bot = gtk_hbox_new(TRUE, 10); | |
1677 top = gtk_vbox_new(FALSE, 10); | |
1678 | |
454 | 1679 /* Build OK Button */ |
1680 | |
1681 b->save = gtk_button_new(); | |
1682 | |
1683 button_box = gtk_hbox_new(FALSE, 5); | |
1684 icon = gdk_pixmap_create_from_xpm_d ( b->window->window, &mask, NULL, save_xpm); | |
1685 icon_i = gtk_pixmap_new(icon, mask); | |
1686 | |
1687 label = gtk_label_new(_("Save")); | |
1688 | |
1689 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
1690 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
1691 | |
1692 gtk_widget_show(label); | |
1693 gtk_widget_show(icon_i); | |
1694 | |
1695 gtk_widget_show(button_box); | |
1696 | |
1697 gtk_container_add(GTK_CONTAINER(b->save), button_box); | |
1698 | |
1699 /* End of OK Button */ | |
1700 | |
1701 /* Build Cancel Button */ | |
1702 | |
1703 b->cancel = gtk_button_new(); | |
1704 | |
1705 button_box = gtk_hbox_new(FALSE, 5); | |
1706 icon = gdk_pixmap_create_from_xpm_d ( b->window->window, &mask, NULL, cancel_xpm); | |
1707 icon_i = gtk_pixmap_new(icon, mask); | |
1708 | |
1709 label = gtk_label_new(_("Cancel")); | |
1710 | |
1711 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
1712 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
1713 | |
1714 gtk_widget_show(label); | |
1715 gtk_widget_show(icon_i); | |
1716 | |
1717 gtk_widget_show(button_box); | |
1718 | |
1719 gtk_container_add(GTK_CONTAINER(b->cancel), button_box); | |
1720 | |
1721 /* End of Cancel Button */ | |
1722 | |
483 | 1723 gtk_widget_set_usize(b->save, 75, 30); |
1724 gtk_widget_set_usize(b->cancel, 75, 30); | |
454 | 1725 |
1 | 1726 gtk_widget_show(b->save); |
1727 gtk_widget_show(b->cancel); | |
1728 | |
1729 gtk_box_pack_start(GTK_BOX(bot), b->save, FALSE, FALSE, 10); | |
1730 gtk_box_pack_start(GTK_BOX(bot), b->cancel, FALSE, FALSE, 10); | |
1731 | |
1732 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", | |
1733 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1734 gtk_signal_connect(GTK_OBJECT(b->cancel), "clicked", | |
1735 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1736 gtk_signal_connect(GTK_OBJECT(b->save), "clicked", | |
1737 GTK_SIGNAL_FUNC(do_save_info), b); | |
1738 | |
1739 gtk_widget_show(bot); | |
1740 | |
1741 | |
1742 b->text = gtk_text_new(NULL, NULL); | |
1743 gtk_text_set_word_wrap(GTK_TEXT(b->text), TRUE); | |
1744 gtk_text_set_editable(GTK_TEXT(b->text), TRUE); | |
1745 gtk_widget_set_usize(b->text, 350, 100); | |
1746 gtk_text_insert(GTK_TEXT(b->text), NULL, NULL, NULL, current_user->user_info, -1); | |
1747 | |
1748 gtk_widget_show(b->text); | |
1749 | |
1750 gtk_box_pack_start(GTK_BOX(top), b->text, TRUE, TRUE, 10); | |
1751 gtk_widget_show(top); | |
1752 | |
1753 gtk_box_pack_start(GTK_BOX(top), bot, FALSE, FALSE, 10); | |
454 | 1754 |
1 | 1755 gtk_container_add(GTK_CONTAINER(b->window), top); |
1756 gtk_container_border_width(GTK_CONTAINER(b->window), 10); | |
1757 gtk_widget_realize(b->window); | |
1758 aol_icon(b->window->window); | |
454 | 1759 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1760 gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Set User Info")); |
1 | 1761 gtk_widget_show(b->window); |
1762 | |
1763 } | |
1764 | |
1765 /*------------------------------------------------------------------------*/ | |
1766 /* The dialog for registration information */ | |
1767 /*------------------------------------------------------------------------*/ | |
1768 | |
1769 void do_register_dialog(GtkWidget *widget, struct registerdlg *b) | |
1770 { | |
1771 char *email = gtk_entry_get_text(GTK_ENTRY(b->email)); | |
1772 char *name = gtk_entry_get_text(GTK_ENTRY(b->name)); | |
1773 int uname = GTK_TOGGLE_BUTTON(b->uname)->active; | |
1774 int sname = GTK_TOGGLE_BUTTON(b->sname)->active; | |
1775 char *country = gtk_entry_get_text(GTK_ENTRY(b->country)); | |
1776 | |
1777 general_options |= OPT_GEN_REGISTERED; | |
1778 save_prefs(); | |
1779 | |
1780 destroy_dialog(NULL, b->window); | |
1781 | |
1782 g_free(b); | |
1783 | |
1784 g_sendemail(name, email, uname, sname, country); | |
1785 } | |
1786 | |
1787 void set_reg_flag(GtkWidget *widget, struct registerdlg *b) | |
1788 { | |
1789 general_options |= OPT_GEN_REGISTERED; | |
1790 save_prefs(); | |
1791 destroy_dialog(NULL, b->window); | |
1792 g_free(b); | |
1793 } | |
1794 | |
1795 void show_register_dialog() | |
1796 { | |
1797 GtkWidget *ok; | |
1798 GtkWidget *cancel; | |
1799 GtkWidget *label; | |
1800 GtkWidget *table; | |
1801 GtkWidget *vbox; | |
1802 GtkWidget *bbox; | |
1803 | |
1804 struct registerdlg *b = g_new0(struct registerdlg, 1); | |
1805 b->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
1806 dialogwindows = g_list_prepend(dialogwindows, b->window); | |
1807 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1808 cancel = gtk_button_new_with_label(_("Cancel")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1809 ok = gtk_button_new_with_label(_("Send")); |
1 | 1810 |
1811 bbox = gtk_hbox_new(TRUE, 10); | |
1812 table = gtk_table_new(6, 2, TRUE); | |
1813 vbox = gtk_vbox_new(FALSE, 5); | |
1814 | |
1815 b->name = gtk_entry_new(); | |
1816 b->email = gtk_entry_new(); | |
1817 b->uname = gtk_check_button_new_with_label("Send the output of uname -a with registration"); | |
1818 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->uname), TRUE); | |
1819 b->sname = gtk_check_button_new_with_label("Send my screenname with registration"); | |
1820 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sname), TRUE); | |
1821 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 10); | |
1822 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 10); | |
1823 | |
1824 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."); | |
1825 gtk_widget_show(label); | |
1826 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 2, 0, 1); | |
1827 | |
1828 label = gtk_label_new("Name"); | |
1829 gtk_widget_show(label); | |
1830 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
1831 gtk_table_attach_defaults(GTK_TABLE(table), b->name, 1, 2, 1, 2); | |
1832 | |
1833 label = gtk_label_new("Email"); | |
1834 gtk_widget_show(label); | |
1835 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3); | |
1836 gtk_table_attach_defaults(GTK_TABLE(table), b->email, 1, 2, 2, 3); | |
1837 | |
1838 label = gtk_label_new("Country"); | |
1839 b->country = gtk_entry_new(); | |
1840 gtk_widget_show(label); | |
1841 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4); | |
1842 gtk_table_attach_defaults(GTK_TABLE(table), b->country, 1, 2, 3, 4); | |
1843 | |
1844 gtk_table_attach_defaults(GTK_TABLE(table), b->sname, 0, 2, 4, 5); | |
1845 gtk_table_attach_defaults(GTK_TABLE(table), b->uname, 0, 2, 5, 6); | |
1846 | |
1847 gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 5); | |
1848 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); | |
1849 | |
1850 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", | |
1851 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1852 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
1853 GTK_SIGNAL_FUNC(set_reg_flag), b); | |
1854 gtk_signal_connect(GTK_OBJECT(ok), "clicked", | |
1855 GTK_SIGNAL_FUNC(do_register_dialog), b); | |
1856 | |
1857 gtk_widget_show(ok); | |
1858 gtk_widget_show(cancel); | |
1859 gtk_widget_show(b->name); | |
1860 gtk_widget_show(b->email); | |
1861 gtk_widget_show(b->uname); | |
1862 gtk_widget_show(b->sname); | |
1863 gtk_widget_show(b->country); | |
1864 gtk_widget_show(table); | |
1865 gtk_widget_show(bbox); | |
1866 gtk_widget_show(vbox); | |
1867 gtk_window_set_title(GTK_WINDOW(b->window), "Gaim - Registration"); | |
1868 gtk_window_set_focus(GTK_WINDOW(b->window), b->name); | |
1869 gtk_container_add(GTK_CONTAINER(b->window), vbox); | |
1870 gtk_container_border_width(GTK_CONTAINER(b->window), 10); | |
1871 gtk_widget_realize(b->window); | |
1872 aol_icon(b->window->window); | |
1873 | |
1874 gtk_widget_show(b->window); | |
1875 } | |
1876 | |
1877 | |
1878 /*------------------------------------------------------------------------*/ | |
1879 /* The dialog for the info requests */ | |
1880 /*------------------------------------------------------------------------*/ | |
1881 | |
247
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
1882 void g_show_info_text(char *info) |
1 | 1883 { |
1884 GtkWidget *ok; | |
1885 GtkWidget *label; | |
1886 GtkWidget *text; | |
1887 GtkWidget *bbox; | |
1888 GtkWidget *sw; | |
1889 | |
1890 struct info_dlg *b = g_new0(struct info_dlg, 1); | |
1891 | |
1892 b->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
1893 dialogwindows = g_list_prepend(dialogwindows, b->window); | |
1894 gtk_container_border_width(GTK_CONTAINER(b->window), 5); | |
1895 bbox = gtk_vbox_new(FALSE, 5); | |
1896 gtk_container_add(GTK_CONTAINER(b->window), bbox); | |
1897 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1898 ok = gtk_button_new_with_label(_("OK")); |
1 | 1899 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", |
1900 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1901 gtk_signal_connect(GTK_OBJECT(ok), "clicked", | |
1902 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
1903 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1904 label = gtk_label_new(_("Below are the results of your search: ")); |
1 | 1905 |
1906 sw = gtk_scrolled_window_new (NULL, NULL); | |
1907 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), | |
1908 GTK_POLICY_NEVER, | |
1909 GTK_POLICY_ALWAYS); | |
1910 text = gtk_html_new(NULL, NULL); | |
1911 b->text = text; | |
1912 gtk_container_add(GTK_CONTAINER(sw), text); | |
1913 | |
1914 GTK_HTML (text)->hadj->step_increment = 10.0; | |
1915 GTK_HTML (text)->vadj->step_increment = 10.0; | |
1916 gtk_widget_set_usize(sw, 300, 250); | |
1917 | |
1918 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); | |
1919 gtk_box_pack_start(GTK_BOX(bbox), sw, TRUE, TRUE, 0); | |
1920 gtk_box_pack_start(GTK_BOX(bbox), ok, FALSE, FALSE, 0); | |
1921 | |
1922 gtk_widget_realize(b->window); | |
1923 aol_icon(b->window->window); | |
1924 gtk_widget_show_all(b->window); | |
1925 | |
247
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
1926 gtk_html_append_text(GTK_HTML(b->text), info, 0); |
337 | 1927 |
247
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
1928 } |
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
1929 |
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
1930 void g_show_info(char *url) { |
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
1931 char *url_text = grab_url(url); |
f6e8ea29b24f
[gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
245
diff
changeset
|
1932 g_show_info_text(url_text); |
1 | 1933 g_free(url_text); |
1934 } | |
1935 | |
1936 /*------------------------------------------------------------------------*/ | |
1937 /* The dialog for adding to permit/deny */ | |
1938 /*------------------------------------------------------------------------*/ | |
1939 | |
1940 | |
1941 static void do_add_perm(GtkWidget *w, struct addperm *p) | |
1942 { | |
1943 | |
1944 char *who; | |
1945 char *name; | |
1946 int d = 0; | |
1947 GSList *buttons = p->buttons; | |
1948 | |
1949 | |
1950 who = gtk_entry_get_text(GTK_ENTRY(p->entry)); | |
1951 | |
1952 name = g_malloc(strlen(who) + 2); | |
1953 g_snprintf(name, strlen(who) + 2, "%s", who); | |
1954 | |
1955 while(buttons) { | |
1956 if((int)gtk_object_get_user_data(GTK_OBJECT(buttons->data)) == 1) { | |
1957 if (GTK_TOGGLE_BUTTON(buttons->data)->active) | |
1958 d = 1; | |
1959 } | |
1960 buttons = buttons->next; | |
1961 } | |
1962 | |
1963 if (d) { | |
1964 deny = g_list_append(deny, name); | |
1965 serv_add_deny(name); | |
1966 } else { | |
1967 permit = g_list_append(permit, name); | |
1968 serv_add_permit(name); | |
1969 } | |
1970 | |
1971 | |
1972 | |
1973 build_permit_tree(); | |
1974 | |
1975 serv_save_config(); | |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
1976 do_export(0, 0); |
1 | 1977 |
1978 destroy_dialog(NULL, p->window); | |
1979 } | |
1980 | |
1981 | |
1982 | |
1983 void show_add_perm(char *who) | |
1984 { | |
1985 GtkWidget *cancel; | |
1986 GtkWidget *add; | |
1987 GtkWidget *label; | |
1988 GtkWidget *bbox; | |
1989 GtkWidget *vbox; | |
1990 GtkWidget *rbox; | |
1991 GtkWidget *topbox; | |
1992 GtkWidget *which; | |
486 | 1993 GdkBitmap *mask; |
1994 GdkPixmap *icon; | |
1995 GtkWidget *icon_i; | |
1996 GtkWidget *button_box; | |
487 | 1997 GtkWidget *frame; |
1998 | |
486 | 1999 struct addperm *p = g_new0(struct addperm, 1); |
1 | 2000 |
2001 p->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
487 | 2002 gtk_container_set_border_width(GTK_CONTAINER(p->window), 5); |
2003 gtk_widget_set_usize(p->window, 310, 130); | |
2004 gtk_window_set_policy(GTK_WINDOW(p->window), FALSE, FALSE, TRUE); | |
486 | 2005 gtk_widget_show(p->window); |
487 | 2006 |
486 | 2007 dialogwindows = g_list_prepend(dialogwindows, p->window); |
2008 | |
2009 bbox = gtk_hbox_new(TRUE, 10); | |
1 | 2010 topbox = gtk_hbox_new(FALSE, 5); |
2011 vbox = gtk_vbox_new(FALSE, 5); | |
2012 rbox = gtk_vbox_new(FALSE, 5); | |
2013 p->entry = gtk_entry_new(); | |
2014 | |
487 | 2015 frame = gtk_frame_new(_("Permit / Deny")); |
2016 | |
486 | 2017 /* Build Add Button */ |
2018 | |
2019 add = gtk_button_new(); | |
2020 | |
2021 button_box = gtk_hbox_new(FALSE, 5); | |
2022 icon = gdk_pixmap_create_from_xpm_d ( p->window->window, &mask, NULL, add_xpm); | |
2023 icon_i = gtk_pixmap_new(icon, mask); | |
2024 | |
2025 label = gtk_label_new(_("Add")); | |
2026 | |
2027 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
2028 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
2029 | |
2030 gtk_widget_show(label); | |
2031 gtk_widget_show(icon_i); | |
2032 | |
2033 gtk_widget_show(button_box); | |
2034 | |
2035 gtk_container_add(GTK_CONTAINER(add), button_box); | |
2036 | |
2037 /* End of Add Button */ | |
2038 | |
2039 /* Build Cancel Button */ | |
2040 | |
2041 cancel = gtk_button_new(); | |
2042 | |
2043 button_box = gtk_hbox_new(FALSE, 5); | |
2044 icon = gdk_pixmap_create_from_xpm_d ( p->window->window, &mask, NULL, cancel_xpm); | |
2045 | |
2046 icon_i = gtk_pixmap_new(icon, mask); | |
2047 | |
2048 label = gtk_label_new(_("Cancel")); | |
2049 | |
2050 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
2051 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
2052 | |
2053 gtk_widget_show(label); | |
2054 gtk_widget_show(icon_i); | |
2055 | |
2056 gtk_widget_show(button_box); | |
2057 | |
2058 gtk_container_add(GTK_CONTAINER(cancel), button_box); | |
2059 | |
2060 /* End of Cancel Button */ | |
1 | 2061 if (who != NULL) |
2062 gtk_entry_set_text(GTK_ENTRY(p->entry), who); | |
2063 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2064 which = gtk_radio_button_new_with_label(NULL, _("Deny")); |
1 | 2065 gtk_box_pack_start(GTK_BOX(rbox), which, FALSE, FALSE, 0); |
2066 gtk_object_set_user_data(GTK_OBJECT(which), (int *)1); | |
2067 gtk_widget_show(which); | |
2068 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2069 which = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(which)), _("Permit")); |
1 | 2070 gtk_box_pack_start(GTK_BOX(rbox), which, FALSE, FALSE, 0); |
2071 gtk_object_set_user_data(GTK_OBJECT(which), (int *)2); | |
2072 gtk_widget_show(which); | |
2073 | |
2074 /* Put the buttons in the box */ | |
486 | 2075 |
2076 gtk_widget_set_usize(add, 75, 30); | |
2077 gtk_widget_set_usize(cancel, 75, 30); | |
2078 | |
2079 gtk_box_pack_start(GTK_BOX(bbox), add, FALSE, FALSE, 5); | |
2080 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 5); | |
1 | 2081 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2082 label = gtk_label_new(_("Add")); |
1 | 2083 gtk_widget_show(label); |
2084 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); | |
2085 gtk_box_pack_start(GTK_BOX(topbox), p->entry, FALSE, FALSE, 5); | |
2086 gtk_box_pack_start(GTK_BOX(topbox), rbox, FALSE, FALSE, 5); | |
2087 /* And the boxes in the box */ | |
2088 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); | |
2089 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); | |
487 | 2090 gtk_container_add(GTK_CONTAINER(frame), vbox); |
1 | 2091 |
2092 | |
2093 p->buttons = gtk_radio_button_group(GTK_RADIO_BUTTON(which)); | |
2094 /* Handle closes right */ | |
2095 gtk_signal_connect(GTK_OBJECT(p->window), "destroy", | |
2096 GTK_SIGNAL_FUNC(destroy_dialog), p->window); | |
2097 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
2098 GTK_SIGNAL_FUNC(destroy_dialog), p->window); | |
2099 gtk_signal_connect(GTK_OBJECT(add), "clicked", | |
2100 GTK_SIGNAL_FUNC(do_add_perm), p); | |
2101 gtk_signal_connect(GTK_OBJECT(p->entry), "activate", | |
2102 GTK_SIGNAL_FUNC(do_add_perm), p); | |
2103 | |
2104 /* Finish up */ | |
2105 gtk_widget_show(add); | |
2106 gtk_widget_show(cancel); | |
2107 gtk_widget_show(p->entry); | |
2108 gtk_widget_show(topbox); | |
2109 gtk_widget_show(bbox); | |
2110 gtk_widget_show(vbox); | |
2111 gtk_widget_show(rbox); | |
487 | 2112 gtk_widget_show(frame); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2113 gtk_window_set_title(GTK_WINDOW(p->window), _("Gaim - Add Permit/Deny")); |
1 | 2114 gtk_window_set_focus(GTK_WINDOW(p->window), p->entry); |
487 | 2115 gtk_container_add(GTK_CONTAINER(p->window), frame); |
1 | 2116 gtk_widget_realize(p->window); |
2117 aol_icon(p->window->window); | |
2118 | |
2119 gtk_widget_show(p->window); | |
2120 } | |
2121 | |
2122 | |
2123 /*------------------------------------------------------------------------*/ | |
2124 /* Function Called To Add A Log */ | |
2125 /*------------------------------------------------------------------------*/ | |
2126 | |
2127 void do_log(GtkWidget *w, char *name) | |
2128 { | |
2129 struct log_conversation *l; | |
2130 struct conversation *c; | |
2131 char buf[128]; | |
2132 | |
2133 c = find_conversation(name); | |
2134 if (!find_log_info(name)) { | |
2135 l = (struct log_conversation *)g_new0(struct log_conversation, 1); | |
2136 strcpy(l->name, name); | |
2137 strcpy(l->filename, gtk_file_selection_get_filename(GTK_FILE_SELECTION(logdialog))); | |
2138 log_conversations = g_list_append(log_conversations, l); | |
2139 | |
2140 if (c != NULL) | |
2141 { | |
2142 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, c->name); | |
2143 gtk_window_set_title(GTK_WINDOW(c->window), buf); | |
2144 } | |
2145 } | |
2146 | |
2147 save_prefs(); | |
2148 | |
2149 destroy_dialog(NULL, logdialog); | |
2150 logdialog = NULL; | |
2151 } | |
2152 | |
2153 static void cancel_log(GtkWidget *w, char *name) | |
2154 { | |
2155 | |
2156 struct conversation *c = gtk_object_get_user_data(GTK_OBJECT(logdialog)); | |
2157 | |
2158 if (c != NULL) | |
2159 { | |
2160 set_state_lock(1); | |
2161 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(c->log_button), FALSE); | |
2162 set_state_lock(0); | |
2163 } | |
2164 destroy_dialog(NULL, logdialog); | |
2165 } | |
2166 | |
2167 void show_log_dialog(char *bname) | |
2168 { | |
2169 char *buf = g_malloc(BUF_LEN); | |
2170 struct conversation *c = find_conversation(bname); | |
2171 | |
2172 | |
2173 if (!logdialog) { | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2174 logdialog = gtk_file_selection_new(_("Gaim - Log Conversation")); |
1 | 2175 |
2176 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(logdialog)); | |
2177 | |
2178 gtk_object_set_user_data(GTK_OBJECT(logdialog), c); | |
2179 | |
2180 g_snprintf(buf, BUF_LEN - 1, "%s/%s.log", getenv("HOME"), bname); | |
2181 | |
2182 gtk_file_selection_set_filename(GTK_FILE_SELECTION(logdialog), buf); | |
2183 gtk_signal_connect(GTK_OBJECT(logdialog), "delete_event", GTK_SIGNAL_FUNC(cancel_log), c); | |
2184 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(logdialog)->ok_button), "clicked", GTK_SIGNAL_FUNC(do_log), bname); | |
2185 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(logdialog)->cancel_button), "clicked", GTK_SIGNAL_FUNC(cancel_log), bname); | |
2186 } | |
2187 | |
25 | 2188 g_free(buf); |
2189 | |
1 | 2190 gtk_widget_show(logdialog); |
2191 gdk_window_raise(logdialog->window); | |
2192 } | |
2193 | |
2194 /*------------------------------------------------------*/ | |
2195 /* Find Buddy By Email */ | |
2196 /*------------------------------------------------------*/ | |
2197 | |
2198 void do_find_info(GtkWidget *w, struct findbyinfo *b) | |
2199 { | |
2200 char *first; | |
2201 char *middle; | |
2202 char *last; | |
2203 char *maiden; | |
2204 char *city; | |
2205 char *state; | |
2206 char *country; | |
2207 | |
2208 first = gtk_entry_get_text(GTK_ENTRY(b->firstentry)); | |
2209 middle = gtk_entry_get_text(GTK_ENTRY(b->middleentry)); | |
2210 last = gtk_entry_get_text(GTK_ENTRY(b->lastentry)); | |
2211 maiden = gtk_entry_get_text(GTK_ENTRY(b->maidenentry)); | |
2212 city = gtk_entry_get_text(GTK_ENTRY(b->cityentry)); | |
2213 state = gtk_entry_get_text(GTK_ENTRY(b->stateentry)); | |
2214 country = gtk_entry_get_text(GTK_ENTRY(b->countryentry)); | |
2215 | |
2216 serv_dir_search(first, middle, last, maiden, city, state, country, ""); | |
2217 destroy_dialog(NULL, b->window); | |
2218 } | |
2219 | |
2220 void do_find_email(GtkWidget *w, struct findbyemail *b) | |
2221 { | |
2222 char *email; | |
2223 | |
2224 email = gtk_entry_get_text(GTK_ENTRY(b->emailentry)); | |
2225 | |
2226 serv_dir_search("","","","","","","", email); | |
2227 | |
2228 destroy_dialog(NULL, b->window); | |
2229 } | |
2230 | |
2231 void show_find_info() | |
2232 { | |
2233 GtkWidget *cancel; | |
2234 GtkWidget *ok; | |
2235 GtkWidget *label; | |
2236 GtkWidget *bbox; | |
2237 GtkWidget *vbox; | |
479 | 2238 GtkWidget *hbox; |
2239 GtkWidget *icon_i; | |
2240 GdkBitmap *mask; | |
2241 GdkPixmap *icon; | |
2242 GtkWidget *button_box; | |
2243 GtkWidget *fbox; | |
2244 GtkWidget *frame; | |
1 | 2245 |
2246 struct findbyinfo *b = g_new0(struct findbyinfo, 1); | |
2247 b->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
480 | 2248 gtk_widget_set_usize(b->window, 350, 320); |
479 | 2249 gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, FALSE, TRUE); |
2250 gtk_widget_show(b->window); | |
2251 | |
2252 dialogwindows = g_list_prepend(dialogwindows, b->window); | |
2253 | |
2254 | |
2255 frame = gtk_frame_new(_("Search for Buddy")); | |
2256 fbox = gtk_vbox_new(FALSE, 5); | |
2257 | |
2258 /* Build OK Button */ | |
2259 | |
2260 ok = gtk_button_new(); | |
2261 | |
2262 button_box = gtk_hbox_new(FALSE, 5); | |
2263 icon = gdk_pixmap_create_from_xpm_d ( b->window->window, &mask, NULL, ok_xpm); | |
2264 icon_i = gtk_pixmap_new(icon, mask); | |
2265 | |
2266 label = gtk_label_new(_("OK")); | |
2267 | |
2268 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
2269 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
2270 | |
2271 gtk_widget_show(label); | |
2272 gtk_widget_show(icon_i); | |
2273 | |
2274 gtk_widget_show(button_box); | |
2275 | |
2276 gtk_container_add(GTK_CONTAINER(ok), button_box); | |
483 | 2277 gtk_widget_set_usize(ok, 75, 30); |
479 | 2278 |
2279 /* End of OK Button */ | |
2280 | |
2281 /* Build Cancel Button */ | |
2282 | |
2283 cancel = gtk_button_new(); | |
2284 | |
2285 button_box = gtk_hbox_new(FALSE, 5); | |
2286 icon = gdk_pixmap_create_from_xpm_d ( b->window->window, &mask, NULL, cancel_xpm); | |
2287 icon_i = gtk_pixmap_new(icon, mask); | |
2288 | |
2289 label = gtk_label_new(_("Cancel")); | |
2290 | |
2291 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
2292 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
2293 | |
2294 gtk_widget_show(label); | |
2295 gtk_widget_show(icon_i); | |
2296 | |
2297 gtk_widget_show(button_box); | |
2298 | |
2299 gtk_container_add(GTK_CONTAINER(cancel), button_box); | |
483 | 2300 gtk_widget_set_usize(cancel, 75, 30); |
479 | 2301 |
2302 /* End of Cancel Button */ | |
1 | 2303 |
2304 bbox = gtk_hbox_new(TRUE, 10); | |
479 | 2305 vbox = gtk_vbox_new(FALSE, 2); |
1 | 2306 |
2307 b->firstentry = gtk_entry_new(); | |
2308 b->middleentry = gtk_entry_new(); | |
2309 b->lastentry = gtk_entry_new(); | |
2310 b->maidenentry = gtk_entry_new(); | |
2311 b->cityentry = gtk_entry_new(); | |
2312 b->stateentry = gtk_entry_new(); | |
2313 b->countryentry = gtk_entry_new(); | |
2314 | |
483 | 2315 gtk_widget_set_usize(ok, 75, 30); |
2316 gtk_widget_set_usize(cancel, 75, 30); | |
2317 gtk_box_pack_end(GTK_BOX(bbox), ok, FALSE, FALSE, 10); | |
2318 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 10); | |
1 | 2319 |
479 | 2320 /* Line 1 */ |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2321 label = gtk_label_new(_("First Name")); |
1 | 2322 gtk_widget_show(label); |
479 | 2323 |
2324 hbox = gtk_hbox_new(FALSE, 2); | |
2325 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
2326 gtk_box_pack_end(GTK_BOX(hbox), b->firstentry, FALSE, FALSE, 5); | |
2327 | |
2328 gtk_widget_show(hbox); | |
2329 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
2330 | |
2331 /* Line 2 */ | |
1 | 2332 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2333 label = gtk_label_new(_("Middle Name")); |
1 | 2334 gtk_widget_show(label); |
479 | 2335 |
2336 hbox = gtk_hbox_new(FALSE, 2); | |
2337 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
2338 gtk_box_pack_end(GTK_BOX(hbox), b->middleentry, FALSE, FALSE, 5); | |
2339 | |
2340 gtk_widget_show(hbox); | |
2341 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
2342 | |
2343 /* Line 3 */ | |
2344 | |
2345 label = gtk_label_new(_("Last Name")); | |
1 | 2346 gtk_widget_show(label); |
479 | 2347 |
2348 hbox = gtk_hbox_new(FALSE, 2); | |
2349 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
2350 gtk_box_pack_end(GTK_BOX(hbox), b->lastentry, FALSE, FALSE, 5); | |
2351 | |
2352 gtk_widget_show(hbox); | |
2353 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
2354 | |
2355 /* Line 4 */ | |
2356 | |
2357 label = gtk_label_new(_("Maiden Name")); | |
1 | 2358 gtk_widget_show(label); |
479 | 2359 |
2360 hbox = gtk_hbox_new(FALSE, 2); | |
2361 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
2362 gtk_box_pack_end(GTK_BOX(hbox), b->maidenentry, FALSE, FALSE, 5); | |
2363 | |
2364 gtk_widget_show(hbox); | |
2365 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
2366 | |
2367 /* Line 5 */ | |
2368 | |
2369 label = gtk_label_new(_("City")); | |
1 | 2370 gtk_widget_show(label); |
479 | 2371 |
2372 hbox = gtk_hbox_new(FALSE, 2); | |
2373 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
2374 gtk_box_pack_end(GTK_BOX(hbox), b->cityentry, FALSE, FALSE, 5); | |
2375 | |
2376 gtk_widget_show(hbox); | |
2377 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
2378 | |
2379 /* Line 6 */ | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2380 label = gtk_label_new(_("State")); |
1 | 2381 gtk_widget_show(label); |
479 | 2382 |
2383 hbox = gtk_hbox_new(FALSE, 2); | |
2384 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
2385 gtk_box_pack_end(GTK_BOX(hbox), b->stateentry, FALSE, FALSE, 5); | |
2386 | |
2387 gtk_widget_show(hbox); | |
2388 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
2389 | |
2390 /* Line 7 */ | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2391 label = gtk_label_new(_("Country")); |
1 | 2392 gtk_widget_show(label); |
479 | 2393 |
2394 hbox = gtk_hbox_new(FALSE, 2); | |
2395 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
2396 gtk_box_pack_end(GTK_BOX(hbox), b->countryentry, FALSE, FALSE, 5); | |
2397 | |
2398 gtk_widget_show(hbox); | |
2399 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
2400 | |
2401 /* Merge The Boxes */ | |
2402 | |
2403 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
2404 gtk_box_pack_start(GTK_BOX(fbox), frame, FALSE, FALSE, 5); | |
2405 gtk_box_pack_start(GTK_BOX(fbox), bbox, FALSE, FALSE, 5); | |
1 | 2406 |
2407 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", | |
2408 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
2409 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
2410 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
2411 gtk_signal_connect(GTK_OBJECT(ok), "clicked", | |
2412 GTK_SIGNAL_FUNC(do_find_info), b); | |
2413 | |
2414 gtk_widget_show(ok); | |
2415 gtk_widget_show(cancel); | |
2416 gtk_widget_show(b->firstentry); | |
2417 gtk_widget_show(b->middleentry); | |
2418 gtk_widget_show(b->lastentry); | |
2419 gtk_widget_show(b->maidenentry); | |
2420 gtk_widget_show(b->cityentry); | |
2421 gtk_widget_show(b->stateentry); | |
2422 gtk_widget_show(b->countryentry); | |
2423 gtk_widget_show(bbox); | |
2424 gtk_widget_show(vbox); | |
479 | 2425 gtk_widget_show(frame); |
2426 gtk_widget_show(fbox); | |
2427 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2428 gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Find Buddy By Info")); |
1 | 2429 gtk_window_set_focus(GTK_WINDOW(b->window), b->firstentry); |
479 | 2430 gtk_container_add(GTK_CONTAINER(b->window), fbox); |
2431 gtk_container_border_width(GTK_CONTAINER(b->window), 5); | |
1 | 2432 gtk_widget_realize(b->window); |
2433 aol_icon(b->window->window); | |
2434 | |
2435 gtk_widget_show(b->window); | |
2436 } | |
2437 | |
2438 void show_find_email() | |
2439 { | |
2440 GtkWidget *label; | |
2441 GtkWidget *bbox; | |
2442 GtkWidget *vbox; | |
2443 GtkWidget *topbox; | |
444 | 2444 GtkWidget *frame; |
2445 GtkWidget *icon_i; | |
2446 GdkPixmap *icon; | |
2447 GdkBitmap *mask; | |
2448 GtkWidget *button_box; | |
2449 GtkWidget *button; | |
1 | 2450 |
2451 struct findbyemail *b = g_new0(struct findbyemail, 1); | |
2452 b->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
477 | 2453 gtk_widget_set_usize(b->window, 240, 110); |
478 | 2454 gtk_window_set_policy(GTK_WINDOW(b->window), FALSE, FALSE, TRUE); |
444 | 2455 gtk_widget_show(b->window); |
1 | 2456 dialogwindows = g_list_prepend(dialogwindows, b->window); |
2457 | |
444 | 2458 frame = gtk_frame_new(_("Search for Buddy")); |
2459 | |
2460 bbox = gtk_hbox_new(TRUE, 10); | |
1 | 2461 topbox = gtk_hbox_new(FALSE, 5); |
2462 vbox = gtk_vbox_new(FALSE, 5); | |
2463 | |
2464 b->emailentry = gtk_entry_new(); | |
2465 | |
444 | 2466 /* Build OK Button */ |
2467 | |
2468 button = gtk_button_new(); | |
2469 | |
2470 button_box = gtk_hbox_new(FALSE, 5); | |
2471 icon = gdk_pixmap_create_from_xpm_d ( b->window->window, &mask, NULL, ok_xpm); | |
2472 icon_i = gtk_pixmap_new(icon, mask); | |
2473 | |
2474 label = gtk_label_new(_("OK")); | |
2475 | |
2476 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
2477 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
2478 | |
2479 gtk_widget_show(label); | |
2480 gtk_widget_show(icon_i); | |
2481 | |
2482 gtk_widget_show(button_box); | |
2483 | |
2484 gtk_container_add(GTK_CONTAINER(button), button_box); | |
2485 | |
2486 gtk_signal_connect(GTK_OBJECT(button), "clicked", | |
2487 GTK_SIGNAL_FUNC(do_find_email), b); | |
2488 | |
2489 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 5); | |
2490 | |
483 | 2491 gtk_widget_set_usize(button, 75, 30); |
444 | 2492 gtk_widget_show(button); |
2493 | |
2494 /* End of OK Button */ | |
2495 | |
2496 /* Build Cancel Button */ | |
2497 | |
2498 button = gtk_button_new(); | |
2499 | |
2500 button_box = gtk_hbox_new(FALSE, 5); | |
2501 icon = gdk_pixmap_create_from_xpm_d ( b->window->window, &mask, NULL, cancel_xpm); | |
2502 icon_i = gtk_pixmap_new(icon, mask); | |
2503 | |
2504 label = gtk_label_new(_("Cancel")); | |
2505 | |
2506 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
2507 gtk_box_pack_end(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
2508 | |
2509 gtk_widget_show(label); | |
2510 gtk_widget_show(icon_i); | |
2511 | |
2512 gtk_widget_show(button_box); | |
2513 | |
2514 gtk_container_add(GTK_CONTAINER(button), button_box); | |
2515 | |
2516 gtk_signal_connect(GTK_OBJECT(button), "clicked", | |
2517 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
2518 | |
2519 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 5); | |
2520 | |
483 | 2521 gtk_widget_set_usize(button, 75, 30); |
444 | 2522 gtk_widget_show(button); |
2523 | |
2524 /* End of Cancel Button */ | |
1 | 2525 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2526 label = gtk_label_new(_("Email")); |
1 | 2527 gtk_widget_show(label); |
2528 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); | |
2529 gtk_box_pack_start(GTK_BOX(topbox), b->emailentry, FALSE, FALSE, 5); | |
2530 | |
2531 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); | |
2532 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); | |
2533 | |
2534 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", | |
2535 GTK_SIGNAL_FUNC(destroy_dialog), b->window); | |
2536 gtk_signal_connect(GTK_OBJECT(b->emailentry), "activate", | |
2537 GTK_SIGNAL_FUNC(do_find_email), b); | |
2538 | |
444 | 2539 gtk_container_add(GTK_CONTAINER(frame), vbox); |
1 | 2540 gtk_widget_show(b->emailentry); |
444 | 2541 gtk_widget_show(frame); |
2542 gtk_widget_show(topbox); | |
1 | 2543 gtk_widget_show(bbox); |
2544 gtk_widget_show(vbox); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2545 gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Find Buddy By Email")); |
1 | 2546 gtk_window_set_focus(GTK_WINDOW(b->window), b->emailentry); |
444 | 2547 gtk_container_add(GTK_CONTAINER(b->window), frame); |
1 | 2548 gtk_container_border_width(GTK_CONTAINER(b->window), 10); |
2549 gtk_widget_realize(b->window); | |
2550 aol_icon(b->window->window); | |
2551 | |
2552 gtk_widget_show(b->window); | |
2553 } | |
2554 | |
2555 /*------------------------------------------------------*/ | |
2556 /* Link Dialog */ | |
2557 /*------------------------------------------------------*/ | |
2558 | |
2559 void cancel_link(GtkWidget *widget, struct linkdlg *b) | |
2560 { | |
62 | 2561 if (b->toggle) { |
2562 set_state_lock(1); | |
1 | 2563 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->toggle), FALSE); |
62 | 2564 set_state_lock(0); |
2565 } | |
1 | 2566 destroy_dialog(NULL, b->window); |
2567 } | |
2568 | |
2569 void do_add_link(GtkWidget *widget, struct linkdlg *b) | |
2570 { | |
2571 char *open_tag; | |
2572 char *urltext, *showtext; | |
2573 open_tag = g_malloc(2048); | |
2574 | |
2575 | |
2576 urltext = gtk_entry_get_text(GTK_ENTRY(b->url)); | |
2577 showtext = gtk_entry_get_text(GTK_ENTRY(b->text)); | |
2578 | |
2579 g_snprintf(open_tag, 2048, "<A HREF=\"%s\">%s", urltext, showtext); | |
2580 surround(b->entry, open_tag, "</A>"); | |
2581 | |
2582 g_free(open_tag); | |
2583 destroy_dialog(NULL, b->window); | |
2584 } | |
2585 | |
2586 | |
2587 void show_add_link(GtkWidget *entry, GtkWidget *link) | |
2588 { | |
2589 GtkWidget *vbox; | |
2590 GtkWidget *bbox; | |
2591 GtkWidget *table; | |
2592 GtkWidget *label; | |
2593 | |
2594 if (!linkdialog) { | |
2595 struct linkdlg *b = g_new0(struct linkdlg, 1); | |
2596 linkdialog = gtk_window_new(GTK_WINDOW_DIALOG); | |
2597 dialogwindows = g_list_prepend(dialogwindows, linkdialog); | |
2598 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2599 b->cancel = gtk_button_new_with_label(_("Cancel")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2600 b->ok = gtk_button_new_with_label(_("Ok")); |
1 | 2601 |
2602 vbox = gtk_vbox_new(FALSE, 10); | |
2603 bbox = gtk_hbox_new(TRUE, 10); | |
2604 | |
2605 gtk_widget_show(b->ok); | |
2606 gtk_widget_show(b->cancel); | |
2607 | |
2608 gtk_box_pack_start(GTK_BOX(bbox), b->ok, FALSE, FALSE, 10); | |
2609 gtk_box_pack_start(GTK_BOX(bbox), b->cancel, FALSE, FALSE, 10); | |
2610 gtk_widget_show(bbox); | |
2611 | |
2612 table = gtk_table_new(2, 2, FALSE); | |
2613 b->url = gtk_entry_new(); | |
2614 b->text = gtk_entry_new(); | |
2615 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2616 label = gtk_label_new(_("URL")); |
1 | 2617 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); |
2618 gtk_table_attach_defaults(GTK_TABLE(table), b->url, 1, 2, 0, 1); | |
2619 gtk_widget_show(label); | |
2620 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2621 label = gtk_label_new(_("Description")); |
1 | 2622 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); |
2623 gtk_table_attach_defaults(GTK_TABLE(table), b->text, 1, 2, 1, 2); | |
2624 gtk_widget_show(label); | |
2625 | |
2626 gtk_widget_show(b->url); | |
2627 gtk_widget_show(b->text); | |
2628 gtk_widget_show(table); | |
2629 | |
2630 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 10); | |
2631 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 10); | |
2632 gtk_widget_show(vbox); | |
2633 | |
2634 gtk_signal_connect(GTK_OBJECT(linkdialog), "destroy", | |
2635 GTK_SIGNAL_FUNC(cancel_link), b); | |
2636 gtk_signal_connect(GTK_OBJECT(b->cancel), "clicked", | |
2637 GTK_SIGNAL_FUNC(cancel_link), b); | |
2638 gtk_signal_connect(GTK_OBJECT(b->ok), "clicked", | |
2639 GTK_SIGNAL_FUNC(do_add_link), b); | |
2640 | |
2641 gtk_container_add(GTK_CONTAINER(linkdialog ), vbox); | |
2642 gtk_container_border_width(GTK_CONTAINER(linkdialog ), 10); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2643 gtk_window_set_title(GTK_WINDOW(linkdialog ), _("GAIM - Add URL")); |
1 | 2644 gtk_window_set_focus(GTK_WINDOW(linkdialog ), b->url); |
2645 b->window = linkdialog; | |
2646 b->toggle = link; | |
2647 b->entry = entry; | |
2648 gtk_widget_realize(linkdialog); | |
2649 aol_icon(linkdialog->window); | |
2650 | |
2651 } | |
2652 | |
2653 gtk_widget_show(linkdialog); | |
2654 gdk_window_raise(linkdialog->window); | |
2655 } | |
2656 | |
2657 | |
2658 /*------------------------------------------------------*/ | |
2659 /* Color Selection Dialog */ | |
2660 /*------------------------------------------------------*/ | |
2661 | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2662 void cancel_color(GtkWidget *widget, struct conversation *c) |
1 | 2663 { |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2664 if (c->palette && widget) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2665 { |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2666 set_state_lock(1); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2667 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(c->palette), FALSE); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2668 set_state_lock(0); |
61 | 2669 } |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2670 dialogwindows = g_list_remove(dialogwindows, c->color_dialog); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2671 gtk_widget_destroy(c->color_dialog); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2672 c->color_dialog = NULL; |
1 | 2673 } |
2674 | |
2675 void do_color(GtkWidget *widget, GtkColorSelection *colorsel) | |
2676 { | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2677 gdouble color[3]; |
1 | 2678 GdkColor text_color; |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2679 struct conversation *c; |
1 | 2680 char *open_tag; |
2681 | |
2682 open_tag = g_malloc(30); | |
2683 | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2684 gtk_color_selection_get_color (colorsel, color); |
1 | 2685 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2686 c = gtk_object_get_user_data(GTK_OBJECT(colorsel)); |
411
a330017b3aa4
[gaim-migrate @ 421]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
401
diff
changeset
|
2687 /* GTK_IS_EDITABLE(c->entry); huh? */ |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2688 |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2689 text_color.red = ((guint16)(color[0]*65535))>>8; |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2690 text_color.green = ((guint16)(color[1]*65535))>>8; |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2691 text_color.blue = ((guint16)(color[2]*65535))>>8; |
1 | 2692 |
2693 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
|
2694 surround(c->entry, open_tag, "</FONT>"); |
1 | 2695 sprintf(debug_buff,"#%02X%02X%02X\n", text_color.red, text_color.green, text_color.blue); |
2696 debug_print(debug_buff); | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2697 g_free(open_tag); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2698 cancel_color(NULL, c); |
1 | 2699 } |
2700 | |
2701 | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2702 void show_color_dialog(struct conversation *c, GtkWidget *color) |
1 | 2703 { |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2704 GtkWidget *colorsel; |
1 | 2705 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2706 if (!c->color_dialog) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2707 { |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2708 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
|
2709 colorsel = GTK_COLOR_SELECTION_DIALOG(c->color_dialog)->colorsel; |
1 | 2710 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2711 gtk_object_set_user_data(GTK_OBJECT(colorsel), c); |
1 | 2712 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2713 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
|
2714 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
|
2715 gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(c->color_dialog)->cancel_button), "clicked", GTK_SIGNAL_FUNC(cancel_color), c); |
1 | 2716 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2717 gtk_widget_realize(c->color_dialog); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2718 aol_icon(c->color_dialog->window); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2719 } |
1 | 2720 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2721 gtk_widget_show(c->color_dialog); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2722 gdk_window_raise(c->color_dialog->window); |
1 | 2723 } |
2724 | |
2725 /*------------------------------------------------------------------------*/ | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2726 /* Font Selection Dialog */ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2727 /*------------------------------------------------------------------------*/ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2728 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2729 void cancel_font(GtkWidget *widget, struct conversation *c) |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2730 { |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2731 if (c->font && widget) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2732 { |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2733 set_state_lock(1); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2734 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(c->font), FALSE); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2735 set_state_lock(0); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2736 } |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2737 dialogwindows = g_list_remove(dialogwindows, c->font_dialog); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2738 gtk_widget_destroy(c->font_dialog); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2739 c->font_dialog = NULL; |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2740 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2741 |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2742 void apply_font(GtkWidget *widget, GtkFontSelection *fontsel) |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2743 { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2744 /* this could be expanded to include font size, weight, etc. |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2745 but for now only works with font face */ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2746 int i, j = 0, k = 0; |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2747 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
|
2748 |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2749 if (c) |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2750 { |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2751 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
|
2752 strncpy(c->current_fontname, tmp, sizeof(c->current_fontname)); |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2753 |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2754 for (i = 0; i < strlen(c->current_fontname); i++) |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2755 { |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2756 if (c->current_fontname[i] == '-') |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2757 { |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2758 if (++j > 2) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2759 break; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2760 } |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2761 else if (j == 2) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2762 c->current_fontface[k++] = c->current_fontname[i]; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2763 } |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2764 c->current_fontface[k] = '\0'; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2765 |
488
0fcb7e7a263c
[gaim-migrate @ 498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
487
diff
changeset
|
2766 sprintf(debug_buff, "Setting font face %s\n", c->current_fontface); |
0fcb7e7a263c
[gaim-migrate @ 498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
487
diff
changeset
|
2767 debug_print(debug_buff); |
0fcb7e7a263c
[gaim-migrate @ 498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
487
diff
changeset
|
2768 |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2769 set_font_face(NULL, c); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2770 } |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2771 else |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2772 { |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2773 if (fontface) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2774 g_free(fontface); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2775 |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2776 fontface = g_malloc(64); |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2777 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
|
2778 |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2779 for (i = 0; i < strlen(fontname); i++) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2780 { |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2781 if (fontname[i] == '-') |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2782 { |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2783 if (++j > 2) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2784 break; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2785 } |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2786 else if (j == 2) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2787 fontface[k++] = fontname[i]; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2788 } |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2789 fontface[k] = '\0'; |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2790 |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2791 save_prefs(); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2792 } |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2793 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2794 cancel_font(NULL, c); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2795 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2796 |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2797 static GtkWidget *fontseld; |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2798 |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2799 void destroy_fontsel(GtkWidget *w, gpointer d) { |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2800 gtk_widget_destroy(fontseld); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2801 fontseld = NULL; |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2802 } |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2803 |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2804 void apply_font_dlg(GtkWidget *w, GtkWidget *f) { |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2805 int i, j = 0, k = 0; |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2806 if (fontface) |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2807 g_free(fontface); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2808 |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2809 fontface = g_malloc(64); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2810 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
|
2811 destroy_fontsel(0, 0); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2812 for (i = 0; i < strlen(fontname); i++) { |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2813 if (fontname[i] == '-') { |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2814 if (++j > 2) break; |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2815 } else if (j == 2) |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2816 fontface[k++] = fontname[i]; |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2817 } |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2818 fontface[k] = '\0'; |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2819 save_prefs(); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2820 } |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2821 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2822 void show_font_dialog(struct conversation *c, GtkWidget *font) |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2823 { |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2824 |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2825 if (!font) { /* we came from the prefs dialog */ |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2826 if (fontseld) return; |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2827 fontseld = gtk_font_selection_dialog_new(_("Select Font")); |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2828 if (fontname) |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2829 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
|
2830 else |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2831 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
|
2832 |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2833 gtk_object_set_user_data(GTK_OBJECT(fontseld), NULL); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2834 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
|
2835 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
|
2836 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
|
2837 gtk_widget_realize(fontseld); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2838 aol_icon(fontseld->window); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2839 gtk_widget_show(fontseld); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2840 gdk_window_raise(fontseld->window); |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2841 return; |
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2842 } |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2843 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2844 if (!c->font_dialog) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2845 { |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2846 c->font_dialog = gtk_font_selection_dialog_new(_("Select Font")); |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
231
diff
changeset
|
2847 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2848 if (font) |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2849 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
|
2850 else |
334
0fa651368776
[gaim-migrate @ 344]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
2851 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
|
2852 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2853 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
|
2854 |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2855 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
|
2856 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
|
2857 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
|
2858 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2859 if (fontname) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2860 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
|
2861 else |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2862 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
|
2863 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2864 gtk_widget_realize(c->font_dialog); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2865 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2866 aol_icon(c->font_dialog->window); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2867 } |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2868 gtk_widget_show(c->font_dialog); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
2869 gdk_window_raise(c->font_dialog->window); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2870 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2871 |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
229
diff
changeset
|
2872 /*------------------------------------------------------------------------*/ |
1 | 2873 /* The dialog for import/export */ |
2874 /*------------------------------------------------------------------------*/ | |
2875 | |
228 | 2876 #define PATHSIZE 1024 |
2877 | |
229 | 2878 /* see if a buddy list cache file for this user exists */ |
2879 | |
2880 gboolean | |
2881 bud_list_cache_exists( void ) | |
2882 { | |
2883 gboolean ret = FALSE; | |
2884 char path[PATHSIZE]; | |
2885 char *file; | |
2886 struct stat sbuf; | |
2887 extern char g_screenname[]; | |
2888 | |
2889 file = getenv( "HOME" ); | |
2890 if ( file != (char *) NULL ) { | |
262
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2891 sprintf( path, "%s/.gaim/%s.blist", file, g_screenname ); |
229 | 2892 if ( !stat(path, &sbuf) ) |
2893 ret = TRUE; | |
2894 } | |
2895 return ret; | |
2896 } | |
2897 | |
262
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2898 /* if dummy is 0, save to ~/.gaim/screenname.blist. Else, let user choose */ |
228 | 2899 |
1 | 2900 void do_export(GtkWidget *w, void *dummy) |
2901 { | |
2902 FILE *f; | |
228 | 2903 gint show_dialog = (int) dummy; |
1 | 2904 char *buf = g_malloc(BUF_LONG); |
228 | 2905 char *file; |
2906 char path[PATHSIZE]; | |
2907 extern char g_screenname[]; | |
1 | 2908 |
228 | 2909 if ( show_dialog == 1 ) { |
2910 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(exportdialog)); | |
2911 strncpy( path, file, PATHSIZE - 1 ); | |
2912 } | |
2913 else { | |
2914 file = getenv( "HOME" ); | |
262
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2915 if ( file != (char *) NULL ) { |
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2916 FILE *dir; |
266
3b5b469d07f7
[gaim-migrate @ 276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
262
diff
changeset
|
2917 sprintf(buf, "%s/.gaim/", file); |
262
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2918 dir = fopen(buf, "r"); |
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2919 if (!dir) |
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2920 mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR); |
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2921 else |
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2922 fclose(dir); |
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2923 sprintf( path, "%s/.gaim/%s.blist", file, g_screenname ); |
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2924 } else |
228 | 2925 return; |
2926 } | |
2927 if ((f = fopen(path,"w"))) { | |
237
6ced2f1c8b24
[gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
236
diff
changeset
|
2928 serv_build_config(buf, 8192 - 1); |
1 | 2929 fprintf(f, "%s\n", buf); |
2930 fclose(f); | |
2931 chmod(buf, S_IRUSR | S_IWUSR); | |
228 | 2932 } else if ( show_dialog == 1 ) { |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2933 g_snprintf(buf, BUF_LONG / 2, _("Error writing file %s"), file); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2934 do_error_dialog(buf, _("Error")); |
1 | 2935 } |
228 | 2936 if ( show_dialog == 1 ) { |
2937 destroy_dialog(NULL, exportdialog); | |
2938 exportdialog = NULL; | |
2939 } | |
1 | 2940 |
2941 g_free(buf); | |
2942 | |
2943 } | |
2944 | |
2945 | |
2946 void show_export_dialog() | |
2947 { | |
2948 char *buf = g_malloc(BUF_LEN); | |
2949 if (!exportdialog) { | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2950 exportdialog = gtk_file_selection_new(_("Gaim - Export Buddy List")); |
1 | 2951 |
2952 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(exportdialog)); | |
2953 | |
2954 g_snprintf(buf, BUF_LEN - 1, "%s/gaim.buddy", getenv("HOME")); | |
2955 | |
2956 gtk_file_selection_set_filename(GTK_FILE_SELECTION(exportdialog), buf); | |
2957 gtk_signal_connect(GTK_OBJECT(exportdialog), "destroy", | |
2958 GTK_SIGNAL_FUNC(destroy_dialog), exportdialog); | |
2959 | |
2960 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
|
2961 "clicked", GTK_SIGNAL_FUNC(do_export), (void*)1); |
1 | 2962 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(exportdialog)->cancel_button), |
2963 "clicked", GTK_SIGNAL_FUNC(destroy_dialog), exportdialog); | |
2964 | |
2965 | |
2966 } | |
2967 | |
2968 g_free(buf); | |
2969 | |
2970 gtk_widget_show(exportdialog); | |
2971 gdk_window_raise(exportdialog->window); | |
2972 | |
2973 } | |
2974 | |
262
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2975 /* if dummy is 0, then import from ~/.gaim/screenname.blist, else let user |
229 | 2976 choose */ |
228 | 2977 |
1 | 2978 void do_import(GtkWidget *w, void *dummy) |
2979 { | |
228 | 2980 gint show_dialog = (int) dummy; |
1 | 2981 GList *grp, *grp2; |
2982 char *buf = g_malloc(BUF_LONG); | |
2983 char *buf2; | |
2984 char *first = g_malloc(64); | |
228 | 2985 char *file; |
2986 char path[PATHSIZE]; | |
1 | 2987 FILE *f; |
228 | 2988 extern char g_screenname[]; |
2989 | |
2990 if ( show_dialog == 1 ) { | |
2991 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(importdialog)); | |
2992 strncpy( path, file, PATHSIZE - 1 ); | |
2993 } | |
2994 else { | |
2995 file = getenv( "HOME" ); | |
2996 if ( file != (char *) NULL ) | |
262
07abf2ed6665
[gaim-migrate @ 272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
255
diff
changeset
|
2997 sprintf( path, "%s/.gaim/%s.blist", file, g_screenname ); |
228 | 2998 else |
2999 return; | |
3000 } | |
3001 | |
3002 if (!(f = fopen(path,"r"))) { | |
3003 if ( show_dialog == 1 ) { | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
3004 g_snprintf(buf, BUF_LONG / 2, _("Error reading file %s"), file); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
3005 do_error_dialog(buf, _("Error")); |
228 | 3006 destroy_dialog(NULL, importdialog); |
3007 importdialog = NULL; | |
3008 } | |
1 | 3009 g_free(buf); |
37 | 3010 g_free(first); |
1 | 3011 return; |
3012 } | |
3013 | |
3014 fgets(first, 64, f); | |
3015 | |
3016 if (!strcasecmp(first, "Config {\n")) { | |
228 | 3017 if ( show_dialog == 1 ) { |
3018 destroy_dialog(NULL, importdialog); | |
3019 importdialog = NULL; | |
3020 } | |
25 | 3021 g_free(buf); |
37 | 3022 g_free(first); |
228 | 3023 fclose( f ); |
1 | 3024 return; |
3025 } else if (buf[0] == 'm') { | |
3026 buf2 = buf; | |
231 | 3027 buf = g_malloc(8193); |
3028 g_snprintf(buf, 8192, "toc_set_config {%s}\n", buf2); | |
1 | 3029 g_free(buf2); |
3030 } | |
3031 | |
3032 | |
3033 fseek(f, 0, SEEK_SET); | |
3034 | |
3035 fread(buf, BUF_LONG, 1, f); | |
3036 | |
3037 grp = groups; | |
3038 | |
3039 while(grp) { | |
3040 grp2 = grp->next; | |
3041 remove_group((struct group *)grp->data); | |
3042 grp = grp2; | |
3043 } | |
3044 | |
296
a88b889b692b
[gaim-migrate @ 306]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
266
diff
changeset
|
3045 parse_toc_buddy_list(buf, 1); |
1 | 3046 |
3047 serv_save_config(); | |
3048 | |
3049 build_edit_tree(); | |
3050 build_permit_tree(); | |
3051 | |
228 | 3052 fclose( f ); |
3053 | |
3054 if ( show_dialog == 1 ) { | |
3055 /* save what we just did to cache */ | |
3056 | |
3057 do_export( (GtkWidget *) NULL, 0 ); | |
3058 destroy_dialog(NULL, importdialog); | |
3059 importdialog = NULL; | |
3060 } | |
1 | 3061 |
3062 g_free(buf); | |
37 | 3063 g_free(first); |
1 | 3064 } |
3065 | |
3066 void show_import_dialog() | |
3067 { | |
3068 char *buf = g_malloc(BUF_LEN); | |
3069 if (!importdialog) { | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
3070 importdialog = gtk_file_selection_new(_("Gaim - Import Buddy List")); |
1 | 3071 |
3072 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(importdialog)); | |
3073 | |
3074 g_snprintf(buf, BUF_LEN - 1, "%s/", getenv("HOME")); | |
3075 | |
3076 gtk_file_selection_set_filename(GTK_FILE_SELECTION(importdialog), buf); | |
3077 gtk_signal_connect(GTK_OBJECT(importdialog), "destroy", | |
3078 GTK_SIGNAL_FUNC(destroy_dialog), importdialog); | |
3079 | |
3080 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
|
3081 "clicked", GTK_SIGNAL_FUNC(do_import), (void*)1); |
1 | 3082 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(importdialog)->cancel_button), |
3083 "clicked", GTK_SIGNAL_FUNC(destroy_dialog), importdialog); | |
3084 | |
3085 | |
3086 } | |
3087 | |
24 | 3088 g_free(buf); |
1 | 3089 gtk_widget_show(importdialog); |
3090 gdk_window_raise(importdialog->window); | |
3091 } | |
3092 | |
3093 | |
3094 /*------------------------------------------------------------------------*/ | |
3095 /* The dialog for new away messages */ | |
3096 /*------------------------------------------------------------------------*/ | |
3097 | |
3098 void create_mess(GtkWidget *widget, struct create_away *ca) | |
3099 { | |
3100 struct away_message *b; | |
3101 gchar *away_message; | |
3102 guint text_len; | |
3103 int is_checked; | |
3104 | |
3105 /* Grab the appropriate data */ | |
3106 b = g_new0(struct away_message, 1); | |
3107 g_snprintf(b->name, sizeof(b->name), "%s", gtk_entry_get_text(GTK_ENTRY(ca->entry))); | |
3108 | |
3109 /* Get proper Length */ | |
3110 text_len = gtk_text_get_length(GTK_TEXT(ca->text)); | |
3111 away_message = gtk_editable_get_chars(GTK_EDITABLE(ca->text), 0, text_len); | |
3112 | |
3113 g_snprintf(b->message, sizeof(b->message), "%s", away_message); | |
38 | 3114 g_free(away_message); |
1 | 3115 is_checked = GTK_TOGGLE_BUTTON(ca->checkbx)->active; |
3116 | |
452
0a2eb65b6909
[gaim-migrate @ 462]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
444
diff
changeset
|
3117 if (is_checked) { |
1 | 3118 away_messages = g_list_append(away_messages, b); |
3119 save_prefs(); | |
3120 do_away_menu(); | |
3121 if (pd != NULL) | |
3122 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
|
3123 } |
0a2eb65b6909
[gaim-migrate @ 462]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
444
diff
changeset
|
3124 |
0a2eb65b6909
[gaim-migrate @ 462]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
444
diff
changeset
|
3125 /* stick it on the away list */ |
470
4bf9c74b9e4d
[gaim-migrate @ 480]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
467
diff
changeset
|
3126 if (!strlen(b->name)) |
4bf9c74b9e4d
[gaim-migrate @ 480]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
467
diff
changeset
|
3127 g_snprintf(b->name, sizeof(b->name), "I'm away!"); |
4bf9c74b9e4d
[gaim-migrate @ 480]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
467
diff
changeset
|
3128 do_away_message(NULL, b); |
1 | 3129 |
3130 destroy_dialog(NULL, ca->window); | |
3131 } | |
3132 | |
3133 void create_away_mess(GtkWidget *widget, void *dummy) | |
3134 { | |
3135 GtkWidget *bbox; | |
439 | 3136 GtkWidget *hbox; |
1 | 3137 GtkWidget *titlebox; |
3138 GtkWidget *tbox; | |
3139 GtkWidget *create; | |
3140 GtkWidget *sw; | |
3141 GtkWidget *label; | |
439 | 3142 GtkWidget *frame; |
3143 GtkWidget *fbox; | |
441 | 3144 GtkWidget *button_box; |
3145 GtkWidget *button; | |
3146 GdkPixmap *icon; | |
3147 GdkBitmap *mask; | |
3148 GtkWidget *icon_i; | |
1 | 3149 |
3150 struct create_away *ca = g_new0(struct create_away, 1); | |
3151 | |
3152 /* Set up window */ | |
3153 ca->window = gtk_window_new(GTK_WINDOW_DIALOG); | |
441 | 3154 gtk_widget_set_usize(ca->window, 275, 200); |
3155 gtk_widget_show(ca->window); | |
3156 gtk_container_border_width(GTK_CONTAINER(ca->window), 5); | |
440 | 3157 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
|
3158 gtk_window_set_title(GTK_WINDOW(ca->window), _("Gaim - New away message")); |
1 | 3159 gtk_signal_connect(GTK_OBJECT(ca->window),"delete_event", |
3160 GTK_SIGNAL_FUNC(destroy_dialog), ca->window); | |
3161 | |
439 | 3162 /* Set up our frame */ |
3163 | |
3164 frame = gtk_frame_new(_("New away message")); | |
3165 | |
1 | 3166 /* set up container boxes */ |
440 | 3167 bbox = gtk_hbox_new(FALSE, 0); |
439 | 3168 fbox = gtk_vbox_new(FALSE, 0); |
440 | 3169 hbox = gtk_hbox_new(FALSE, 0); |
1 | 3170 titlebox = gtk_hbox_new(FALSE, 0); |
3171 tbox = gtk_vbox_new(FALSE, 0); | |
3172 | |
3173 /* Make a label for away entry */ | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
3174 label = gtk_label_new(_("Away title: ")); |
440 | 3175 gtk_box_pack_start(GTK_BOX(titlebox), label, TRUE, TRUE, 5); |
441 | 3176 gtk_widget_show(label); |
1 | 3177 |
3178 /* make away title entry */ | |
3179 ca->entry = gtk_entry_new(); | |
440 | 3180 gtk_box_pack_start(GTK_BOX(titlebox), ca->entry, TRUE, TRUE, 5); |
1 | 3181 |
3182 sw = gtk_scrolled_window_new(NULL, NULL); | |
3183 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
3184 GTK_POLICY_AUTOMATIC, | |
3185 GTK_POLICY_AUTOMATIC); | |
3186 gtk_widget_show(sw); | |
3187 | |
3188 /* create and format text box */ | |
3189 ca->text = gtk_text_new(NULL, NULL); | |
3190 gtk_text_set_word_wrap(GTK_TEXT(ca->text), TRUE); | |
3191 gtk_text_set_editable(GTK_TEXT(ca->text), TRUE ); | |
3192 gtk_container_add(GTK_CONTAINER(sw), ca->text); | |
3193 gtk_widget_show(ca->text); | |
440 | 3194 gtk_box_pack_start(GTK_BOX(bbox), sw, TRUE, TRUE, 5); |
1 | 3195 |
441 | 3196 /* create 'create' button */ |
439 | 3197 |
441 | 3198 button_box = gtk_hbox_new(TRUE, 5); |
3199 | |
3200 icon = gdk_pixmap_create_from_xpm_d( ca->window->window , &mask, NULL, save_xpm); | |
3201 icon_i = gtk_pixmap_new ( icon, mask ); | |
452
0a2eb65b6909
[gaim-migrate @ 462]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
444
diff
changeset
|
3202 label = gtk_label_new(_("Away")); |
441 | 3203 |
3204 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
3205 gtk_box_pack_start(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
3206 gtk_widget_show(icon_i); | |
3207 gtk_widget_show(label); | |
3208 | |
3209 button = gtk_button_new(); | |
3210 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(create_mess), ca); | |
3211 gtk_widget_show(button_box); | |
3212 gtk_container_add(GTK_CONTAINER(button), button_box); | |
3213 gtk_widget_show(button); | |
3214 | |
3215 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 5); | |
3216 | |
3217 /* End of our create button code */ | |
3218 | |
439 | 3219 /* create cancel button */ |
441 | 3220 |
3221 button_box = gtk_hbox_new(TRUE, 5); | |
3222 | |
3223 icon = gdk_pixmap_create_from_xpm_d( ca->window->window , &mask, NULL, cancel_xpm); | |
3224 icon_i = gtk_pixmap_new ( icon, mask ); | |
3225 label = gtk_label_new(_("Cancel")); | |
3226 | |
3227 gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2); | |
3228 gtk_box_pack_start(GTK_BOX(button_box), label, FALSE, FALSE, 2); | |
3229 gtk_widget_show(icon_i); | |
3230 gtk_widget_show(label); | |
3231 | |
3232 button = gtk_button_new(); | |
3233 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(destroy_dialog), ca->window); | |
3234 gtk_widget_show(button_box); | |
3235 gtk_container_add(GTK_CONTAINER(button), button_box); | |
3236 gtk_widget_show(button); | |
3237 | |
3238 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); | |
3239 | |
3240 /* End of our cancel button code */ | |
1 | 3241 |
3242 /* Checkbox for showing away msg */ | |
452
0a2eb65b6909
[gaim-migrate @ 462]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
444
diff
changeset
|
3243 ca->checkbx = gtk_check_button_new_with_label(_("Save for later use")); |
1 | 3244 |
3245 /* pack boxes where they belong */ | |
440 | 3246 gtk_box_pack_start(GTK_BOX(fbox), titlebox, TRUE, TRUE, 5); |
3247 gtk_box_pack_start(GTK_BOX(fbox), bbox, TRUE, TRUE, 5); | |
3248 gtk_box_pack_start(GTK_BOX(fbox), ca->checkbx, TRUE, TRUE, 5); | |
439 | 3249 |
3250 gtk_container_add(GTK_CONTAINER(frame), fbox); | |
3251 gtk_container_set_border_width(GTK_CONTAINER(frame), 5); | |
3252 gtk_box_pack_start(GTK_BOX(tbox), frame, TRUE, TRUE, 0); | |
442 | 3253 gtk_box_pack_start(GTK_BOX(tbox), hbox, TRUE, FALSE, 5); |
439 | 3254 |
1 | 3255 gtk_container_add(GTK_CONTAINER(ca->window), tbox); |
3256 | |
3257 /* let the world see what we have done. */ | |
3258 gtk_widget_show(label); | |
3259 gtk_widget_show(ca->checkbx); | |
3260 gtk_widget_show(ca->entry); | |
3261 gtk_widget_show(titlebox); | |
439 | 3262 gtk_widget_show(hbox); |
1 | 3263 gtk_widget_show(tbox); |
3264 gtk_widget_show(bbox); | |
439 | 3265 gtk_widget_show(fbox); |
3266 gtk_widget_show(frame); | |
1 | 3267 |
3268 gtk_widget_realize(ca->window); | |
3269 aol_icon(ca->window->window); | |
3270 } |