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