Mercurial > pidgin
comparison src/dialogs.c @ 579:7b501c39a6ee
[gaim-migrate @ 589]
perl.c is starting to get finalized. also, made the smiley dialog a little
prettier, and a bit less code.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 02 Aug 2000 04:53:00 +0000 |
parents | aa9a8bcddd80 |
children | 7409d7ae6621 |
comparison
equal
deleted
inserted
replaced
578:a0636d0d9ee2 | 579:7b501c39a6ee |
---|---|
3582 | 3582 |
3583 close_smiley_dialog(NULL, c); | 3583 close_smiley_dialog(NULL, c); |
3584 | 3584 |
3585 return; | 3585 return; |
3586 } | 3586 } |
3587 | |
3588 static void toolbar_add_smiley(struct conversation *c, GtkWidget *bar, char **xpm, GtkWidget *win, int face) | |
3589 { | |
3590 GtkWidget *tpm; | |
3591 GdkBitmap *mask; | |
3592 GdkPixmap *dpm; | |
3593 GtkWidget *button; | |
3594 | |
3595 dpm = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, xpm); | |
3596 tpm = gtk_pixmap_new(dpm, mask); | |
3597 gtk_widget_show(tpm); | |
3598 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); | |
3599 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); | |
3600 | |
3601 if (display_options & OPT_DISP_COOL_LOOK) | |
3602 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3603 } | |
3587 | 3604 |
3588 void show_smiley_dialog(struct conversation *c, GtkWidget *widget) | 3605 void show_smiley_dialog(struct conversation *c, GtkWidget *widget) |
3589 { | 3606 { |
3590 GtkWidget *dialog; | 3607 GtkWidget *dialog; |
3591 GtkWidget *cancel_button, *cancel_label; | 3608 GtkWidget *cancel_button, *cancel_label; |
3592 GtkWidget *vbox, *smiley_box_1, *smiley_box_2, *cancel_button_box; | 3609 GtkWidget *vbox, *smiley_box_1, *smiley_box_2, *smiley_box_3, *smiley_box_4, *cancel_button_box; |
3593 GdkPixmap *angel_i, *bigsmile_i, *burp_i, *crossedlips_i, *cry_i, *embarrassed_i, *kiss_i, *moneymouth_i, *sad_i, *scream_i, *smile_i, *smile8_i, *think_i, *tongue_i, *wink_i, *yell_i, *cancel_i; | 3610 GdkPixmap *cancel_i; |
3594 GtkWidget *angel_p, *bigsmile_p, *burp_p, *crossedlips_p, *cry_p, *embarrassed_p, *kiss_p, *moneymouth_p, *sad_p, *scream_p, *smile_p, *smile8_p, *think_p, *tongue_p, *wink_p, *yell_p, *cancel_p; | 3611 GtkWidget *cancel_p; |
3595 GtkWidget *angel, *bigsmile, *burp, *crossedlips, *cry, *embarrassed, *kiss, *moneymouth, *sad, *scream, *smile, *smile8, *think, *tongue, *wink, *yell; | |
3596 GdkBitmap *mask; | 3612 GdkBitmap *mask; |
3597 GtkWidget *win; | 3613 GtkWidget *win; |
3614 GtkWidget *frame; | |
3598 | 3615 |
3599 if (c->smiley_dialog) | 3616 if (c->smiley_dialog) |
3600 return; | 3617 return; |
3618 | |
3619 win = c->window; | |
3601 | 3620 |
3602 dialog = gtk_dialog_new(); | 3621 dialog = gtk_window_new(GTK_WINDOW_DIALOG); |
3603 win = c->window; | 3622 gtk_window_set_policy(GTK_WINDOW(dialog), 0, 0, 1); |
3623 | |
3624 frame = gtk_frame_new(_("Smile!")); | |
3604 | 3625 |
3605 /* setup boxes */ | 3626 /* setup boxes */ |
3606 vbox = gtk_vbox_new(TRUE, 0); | 3627 vbox = gtk_vbox_new(TRUE, 0); |
3607 smiley_box_1 = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS); | 3628 smiley_box_1 = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS); |
3608 smiley_box_2 = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS); | 3629 smiley_box_2 = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS); |
3630 smiley_box_3 = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS); | |
3631 smiley_box_4 = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS); | |
3609 | 3632 |
3610 /* setup buttons */ | 3633 /* setup buttons */ |
3611 | 3634 |
3612 /* Build Cancel Button */ | 3635 /* Build Cancel Button */ |
3613 | 3636 |
3627 gtk_widget_show(cancel_p); | 3650 gtk_widget_show(cancel_p); |
3628 | 3651 |
3629 gtk_widget_show(cancel_button_box); | 3652 gtk_widget_show(cancel_button_box); |
3630 | 3653 |
3631 gtk_container_add(GTK_CONTAINER(cancel_button), cancel_button_box); | 3654 gtk_container_add(GTK_CONTAINER(cancel_button), cancel_button_box); |
3632 | 3655 |
3633 /* End of Cancel Button */ | 3656 /* End of Cancel Button */ |
3634 | 3657 |
3635 angel_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
3636 &win->style->white, angel_xpm ); | |
3637 angel_p = gtk_pixmap_new(angel_i, mask); | |
3638 gtk_widget_show(angel_p); | |
3639 bigsmile_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
3640 &win->style->white, bigsmile_xpm ); | |
3641 bigsmile_p = gtk_pixmap_new(bigsmile_i, mask); | |
3642 gtk_widget_show(bigsmile_p); | |
3643 burp_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
3644 &win->style->white, burp_xpm ); | |
3645 burp_p = gtk_pixmap_new(burp_i, mask); | |
3646 gtk_widget_show(burp_p); | |
3647 crossedlips_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
3648 &win->style->white, crossedlips_xpm ); | |
3649 crossedlips_p = gtk_pixmap_new(crossedlips_i, mask); | |
3650 gtk_widget_show(crossedlips_p); | |
3651 cry_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
3652 &win->style->white, cry_xpm ); | |
3653 cry_p = gtk_pixmap_new(cry_i, mask); | |
3654 gtk_widget_show(cry_p); | |
3655 embarrassed_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
3656 &win->style->white, embarrassed_xpm ); | |
3657 embarrassed_p = gtk_pixmap_new(embarrassed_i, mask); | |
3658 gtk_widget_show(embarrassed_p); | |
3659 kiss_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
3660 &win->style->white, kiss_xpm ); | |
3661 kiss_p = gtk_pixmap_new(kiss_i, mask); | |
3662 gtk_widget_show(kiss_p); | |
3663 moneymouth_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
3664 &win->style->white, moneymouth_xpm ); | |
3665 moneymouth_p = gtk_pixmap_new(moneymouth_i, mask); | |
3666 gtk_widget_show(moneymouth_p); | |
3667 sad_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
3668 &win->style->white, sad_xpm ); | |
3669 sad_p = gtk_pixmap_new(sad_i, mask); | |
3670 gtk_widget_show(sad_p); | |
3671 scream_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
3672 &win->style->white, scream_xpm ); | |
3673 scream_p = gtk_pixmap_new(scream_i, mask); | |
3674 gtk_widget_show(scream_p); | |
3675 smile_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
3676 &win->style->white, smile_xpm ); | |
3677 smile_p = gtk_pixmap_new(smile_i, mask); | |
3678 gtk_widget_show(smile_p); | |
3679 smile8_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
3680 &win->style->white, smile8_xpm ); | |
3681 smile8_p = gtk_pixmap_new(smile8_i, mask); | |
3682 gtk_widget_show(smile8_p); | |
3683 think_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
3684 &win->style->white, think_xpm ); | |
3685 think_p = gtk_pixmap_new(think_i, mask); | |
3686 gtk_widget_show(think_p); | |
3687 tongue_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
3688 &win->style->white, tongue_xpm ); | |
3689 tongue_p = gtk_pixmap_new(tongue_i, mask); | |
3690 gtk_widget_show(tongue_p); | |
3691 wink_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
3692 &win->style->white, wink_xpm ); | |
3693 wink_p = gtk_pixmap_new(wink_i, mask); | |
3694 gtk_widget_show(wink_p); | |
3695 yell_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
3696 &win->style->white, yell_xpm ); | |
3697 yell_p = gtk_pixmap_new(yell_i, mask); | |
3698 gtk_widget_show(yell_p); | |
3699 | |
3700 /* pack buttons */ | 3658 /* pack buttons */ |
3701 angel = gtk_toolbar_append_element(GTK_TOOLBAR(smiley_box_1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Insert angel face"), _("Angel"), angel_p, GTK_SIGNAL_FUNC(set_smiley_array), (int *)FACE_ANGEL); | 3659 toolbar_add_smiley(c, smiley_box_1, angel_xpm, win, FACE_ANGEL); |
3702 bigsmile = gtk_toolbar_append_element(GTK_TOOLBAR(smiley_box_1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Insert big smiley face"), _("Big smile"), bigsmile_p, GTK_SIGNAL_FUNC(set_smiley_array), (int *)FACE_BIGSMILE); | 3660 toolbar_add_smiley(c, smiley_box_1, bigsmile_xpm, win, FACE_BIGSMILE); |
3703 burp = gtk_toolbar_append_element(GTK_TOOLBAR(smiley_box_1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Insert burping face"), _("Burp"), burp_p, GTK_SIGNAL_FUNC(set_smiley_array), (int *)FACE_BURP); | 3661 toolbar_add_smiley(c, smiley_box_1, burp_xpm, win, FACE_BURP); |
3704 crossedlips = gtk_toolbar_append_element(GTK_TOOLBAR(smiley_box_1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Insert crossed lips face"), _("Crossed lips"), crossedlips_p, GTK_SIGNAL_FUNC(set_smiley_array), (int *)FACE_CROSSEDLIPS); | 3662 toolbar_add_smiley(c, smiley_box_1, crossedlips_xpm, win, FACE_CROSSEDLIPS); |
3705 cry = gtk_toolbar_append_element(GTK_TOOLBAR(smiley_box_1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Insert crying face"), _("Cry"), cry_p, GTK_SIGNAL_FUNC(set_smiley_array), (int *)FACE_CRY); | 3663 |
3706 embarrassed = gtk_toolbar_append_element(GTK_TOOLBAR(smiley_box_1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Insert embarrassedl face"), _("Embarrassed"), embarrassed_p, GTK_SIGNAL_FUNC(set_smiley_array), (int *)FACE_EMBARRASSED); | 3664 toolbar_add_smiley(c, smiley_box_2, cry_xpm, win, FACE_CRY); |
3707 kiss = gtk_toolbar_append_element(GTK_TOOLBAR(smiley_box_1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Insert kissing face"), _("Kiss"), kiss_p, GTK_SIGNAL_FUNC(set_smiley_array), (int *)FACE_KISS); | 3665 toolbar_add_smiley(c, smiley_box_2, embarrassed_xpm, win, FACE_EMBARRASSED); |
3708 moneymouth = gtk_toolbar_append_element(GTK_TOOLBAR(smiley_box_1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Insert money mouth face"), _("Money mouth"), moneymouth_p, GTK_SIGNAL_FUNC(set_smiley_array), (int *)FACE_MONEYMOUTH); | 3666 toolbar_add_smiley(c, smiley_box_2, kiss_xpm, win, FACE_KISS); |
3709 sad = gtk_toolbar_append_element(GTK_TOOLBAR(smiley_box_2), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Insert sad face"), _("Sad"), sad_p, GTK_SIGNAL_FUNC(set_smiley_array), (int *)FACE_SAD); | 3667 toolbar_add_smiley(c, smiley_box_2, moneymouth_xpm, win, FACE_MONEYMOUTH); |
3710 scream = gtk_toolbar_append_element(GTK_TOOLBAR(smiley_box_2), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Insert screaming face"), _("Scream"), scream_p, GTK_SIGNAL_FUNC(set_smiley_array), (int *)FACE_SCREAM); | 3668 |
3711 smile = gtk_toolbar_append_element(GTK_TOOLBAR(smiley_box_2), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Insert smiley face"), _("Smile"), smile_p, GTK_SIGNAL_FUNC(set_smiley_array), (int *)FACE_SMILE); | 3669 toolbar_add_smiley(c, smiley_box_3, sad_xpm, win, FACE_SAD); |
3712 smile8 = gtk_toolbar_append_element(GTK_TOOLBAR(smiley_box_2), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Insert big-eyed smiley face"), _("Smile8"), smile8_p, GTK_SIGNAL_FUNC(set_smiley_array), (int *)FACE_SMILE8); | 3670 toolbar_add_smiley(c, smiley_box_3, scream_xpm, win, FACE_SCREAM); |
3713 think = gtk_toolbar_append_element(GTK_TOOLBAR(smiley_box_2), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Insert thinking face"), _("Think"), think_p, GTK_SIGNAL_FUNC(set_smiley_array), (int *)FACE_THINK); | 3671 toolbar_add_smiley(c, smiley_box_3, smile_xpm, win, FACE_SMILE); |
3714 tongue = gtk_toolbar_append_element(GTK_TOOLBAR(smiley_box_2), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Insert tongue face"), _("Tongue"), tongue_p, GTK_SIGNAL_FUNC(set_smiley_array), (int *)FACE_TONGUE); | 3672 toolbar_add_smiley(c, smiley_box_3, smile8_xpm, win, FACE_SMILE8); |
3715 wink = gtk_toolbar_append_element(GTK_TOOLBAR(smiley_box_2), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Insert winking face"), _("Wink"), wink_p, GTK_SIGNAL_FUNC(set_smiley_array), (int *)FACE_WINK); | 3673 |
3716 yell = gtk_toolbar_append_element(GTK_TOOLBAR(smiley_box_2), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Insert yelling face"), _("Yell"), yell_p, GTK_SIGNAL_FUNC(set_smiley_array), (int *)FACE_YELL); | 3674 toolbar_add_smiley(c, smiley_box_4, think_xpm, win, FACE_THINK); |
3675 toolbar_add_smiley(c, smiley_box_4, tongue_xpm, win, FACE_TONGUE); | |
3676 toolbar_add_smiley(c, smiley_box_4, wink_xpm, win, FACE_WINK); | |
3677 toolbar_add_smiley(c, smiley_box_4, yell_xpm, win, FACE_YELL); | |
3717 | 3678 |
3718 /* pack containers */ | 3679 /* pack containers */ |
3719 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), cancel_button, FALSE, FALSE, 10); | |
3720 gtk_box_pack_start(GTK_BOX(vbox), smiley_box_1, TRUE, TRUE, 0); | 3680 gtk_box_pack_start(GTK_BOX(vbox), smiley_box_1, TRUE, TRUE, 0); |
3721 gtk_box_pack_start(GTK_BOX(vbox), smiley_box_2, TRUE, TRUE, 0); | 3681 gtk_box_pack_start(GTK_BOX(vbox), smiley_box_2, TRUE, TRUE, 0); |
3722 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), vbox); | 3682 gtk_box_pack_start(GTK_BOX(vbox), smiley_box_3, TRUE, TRUE, 0); |
3683 gtk_box_pack_start(GTK_BOX(vbox), smiley_box_4, TRUE, TRUE, 0); | |
3684 gtk_box_pack_start(GTK_BOX(vbox), cancel_button, FALSE, FALSE, 0); | |
3685 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
3686 gtk_container_add(GTK_CONTAINER(dialog), frame); | |
3687 gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); | |
3723 | 3688 |
3724 /* connect signals */ | 3689 /* connect signals */ |
3725 gtk_signal_connect(GTK_OBJECT(cancel_button), "clicked", GTK_SIGNAL_FUNC(close_smiley_dialog), c); | 3690 gtk_signal_connect(GTK_OBJECT(cancel_button), "clicked", GTK_SIGNAL_FUNC(close_smiley_dialog), c); |
3726 gtk_signal_connect(GTK_OBJECT(angel), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); | |
3727 gtk_signal_connect(GTK_OBJECT(bigsmile), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); | |
3728 gtk_signal_connect(GTK_OBJECT(burp), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); | |
3729 gtk_signal_connect(GTK_OBJECT(crossedlips), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); | |
3730 gtk_signal_connect(GTK_OBJECT(cry), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); | |
3731 gtk_signal_connect(GTK_OBJECT(embarrassed), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); | |
3732 gtk_signal_connect(GTK_OBJECT(kiss), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); | |
3733 gtk_signal_connect(GTK_OBJECT(moneymouth), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); | |
3734 gtk_signal_connect(GTK_OBJECT(sad), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); | |
3735 gtk_signal_connect(GTK_OBJECT(scream), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); | |
3736 gtk_signal_connect(GTK_OBJECT(smile), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); | |
3737 gtk_signal_connect(GTK_OBJECT(smile8), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); | |
3738 gtk_signal_connect(GTK_OBJECT(think), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); | |
3739 gtk_signal_connect(GTK_OBJECT(tongue), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); | |
3740 gtk_signal_connect(GTK_OBJECT(wink), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); | |
3741 gtk_signal_connect(GTK_OBJECT(yell), "clicked", GTK_SIGNAL_FUNC(insert_smiley_text), c); | |
3742 | |
3743 /* show everything */ | 3691 /* show everything */ |
3744 if (display_options & OPT_DISP_COOL_LOOK) | 3692 if (display_options & OPT_DISP_COOL_LOOK) |
3745 gtk_button_set_relief(GTK_BUTTON(cancel_button), GTK_RELIEF_NONE); | 3693 gtk_button_set_relief(GTK_BUTTON(cancel_button), GTK_RELIEF_NONE); |
3746 | 3694 |
3747 gtk_button_set_relief(GTK_BUTTON(angel), GTK_RELIEF_NONE); | |
3748 gtk_button_set_relief(GTK_BUTTON(bigsmile), GTK_RELIEF_NONE); | |
3749 gtk_button_set_relief(GTK_BUTTON(burp), GTK_RELIEF_NONE); | |
3750 gtk_button_set_relief(GTK_BUTTON(crossedlips), GTK_RELIEF_NONE); | |
3751 gtk_button_set_relief(GTK_BUTTON(cry), GTK_RELIEF_NONE); | |
3752 gtk_button_set_relief(GTK_BUTTON(embarrassed), GTK_RELIEF_NONE); | |
3753 gtk_button_set_relief(GTK_BUTTON(kiss), GTK_RELIEF_NONE); | |
3754 gtk_button_set_relief(GTK_BUTTON(moneymouth), GTK_RELIEF_NONE); | |
3755 gtk_button_set_relief(GTK_BUTTON(sad), GTK_RELIEF_NONE); | |
3756 gtk_button_set_relief(GTK_BUTTON(scream), GTK_RELIEF_NONE); | |
3757 gtk_button_set_relief(GTK_BUTTON(smile), GTK_RELIEF_NONE); | |
3758 gtk_button_set_relief(GTK_BUTTON(smile8), GTK_RELIEF_NONE); | |
3759 gtk_button_set_relief(GTK_BUTTON(think), GTK_RELIEF_NONE); | |
3760 gtk_button_set_relief(GTK_BUTTON(tongue), GTK_RELIEF_NONE); | |
3761 gtk_button_set_relief(GTK_BUTTON(wink), GTK_RELIEF_NONE); | |
3762 gtk_button_set_relief(GTK_BUTTON(yell), GTK_RELIEF_NONE); | |
3763 | |
3764 gtk_window_set_title(GTK_WINDOW(dialog), _("Smile!")); | 3695 gtk_window_set_title(GTK_WINDOW(dialog), _("Smile!")); |
3696 | |
3697 c->smiley_dialog = dialog; | |
3765 gtk_widget_show_all(dialog); | 3698 gtk_widget_show_all(dialog); |
3766 | |
3767 c->smiley_dialog = dialog; | |
3768 | 3699 |
3769 return; | 3700 return; |
3770 } | 3701 } |