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