comparison src/buddy_chat.c @ 472:6a92cd7322cc

[gaim-migrate @ 482] merged chat and IM windows. /me is now in IM, font/color dialogs in chat, and smileys in chat too. also, fixed the GOOD bug. i don't know what kind of crack rob was smoking when he decided O could be eyes. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sun, 09 Jul 2000 23:19:21 +0000
parents 5040146e18a8
children 1a9d2b345b79
comparison
equal deleted inserted replaced
471:4d0b703a094c 472:6a92cd7322cc
26 #include <sys/time.h> 26 #include <sys/time.h>
27 #include <unistd.h> 27 #include <unistd.h>
28 #include <stdio.h> 28 #include <stdio.h>
29 #include <stdlib.h> 29 #include <stdlib.h>
30 #include <gtk/gtk.h> 30 #include <gtk/gtk.h>
31 #include "gaim.h"
32 #include "gtkhtml.h" 31 #include "gtkhtml.h"
33 #include <gdk/gdkkeysyms.h> 32 #include <gdk/gdkkeysyms.h>
34 33
35 #include "pixmaps/underline.xpm" 34 #include "convo.h"
36 #include "pixmaps/bold.xpm"
37 #include "pixmaps/italic.xpm"
38 #include "pixmaps/small.xpm"
39 #include "pixmaps/normal.xpm"
40 #include "pixmaps/big.xpm"
41 #include "pixmaps/fontface.xpm"
42 #include "pixmaps/palette.xpm"
43 #include "pixmaps/link.xpm"
44 #include "pixmaps/strike.xpm"
45 #include "pixmaps/speaker.xpm"
46 #include "pixmaps/wood.xpm"
47 #include "pixmaps/join.xpm"
48 #include "pixmaps/cancel.xpm"
49
50 /*
51 #include "pixmaps/smile_happy.xpm"
52 #include "pixmaps/smile_sad.xpm"
53 #include "pixmaps/smile_wink.xpm"
54 */
55 35
56 static GtkWidget *joinchat; 36 static GtkWidget *joinchat;
57 static GtkWidget *entry; 37 static GtkWidget *entry;
58 static GtkWidget *invite; 38 static GtkWidget *invite;
59 static GtkWidget *inviteentry; 39 static GtkWidget *inviteentry;
202 } 182 }
203 gtk_widget_show(joinchat); 183 gtk_widget_show(joinchat);
204 } 184 }
205 185
206 186
207 static void do_invite(GtkWidget *w, struct buddy_chat *b) 187 static void do_invite(GtkWidget *w, struct conversation *b)
208 { 188 {
209 char *buddy; 189 char *buddy;
210 char *mess; 190 char *mess;
191
192 if (!b->is_chat) {
193 debug_print("do_invite: expecting chat, got IM\n");
194 return;
195 }
211 196
212 buddy = gtk_entry_get_text(GTK_ENTRY(inviteentry)); 197 buddy = gtk_entry_get_text(GTK_ENTRY(inviteentry));
213 mess = gtk_entry_get_text(GTK_ENTRY(invitemess)); 198 mess = gtk_entry_get_text(GTK_ENTRY(invitemess));
214 199
215 if (invite) { 200 if (invite) {
219 invite=NULL; 204 invite=NULL;
220 } 205 }
221 206
222 207
223 208
224 static void invite_callback(GtkWidget *w, struct buddy_chat *b) 209 void invite_callback(GtkWidget *w, struct conversation *b)
225 { 210 {
226 GtkWidget *cancel; 211 GtkWidget *cancel;
227 GtkWidget *invite_btn; 212 GtkWidget *invite_btn;
228 GtkWidget *label; 213 GtkWidget *label;
229 GtkWidget *bbox; 214 GtkWidget *bbox;
282 267
283 } 268 }
284 gtk_widget_show(invite); 269 gtk_widget_show(invite);
285 } 270 }
286 271
287 static gboolean meify(char *message) { 272 gboolean meify(char *message) {
288 /* read /me-ify : if the message (post-HTML) starts with /me, remove 273 /* read /me-ify : if the message (post-HTML) starts with /me, remove
289 * the "/me " part of it (including that space) and return TRUE */ 274 * the "/me " part of it (including that space) and return TRUE */
290 char *c = message; 275 char *c = message;
291 int inside_HTML = 0; /* i really don't like descriptive names */ 276 int inside_HTML = 0; /* i really don't like descriptive names */
292 if (!c) return FALSE; /* um... this would be very bad if this happens */ 277 if (!c) return FALSE; /* um... this would be very bad if this happens */
306 return TRUE; 291 return TRUE;
307 } else 292 } else
308 return FALSE; 293 return FALSE;
309 } 294 }
310 295
311 void chat_write(struct buddy_chat *b, char *who, int flag, char *message) 296 void chat_write(struct conversation *b, char *who, int flag, char *message)
312 { 297 {
313 char *buf;
314 GList *ignore = b->ignored; 298 GList *ignore = b->ignored;
315 char *str; 299 char *str;
316 char colour[10]; 300
317 301 if (!b->is_chat) {
302 debug_print("chat_write: expecting chat, got IM\n");
303 return;
304 }
318 305
319 while(ignore) { 306 while(ignore) {
320 if (!strcasecmp(who, ignore->data)) 307 if (!strcasecmp(who, ignore->data))
321 return; 308 return;
322 ignore = ignore->next; 309 ignore = ignore->next;
323 } 310 }
324 311
325 312
326 buf = g_malloc(BUF_LONG); 313 if (!(flag & WFLAG_WHISPER)) {
327 314 str = g_strdup(normalize(who));
328 if (flag & WFLAG_WHISPER) { 315 if (!strcasecmp(str, normalize(current_user->username))) {
329 if (meify(message)) { 316 sprintf(debug_buff, "%s %s\n", normalize(who), normalize(current_user->username));
330 str = g_malloc(64); 317 debug_print(debug_buff);
331 g_snprintf(str, 62, "***%s", who); 318 if (b->makesound && (sound_options & OPT_SOUND_CHAT_SAY))
332 strcpy(colour, "#6C2585\0"); 319 play_sound(SEND);
320 flag |= WFLAG_SEND;
333 } else { 321 } else {
334 str = g_malloc(64); 322 if (b->makesound && (sound_options & OPT_SOUND_CHAT_SAY))
335 g_snprintf(str, 62, "*%s*:", who); 323 play_sound(RECEIVE);
336 strcpy(colour, "#00ff00\0"); 324 flag |= WFLAG_RECV;
337 } 325 }
338 } else { 326 g_free(str);
339 if (meify(message)) {
340 str = g_strdup(normalize(who));
341 if (!strcasecmp(str, normalize(current_user->username))) {
342 if (b->makesound && (sound_options & OPT_SOUND_CHAT_SAY))
343 play_sound(SEND);
344 } else {
345 if (b->makesound && (sound_options & OPT_SOUND_CHAT_SAY))
346 play_sound(RECEIVE);
347 }
348 g_free(str);
349 str = g_malloc(64);
350 g_snprintf(str, 62, "***%s", who);
351 strcpy(colour, "#6C2585\0");
352 } else {
353 str = g_strdup(normalize(who));
354 if (!strcasecmp(str, normalize(current_user->username))) {
355 if (b->makesound && (sound_options & OPT_SOUND_CHAT_SAY))
356 play_sound(SEND);
357 strcpy(colour, "#0000ff\0");
358 } else {
359 if (b->makesound && (sound_options & OPT_SOUND_CHAT_SAY))
360 play_sound(RECEIVE);
361 strcpy(colour, "#ff0000\0");
362 }
363 g_free(str);
364 str = g_malloc(64);
365 g_snprintf(str, 62, "%s:", who);
366 }
367 } 327 }
368 328
369 329 write_to_conv(b, message, flag, who);
370 330 }
371 if (display_options & OPT_DISP_SHOW_TIME) 331
372 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s %s </B></FONT>", colour, date(), str); 332
373 else 333
374 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s </B></FONT>", colour, str); 334 void whisper_callback(GtkWidget *widget, struct conversation *b)
375
376 gtk_html_freeze(GTK_HTML(b->text));
377
378 gtk_html_append_text(GTK_HTML(b->text), buf, 0);
379 gtk_html_append_text(GTK_HTML(b->text), message, (display_options & OPT_DISP_IGNORE_COLOUR) ? HTML_OPTION_NO_COLOURS : 0);
380 gtk_html_append_text(GTK_HTML(b->text), "<BR>", 0);
381
382 gtk_html_thaw(GTK_HTML(b->text));
383
384 if (general_options & OPT_GEN_POPUP_CHAT)
385 gdk_window_show(b->window->window);
386
387 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(b->name)) {
388 char *t1;
389 FILE *fd;
390
391 t1 = g_malloc(256);
392 snprintf(t1, 256, "%s.chat", b->name);
393 fd = open_log_file(t1);
394 g_free(t1);
395 if (general_options & OPT_GEN_STRIP_HTML) {
396 t1 = strip_html(message);
397 if (display_options & OPT_DISP_SHOW_TIME)
398 fprintf(fd, "%s %s %s\n", date(), str, t1);
399 else
400 fprintf(fd, "%s %s\n", str, t1);
401 g_free(t1);
402 } else {
403 if (display_options & OPT_DISP_SHOW_TIME)
404 fprintf(fd, "%s %s %s\n", date(), str, message);
405 else
406 fprintf(fd, "%s %s\n", str, message);
407 }
408 fclose(fd);
409 }
410
411 g_free(str);
412 g_free(buf);
413 }
414
415 static void close_callback(GtkWidget *widget, struct buddy_chat *b)
416 {
417 if (b->window)
418 gtk_widget_destroy(b->window);
419 b->window = NULL;
420
421 serv_chat_leave(b->id);
422 }
423
424
425
426 static void whisper_callback(GtkWidget *widget, struct buddy_chat *b)
427 { 335 {
428 char buf[BUF_LEN*4]; 336 char buf[BUF_LEN*4];
429 char buf2[BUF_LONG]; 337 char buf2[BUF_LONG];
430 GList *selected; 338 GList *selected;
431 char *who; 339 char *who;
458 366
459 367
460 } 368 }
461 369
462 370
463 static void send_callback(GtkWidget *widget, struct buddy_chat *b) 371
464 { 372 void update_chat_list(struct conversation *b)
465 char buf[BUF_LEN*4];
466
467 strncpy(buf, gtk_editable_get_chars(GTK_EDITABLE(b->entry), 0, -1), sizeof(buf)/2);
468 if (!strlen(buf))
469 return;
470
471 gtk_editable_delete_text(GTK_EDITABLE(b->entry), 0, -1);
472
473 if (general_options & OPT_GEN_SEND_LINKS) {
474 linkify_text(buf);
475 }
476
477 #ifdef GAIM_PLUGINS
478 {
479 GList *c = callbacks;
480 struct gaim_callback *g;
481 void (*function)(char *, char **, void *);
482 char *buffy = g_strdup(buf);
483 while (c) {
484 g = (struct gaim_callback *)c->data;
485 if (g->event == event_chat_send && g->function != NULL) {
486 function = g->function;
487 (*function)(b->name, &buffy, g->data);
488 }
489 c = c->next;
490 }
491 if (!buffy)
492 return;
493 g_snprintf(buf, sizeof buf, "%s", buffy);
494 g_free(buffy);
495 }
496 #endif
497
498
499 escape_text(buf);
500 serv_chat_send(b->id, buf);
501
502 gtk_widget_grab_focus(GTK_WIDGET(b->entry));
503
504 serv_set_idle(0);
505
506 if ((general_options & OPT_GEN_BACK_ON_IM) && awaymessage != NULL) {
507 do_im_back();
508 }
509 }
510
511
512 static gboolean chat_keypress_callback(GtkWidget *entry, GdkEventKey *event, struct buddy_chat *c)
513 {
514 int pos;
515 if (event->keyval == GDK_Return) {
516 if (!(event->state & GDK_SHIFT_MASK)
517 && (general_options & OPT_GEN_ENTER_SENDS)) {
518 gtk_signal_emit_by_name(GTK_OBJECT(entry), "activate", c);
519 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
520 } else {
521 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
522 pos = gtk_editable_get_position(GTK_EDITABLE(entry));
523 gtk_editable_insert_text(GTK_EDITABLE(entry), "\n", 1, &pos);
524 }
525 }
526
527 /* now we see if we need to unset any buttons */
528
529 if (invert_tags(c->entry, "<B>", "</B>", 0))
530 quiet_set(c->bold, TRUE);
531 else if (count_tag(c->entry, "<B>", "</B>"))
532 quiet_set(c->bold, TRUE);
533 else
534 quiet_set(c->bold,FALSE);
535
536 if (invert_tags(c->entry, "<I>", "</I>", 0))
537 quiet_set(c->italic, TRUE);
538 else if (count_tag(c->entry, "<I>", "</I>"))
539 quiet_set(c->italic, TRUE);
540 else
541 quiet_set(c->italic, FALSE);
542
543 if (invert_tags(entry, "<FONT COLOR", "</FONT>", 0))
544 quiet_set(c->palette, TRUE);
545 else if (count_tag(entry, "<FONT COLOR", "</FONT>"))
546 quiet_set(c->palette, TRUE);
547 else
548 quiet_set(c->palette, FALSE);
549
550 if (invert_tags(entry, "<FONT FACE", "</FONT>", 0))
551 quiet_set(c->font, TRUE);
552 else if (count_tag(entry, "<FONT FACE", "</FONT>"))
553 quiet_set(c->font, TRUE);
554 else
555 quiet_set(c->font, FALSE);
556
557 if (invert_tags(c->entry, "<A HREF", "</A>", 0))
558 quiet_set(c->link, TRUE);
559 else if (count_tag(c->entry, "<A HREF", "</A>"))
560 quiet_set(c->link, TRUE);
561 else
562 quiet_set(c->link, FALSE);
563
564 if (invert_tags(entry, "<U>", "</U>", 0))
565 quiet_set(c->underline, TRUE);
566 else if (count_tag(entry, "<U>", "</U>"))
567 quiet_set(c->underline, TRUE);
568 else
569 quiet_set(c->underline, FALSE);
570
571 if (invert_tags(entry, "<STRIKE>", "</STRIKE>", 0))
572 quiet_set(c->strike, TRUE);
573 else if (count_tag(entry, "<STRIKE>", "</STRIKE>"))
574 quiet_set(c->strike, TRUE);
575 else
576 quiet_set(c->strike, FALSE);
577
578 return TRUE;
579
580 }
581
582
583 void update_chat_list(struct buddy_chat *b)
584 { 373 {
585 GtkWidget *list_item; 374 GtkWidget *list_item;
586 char name[80]; 375 char name[80];
587 char *tmp; 376 char *tmp;
588 GList *names = b->in_room; 377 GList *names = b->in_room;
589 378
379 if (!b->is_chat) {
380 debug_print("update_chat_list: expecting chat, got IM\n");
381 return;
382 }
590 383
591 gtk_list_clear_items(GTK_LIST(b->list), 0, -1); 384 gtk_list_clear_items(GTK_LIST(b->list), 0, -1);
592 385
593 386
594 while(names) { 387 while(names) {
609 402
610 } 403 }
611 404
612 405
613 406
614 void add_chat_buddy(struct buddy_chat *b, char *buddy) 407 void add_chat_buddy(struct conversation *b, char *buddy)
615 { 408 {
616 char *name = g_strdup(buddy); 409 char *name = g_strdup(buddy);
617 410
618 #ifdef GAIM_PLUGINS 411 #ifdef GAIM_PLUGINS
619 GList *c = callbacks; 412 GList *c = callbacks;
638 } 431 }
639 432
640 433
641 434
642 435
643 void remove_chat_buddy(struct buddy_chat *b, char *buddy) 436 void remove_chat_buddy(struct conversation *b, char *buddy)
644 { 437 {
645 GList *names = b->in_room; 438 GList *names = b->in_room;
646 439
647 #ifdef GAIM_PLUGINS 440 #ifdef GAIM_PLUGINS
648 GList *c = callbacks; 441 GList *c = callbacks;
670 if (b->makesound && (sound_options & OPT_SOUND_CHAT_JOIN)) 463 if (b->makesound && (sound_options & OPT_SOUND_CHAT_JOIN))
671 play_sound(BUDDY_LEAVE); 464 play_sound(BUDDY_LEAVE);
672 } 465 }
673 466
674 467
675 static void im_callback(GtkWidget *w, struct buddy_chat *b) 468 void im_callback(GtkWidget *w, struct conversation *b)
676 { 469 {
677 char *name; 470 char *name;
678 GList *i; 471 GList *i;
679 struct conversation *c; 472 struct conversation *c;
680 473
693 } 486 }
694 487
695 488
696 } 489 }
697 490
698 static void ignore_callback(GtkWidget *w, struct buddy_chat *b) 491 void ignore_callback(GtkWidget *w, struct conversation *b)
699 { 492 {
700 char *name; 493 char *name;
701 GList *i; 494 GList *i;
702 495
703 i = GTK_LIST(b->list)->selection; 496 i = GTK_LIST(b->list)->selection;
712 b->ignored = g_list_remove(b->ignored, name); 505 b->ignored = g_list_remove(b->ignored, name);
713 506
714 update_chat_list(b); 507 update_chat_list(b);
715 } 508 }
716 509
717 static void info_callback(GtkWidget *w, struct buddy_chat *b) 510
718 { 511
719 char *name; 512 void show_new_buddy_chat(struct conversation *b)
720 GList *i;
721
722 i = GTK_LIST(b->list)->selection;
723 if (i)
724 name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data));
725 else
726 return;
727
728 serv_get_info(name);
729 }
730
731
732
733
734 void show_new_buddy_chat(struct buddy_chat *b)
735 { 513 {
736 GtkWidget *win; 514 GtkWidget *win;
737 GtkWidget *text; 515 GtkWidget *text;
738 GtkWidget *send; 516 GtkWidget *send;
739 GtkWidget *list; 517 GtkWidget *list;
749 GtkWidget *sw2; 527 GtkWidget *sw2;
750 GtkWidget *vbox; 528 GtkWidget *vbox;
751 GtkWidget *vpaned; 529 GtkWidget *vpaned;
752 GtkWidget *hpaned; 530 GtkWidget *hpaned;
753 GtkWidget *toolbar; 531 GtkWidget *toolbar;
754 GdkPixmap *strike_i, *small_i, *normal_i, *big_i, *bold_i, *italic_i, *underline_i, *speaker_i, *wood_i, *palette_i, *link_i, *font_i;
755 GtkWidget *strike_p, *small_p, *normal_p, *big_p, *bold_p, *italic_p, *underline_p, *speaker_p, *wood_p, *palette_p, *link_p, *font_p;
756 GtkWidget *strike, *small, *normal, *big, *bold, *italic, *underline, *speaker, *wood, *palette, *link, *font;
757 GdkBitmap *mask;
758 532
759 win = gtk_window_new(GTK_WINDOW_TOPLEVEL); 533 win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
760 b->window = win; 534 b->window = win;
761 535
762 vpaned = gtk_vpaned_new(); 536 vpaned = gtk_vpaned_new();
789 563
790 gtk_text_set_word_wrap(GTK_TEXT(chatentry), TRUE); 564 gtk_text_set_word_wrap(GTK_TEXT(chatentry), TRUE);
791 565
792 gtk_widget_realize(win); 566 gtk_widget_realize(win);
793 567
794 toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS); 568 toolbar = build_conv_toolbar(b);
795
796 link_i = gdk_pixmap_create_from_xpm_d(win->window, &mask,
797 &win->style->white, link_xpm );
798 link_p = gtk_pixmap_new(link_i, mask);
799 gtk_widget_show(link_p);
800
801 strike_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
802 &win->style->white, strike_xpm );
803 strike_p = gtk_pixmap_new(strike_i, mask);
804 gtk_widget_show(strike_p);
805
806 palette_i = gdk_pixmap_create_from_xpm_d (win->window, &mask,
807 &win->style->white, palette_xpm );
808 palette_p = gtk_pixmap_new(palette_i, mask);
809 gtk_widget_show(palette_p);
810
811 bold_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
812 &win->style->white, bold_xpm );
813 bold_p = gtk_pixmap_new(bold_i, mask);
814 gtk_widget_show(bold_p);
815
816 italic_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
817 &win->style->white, italic_xpm );
818 italic_p = gtk_pixmap_new(italic_i, mask);
819 gtk_widget_show(italic_p);
820
821 underline_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
822 &win->style->white, underline_xpm );
823 underline_p = gtk_pixmap_new(underline_i, mask);
824 gtk_widget_show(underline_p);
825
826 small_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
827 &win->style->white, small_xpm );
828 small_p = gtk_pixmap_new(small_i, mask);
829 gtk_widget_show(small_p);
830
831 normal_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
832 &win->style->white, normal_xpm );
833 normal_p = gtk_pixmap_new(normal_i, mask);
834 gtk_widget_show(normal_p);
835
836 big_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
837 &win->style->white, big_xpm );
838 big_p = gtk_pixmap_new(big_i, mask);
839 gtk_widget_show(big_p);
840
841 wood_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
842 &win->style->white, wood_xpm );
843 wood_p = gtk_pixmap_new(wood_i, mask);
844 gtk_widget_show(wood_p);
845
846 font_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
847 &win->style->white, fontface_xpm );
848 font_p = gtk_pixmap_new(font_i, mask);
849 gtk_widget_show(font_p);
850
851 speaker_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
852 &win->style->white, speaker_xpm );
853 speaker_p = gtk_pixmap_new(speaker_i, mask);
854 gtk_widget_show(speaker_p);
855 b->makesound=1;
856
857 bold = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
858 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL,
859 _("Bold"), _("Bold Text"), _("Bold"), bold_p,
860 GTK_SIGNAL_FUNC(do_bold), chatentry);
861 italic = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
862 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
863 NULL, _("Italics"), _("Italics Text"),
864 _("Italics"), italic_p, GTK_SIGNAL_FUNC(do_italic), chatentry);
865 underline = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
866 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
867 NULL, _("Underline"), _("Underline Text"),
868 _("Underline"), underline_p, GTK_SIGNAL_FUNC(do_underline), chatentry);
869 strike = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
870 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
871 NULL, _("Strike"), _("Strike through Text"),
872 _("Strike"), strike_p, GTK_SIGNAL_FUNC(do_strike), chatentry);
873 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
874 small = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), _("Small"), _("Decrease font size"), _("Small"), small_p, GTK_SIGNAL_FUNC(do_small), chatentry);
875 normal = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), _("Normal"), _("Normal font size"), _("Normal"), normal_p, GTK_SIGNAL_FUNC(do_normal), chatentry);
876 big = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), _("Big"), _("Increase font size"), _("Big"), big_p, GTK_SIGNAL_FUNC(do_big), chatentry);
877 font = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
878 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
879 NULL, _("Font"), _("Select Font"),
880 _("Font"), font_p, NULL, NULL);
881 gtk_widget_set_sensitive(GTK_WIDGET(font), FALSE);
882
883 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
884 link = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
885 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, _("Link"), _("Insert Link"),
886 _("Link"), link_p, GTK_SIGNAL_FUNC(do_link), chatentry);
887 palette = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
888 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
889 NULL, _("Color"), _("Text Color"),
890 _("Color"), palette_p, NULL, NULL);
891 gtk_widget_set_sensitive(GTK_WIDGET(palette), FALSE);
892 wood = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
893 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
894 NULL, _("Logging"), _("Enable logging"),
895 _("Logging"), wood_p, NULL, NULL);
896 gtk_widget_set_sensitive(GTK_WIDGET(palette), FALSE);
897 gtk_widget_set_sensitive(GTK_WIDGET(wood), FALSE);
898 speaker = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
899 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
900 NULL, _("Sound"), _("Enable sounds"),
901 _("Sound"), speaker_p, GTK_SIGNAL_FUNC(set_option), &b->makesound);
902 b->makesound = 0;
903 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(speaker), TRUE);
904
905 gtk_widget_show(toolbar);
906
907 b->bold = bold;
908 b->strike = strike;
909 b->italic = italic;
910 b->underline = underline;
911 b->link = link;
912 b->palette = palette;
913 b->font = font;
914 b->wood = wood;
915
916 if (find_log_info(b->name))
917 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(wood), TRUE);
918 else
919 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(wood), FALSE);
920 569
921 gtk_object_set_user_data(GTK_OBJECT(chatentry), b); 570 gtk_object_set_user_data(GTK_OBJECT(chatentry), b);
922 b->entry = chatentry; 571 b->entry = chatentry;
923 572
924 /* Hack something so we know have an entry click event */ 573 /* Hack something so we know have an entry click event */
925 574
926 gtk_signal_connect(GTK_OBJECT(chatentry), "activate", GTK_SIGNAL_FUNC(send_callback),b); 575 gtk_signal_connect(GTK_OBJECT(chatentry), "activate", GTK_SIGNAL_FUNC(send_callback),b);
927 gtk_signal_connect(GTK_OBJECT(chatentry), "key_press_event", GTK_SIGNAL_FUNC(chat_keypress_callback), b); 576 gtk_signal_connect(GTK_OBJECT(chatentry), "key_press_event", GTK_SIGNAL_FUNC(keypress_callback), b);
928 /* Text box */ 577 /* Text box */
929 578
930 sw = gtk_scrolled_window_new (NULL, NULL); 579 sw = gtk_scrolled_window_new (NULL, NULL);
931 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), 580 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
932 GTK_POLICY_NEVER, 581 GTK_POLICY_NEVER,