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