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