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