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